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 theproplist
of the previous revision is required)- By inspecting changes in
svn:mergeinfo
, it is possible to detect thatsvn 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)
svn:mergeinfo
is fragile: that property is the mechanism used by Subversion to track changes. However, I'm not sure that the--reintegration
option has any direct effect in revision properties. Sorry I can't be of more help. – Grondinsvn:mergeinfo
alone is not enough. See updates above. – Carpic