Tuesday, July 27, 2010

how to modify svn log

It is universally a best practice for everyone who uses Subversion (svn) (or any other source version control system) to enter very detailed log for each svn commit.  If for any reasons you disagree with what I just said, please think about situations when you work on a project with 5 or 6 people (or more) and you encounter some mysterious bugs.  What will happen, for a worst case scenario, is when you ask everyone around who has worked on these files.  (It is so easy to get a name list from svn log.)  Alas, no one can remember what he/she has done.  They all know their names are there however they just really forget about it... and this just sucks (given that it really happens too often).  Idealistically, I would say a good enough log has to be able to help a single person to see just the logs and result from "svn diff" and then they can understand what happened, why it happened and how it happened without consulting other people.  Anyway... let's get back to the topic...

Some times we forget to put some useful info into the log for some svn commits.  Or maybe we find additional info that we think it will be worth adding them into the logs of some older revisions.  Good news, we can accomplish that with not much effort.  Though, It is not enabled by default, we only have to enable it.

Assuming your svn repository is in:

/svnrepo/

You should see a file there:

/svnrepo/hooks/pre-revprop-change.tmpl

All you have to do is to rename it like this (remove the .tmpl):

$ mv pre-revprop-change.tmpl pre-revprop-change

Then, you have to grant execute permission to it like this:

$ chmod +x pre-revprop-change

After that you can modify already committed svn log by, for example:

$ svn propedit --revprop -r 11 svn:log file:///svnrepo/

Assuming you want to edit svn log at revision 11.

references

0 comments:

Post a Comment