Subversion log messages need not be set in stone

Simon Willison mentioned a while back a link to help on how to undo a svn commit in subversion (more a kind of internal branching than an actual undo, of course: but that’s subversion). That’s all very well, but how about undoing the log message for a particular commit?

Say you have a codebase that only you’ve worked on, and the log messages are (to say the least) idiosyncratic. Worse, they might contain swear words like “p*mh*le,” “cl*ff-pr*nker” or “Gr**nsp*n.” How can you, for example, get rid of a bit of bitching between programmers like:

$ svn log -r 200
————————————————————————
r200 | jps | 2007-05-30 14:50:56 +0100 (Wed, 30 May 2007) | 2 lines

oh for heaven’s sake - cacheing at view layer broke CSS!
Which buffoon wrote l51-78, ***Malcolm***?
————————————————————————

The svn propset command in principle lets you change log messages. However, most archives are set up to prevent this by default with “hooks.” You can alter the configuration of the archive to permit this, if you’ve got administrator’s access to the physical files of the archive. But if you’ve got that, then you can change the log message directly with the svnadmin setlog command and the -

-bypass-hooks option:

% echo “Fixed” > /tmp/newlog.txt
% svnadmin setlog -

-bypass-hooks /home/svn/repositories/bluefish /tmp/newlog.txt -r 200

The advantage of this is that all hooks remain in place afterwards, so you don’t have to worry about re-securing the archive. As the link to the Redbean book up there states, though, be warned that -

-bypass-hooks bypasses all hooks: if you have email alerts set up to report each submission, then they too will fail to fire. Another reason not to do it permanently, I suppose.

(And I don’t work with anyone called Malcolm.)

Comments

[...] Graceful Exits » Subversion log messages need not be set in stoneHere’s a quick tip for changing Subversion log messages. [...]