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: 299
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)
© Stack Overflow or respective owner