Svn merging and automatically resolving conflicts

Decrypter picture Decrypter · Apr 13, 2013 · Viewed 13.7k times · Source

I am new to svn and need to do a lot of merging from trunk to a branch we are working from. This is the sequence of svn commmands I take to merge

svn up
svn mergeinfo --show-revs eligible branch trunk (branch and trunk are actually svn urls)

I get the lowest revision of the eligible revisions from branch and the latest trunk revision, then do an svn merge.

svn merge -r lowest_eligible:latest_trunk trunk_url .

During the merge there are a few conflicts. However, they are not related to any changes we have made in the branch so I'm a little confused why they are conflicts. Any ideas? Anyway, I always just choose, theirs-full to resolve it

Finally, I need to do svn resolve before committing

svn resolve --accept working -R .

I have two questions. Is this the best sequence of commands to perform a merge from trunk to branch?

The merge tends to take a while so I would like to just leave it merging and let svn automatically resolve the conflict to theirs-full. Is there a way to do this?

Answer

Lazy Badger picture Lazy Badger · Apr 13, 2013
  1. If you merge from trunk to branch (in branch's WC) order of parameters in mergeinfo is incorrect (reversed): shortened correct form have to be svn mergeinfo --show-revs eligible trunk (first parameter is SOURCE of merge, second - TARGET /default "."/, i.e your WC)
  2. If you use Subversion, which has already support for mergeinfo, you can skip detecting range of "have to be merged" revisions - Subversion do it automagically on merge
  3. If you want in case of conflict always prefer changes from trunk, you can add it to merge command

As final result, your periodical sync-merge process will be single command inside WC of branch

svn merge <URL-OF-TRUNK> --accept "theirs-conflict"