Search code examples
svnconflictsvn-update

How can I get SVN to take a specific resolution for all binary conflicts without prompting me for each one?


When running an svn up I regularly encounter this prompt:

Conflict discovered in 'lib/somelibrary.so'.
Select: (p) postpone,
        (mf) mine-full, (tf) theirs-full,
        (s) show all options:

Hitting s reveals the options mc and tc, mine-conflict and theirs-conflict, which supposedly allow me to take either my version or their version for all conflicts and not just somelibrary.so.

However, those options don't work. I get this message:

Invalid option; cannot choose based on conflicts in a binary file.

Edwin's answer makes it clear that I've misunderstood how mc and tc work, but I still want to be able to take the same resolution for every file that conflicts. Is there a way to make svn use mf or tf for every conflict without prompting me again after the first time?


Solution

  • To automatically resolve conflicts on svn update, svn switch, svn merge, use the --accept flag.

    From the SVN Book - svn options:

    --accept ACTION
    Specifies an action for automatic conflict resolution. Possible actions are postpone, base, mine-full, theirs-full, edit, and launch.

    Meaning of each action can be seen in the svn resolve specification:

    You can pass the following arguments to the --accept command depending on your desired resolution:

    base Choose the file that was the BASE revision before you updated your working copy. That is, the file that you checked out before you made your latest edits.

    working Assuming that you've manually handled the conflict resolution, choose the version of the file as it currently stands in your working copy.

    mine-full Resolve all conflicted files with copies of the files as they stood immediately before you ran svn update.

    theirs-full Resolve all conflicted files with copies of the files that were fetched from the server when you ran svn update.

    mine-conflict Resolve all conflicted files by preferring local modifications over the changes fetched from the server in conflicting regions of each file's content.

    theirs-conflict Resolve all conflicted files by preferring the changes fetched from the server over local modifications in conflicting regions of each file's content.

    Also check out the Resolve Any Conflict section.

    Finally, an example. To automatically resolve all the conflicts as mine-full on update, execute:

    $ svn up --resolve mine-full