Detecting branch reintegration or merge in pre-commit script

Posted by Shawn Chin on Stack Overflow See other posts from Stack Overflow or by Shawn Chin
Published on 2012-01-09T15:17:56Z Indexed on 2012/12/15 11:04 UTC
Read the original article Hit count: 260

Within a pre-commit script, is it possible (and if so, how) to identify commits stemming from an svn merge?

svnlook changed ... shows files that have changed, but does not differentiate between merges and manual edits.

Ideally, I would also like to differentiate between a standard merge and a merge --reintegrate.

Background:

I'm exploring the possibility of using pre-commit hooks to enforce SVN usage policies for our project.

One of the policies state that some directories (such as /trunk) should not be modified directly, and changed only through the reintegration of feature branches. The pre-commit script would therefore reject all changes made to these directories apart from branch reintegrations.

Any ideas?


Update:

I've explored the svnlook command, and the closest I've got is to detect and parse changes to the svn:mergeinfo property of the directory. This approach has some drawback:

  1. svnlook can flag up a change in properties, but not which property was changed. (a diff with the proplist of the previous revision is required)
  2. By inspecting changes in svn:mergeinfo, it is possible to detect that svn merge was run. However, there is no way to determine if the commits are purely a result of the merge. Changes manually made after the merge will go undetected. (related post: Diff transaction tree against another path/revision)

© Stack Overflow or respective owner

Related posts about svn

Related posts about pre-commit-hook