Kash Farooq's software development blog

.NET Developer

Integrate Bazaar Source Control with your preferred merge application

Posted by Kash Farooq on October 12, 2009

I have shown how you can use any merge tool with Bazaar to deal with conflicts. In this blog post I’ll show how you can get a more integrated experience.

Bazaar 2.0 introduced a handy application called Bazaar Explorer. You can use it to issue most of the everyday commands you will use with Bazaar. You can also use it to quickly fix your conflicts.

First, configure Bazaar so it knows how to launch your favourite merge tool.
Open up C:\Documents and Settings\YourUserName\Application Data\bazaar\2.0\bazaar.conf.
Now add a reference, with appropriate command line options, to a merge tool. I like Tortoise Merge, so to the DEFAULT section I added the line:

[DEFAULT]
external_merge = tortoisemerge /base:%b /theirs:%o /mine:%t /merged:%r

Now open up Bazaar Explorer with the command:

bzr explorer

Click File, then Open, and then navigate to the location of your bzr checkout/branch – i.e. to the location with the .bzr folder.
My branch contains a conflict so I see the following:
Bazaar explorer with a conflict

Now, let’s fix that conflict:
BazaarExplorer_ResolveConflicts

Click the Resolve Conflicts menu option and Bazaar explorer will launch qconflict (i.e. Bazaar explorer will issue the command “bzr qconflicts”):
qconflicts-use_configured_default
Select the “Use Configured Default” check box at the bottom of the dialog and you will see the text we added earlier to the bazaar.conf file.

Now it is a simple case of highlighting the file you want to edit, and then clicking the launch button. In my case, this will fire up TortoiseMerge.

After you have fixed the conflict, right click the file to tell Bazaar (i.e. issue the “bzr resolve” command):
qconflicts-resolved

Advertisements

3 Responses to “Integrate Bazaar Source Control with your preferred merge application”

  1. Ian Clatworthy said

    Hi Kash,

    From the status page, you can click on the ‘resolve conflicts’ icon directly btw.

    Otherwise, thanks for the article!

  2. Greg said

    Keep ’em coming. You are creating a valuable source of reference and reaching out to the version-less.

  3. AndiDog said

    This does not work correctly with spaces in the branch directory, so I’ve come up with a similar solution:

    Enter this in bazaar.conf:
    external_merge = python C:\Path\To\BzrTortoiseMerge.py %b %o %t %r

    And create BzrTortoiseMerge.py somewhere with this content:
    import os, sys
    base, other, this, resolved = sys.argv[1:]
    os.system(“tortoisemerge /base:\”%s\” /theirs:\”%s\” /mine:\”%s\” /merged:\”%s\”” % (base, other, this, resolved))

    With this wrapper, you can also resolve conflicts in paths with spaces. Because qbzr splits the arguments by ” “, you must make sure that BzrTortoiseMerge.py lies in a directory without spaces (or use “dir /x” to find out the DOS 8.3 name, e.g. “C:\Progra~1” instead of “C:\Program Files” on my system).

    Thanks for this article – it helped me create the correct solution for me 🙂

Sorry, the comment form is closed at this time.

 
%d bloggers like this: