YaK:: Using your own tool to help handle Bazaar (bzr) Conflicts [Changes]   [Calendar]   [Search]   [Index]   [PhotoTags]   

Using your own tool to help handle Bazaar (bzr) Conflicts

Bazaar Documentation: http://doc.bazaar-vcs.org/bzr.dev/en/user-guide/index.html#resolving-conflicts
Bazaar ExtMerge plugin: http://erik.bagfors.nu/bzr-plugins/extmerge/
DiffMerge: http://www.sourcegear.com/diffmerge/

Bazaar Conflicts

When you encounter a conflict using bazaar, you are given three extra files to help you resolve the conflict. For example, lets say you have a file called someText.txt in your repository that you are working on, and someone has worked on it and checked in his changes while you are working on it. Before you do a "bzr commit" to commit your changes, you have to do a "bzr update" to get your partner's changes. If there are conflicts within the file bzr will create someText.txt.BASE, someText.txt.THIS, and someText.txt.OTHER.

Here is an explanation of what each is:

   <file name>        This initially lists the conflicts.  When you are done the final resolution goes in this document.
   <file name>.BASE   This contains the state the file was in when you started working on it.
   <file name>.THIS   This should contain your changes to the file.
   <file name>.OTHER  This contains the changes done to the file while you were working on it.

Bazaar does not give you tools to visualize the conflict, but bazaar lets you use your own.

To do this, you should first install the Bazaar extmerge plugin.

ExtMerge Plugin


Here is how you install the plugin: (original instructions: http://erik.bagfors.nu/bzr-plugins/extmerge/)


The extmerge plugin is already setup to use kdiff3, xxdiff and opendiff when you install it (assuming they are in your PATH environment variable). However, what if you want to use a different tool? I didn't find much documentation describing how to setup extmerge with another tool, so here is how you accomplish this.

  * Go yo your %APPDATA%\Bazaar\2.0 directory
        On Win Vista it is c:\users\<user name>\AppData\Bazaar\2.0
        On Win XP it's C:\Documents and Settings\<user name>\Application Data\bazaar\2.0
  * Open bazaar.conf.  If it's not there, create it.
  * Add the following line to the file:
        external_merge="<path to your tool> <options>"

The external_merge="<path to your tool> <options>" will tell the extmerge plugin how to run your tool. In the <options> portion you must specify the files for your tool to open. Here's a list of what extmerge will replace in the <options> portion with the appropriate files.

  * %b = base  (foo.BASE)
  * %t = this  (foo.THIS)
  * %o = other (foo.OTHER)
  * %r = resolved file (aka output file) (foo)
  * %T = this  (foo.THIS), a temporary copy of foo.THIS; will be used to
  *                        overwrite 'foo' if the merge succeeds

DiffMerge with ExtMerge Plugin

I use DiffMerge (http://www.sourcegear.com/diffmerge/) so in my bazaar.conf I have:

  external_merge="C:/Program Files/DiffMerge/DiffMerge.exe -nosplash -r %r -t1 Base -t2 This -t3 Other %b %t %o"

Putting it all Together

So when you do run into a conflict:

(unless otherwise marked) Copyright 2002-2014 YakPeople. All rights reserved.
(last modified 2009-01-15)       [Login]
(No back references.)