SVN log history woes
Matthew Gillen
me-5yx05kfkO/aqeI1yJSURBw at public.gmane.org
Fri Apr 15 09:36:54 EDT 2011
On 04/15/2011 08:46 AM, theBlueSage wrote:
> However, if I then merge foo.txt back into trunk and do svn log foo.txt
> I will only see 3 commits. the two I did before the branching, and the
> commit message from the merge back into trunk. I need to find a way to
> see all the history.
Interesting problem. What version of svn are you using? 1.6+ keeps
much better information about merges, and there is a flag to "svn log"
now that shows additional info from the merge history (-g /
--use-merge-history). I don't have a 1.6 repo with properly done merges
handy, so I can't tell you exactly what that adds.
If that doesn't do what you want, you could do a few things:
- If you formatted your merge messages in a particular way (to include
the path to the branch that is being merged, etc), then it should
theoretically be possible to wrap the svn log in a script that
recursively calls svn log on the merged branches (using --stop-on-copy).
- You could write a script (or if you want to get fancy, do it as a
pre-commit hook, which is allowed to modify the log) to generate a
commit message for the /merge commit/ that includes all the constituent
commit messages from the branch.
I think doing the second option is probably better, and done in a
non-automatic way (ie don't do the pre-commit hook). The reason is the
same as the reason why subversion doesn't do this automatically: the
nature of a merge /may/ include human intervention and/or more manual
changes. These manual changes may invalidate/undo some of the changes
from the branch.
So unless you have a policy where merges may only contain results of
"svn merge" and no manual edits (which in turn would require the branch
maintainer to keep making commits to the branch until it would merge
cleanly), then it's not safe to do anything automatic.
HTH,
Matt
More information about the Discuss
mailing list