SVN - automate merge of trunk into branch

BryceH picture BryceH · Dec 28, 2010 · Viewed 8.4k times · Source

I have a branch in SVN that I want to keep up to date with changes from the trunk. What I would like to do is have a script or something that runs nightly that does this merge and then commits the new version of the branch if there are no merge conflicts but if there are merge conflicts somehow indicate so. I found this post that is somewhat helpful although it doesn't do everything.

I have been unable to find a way to determine whether there are merge conflicts and this is mostly what I'm looking for. Adding building the code and then committing on success will be easy enough in the script but without having a way to check for merge conflicts this won't be successful.

Thanks for any help you guys can provide!

Answer

usr-local-ΕΨΗΕΛΩΝ picture usr-local-ΕΨΗΕΛΩΝ · Dec 28, 2010

I had your same exact problem, though I didn't try to automate merge because there were not many branches and I did it manually.

Anyway, the best option looks like using scripts. The script linked in your post doesn't do only the last required action: commit

I often use Linux so, if I was you, I would have used a shell script like the following:

cd /path/to/branch
svn update #just to be sure...
svn merge --non-interactive svn://path/to/trunk
svn commit -m "Automated commit"

A similar command could be used with SVN for windows in a batch script