Detecting branch reintegration or merge in pre-commit script
- by Shawn Chin
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:
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)
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)