title Using your own tool to help handle Bazaar (bzr) Conflicts user mrwerewolf ip 66.236.241.98 vol 1 lock ******** /box( 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/ /box) /section 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: /pre( This initially lists the conflicts. When you are done the final resolution goes in this document. .BASE This contains the state the file was in when you started working on it. .THIS This should contain your changes to the file. .OTHER This contains the changes done to the file while you were working on it. /pre) 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. /section ExtMerge Plugin /subsection Installation Here is how you install the plugin: (original instructions: http://erik.bagfors.nu/bzr-plugins/extmerge/) /list( * Open up a command line window * Go to your bazaar plugins directory (if you use the windows stand-alone install it's at C:\Program Files\Bazaar\plugins) * Do a "bzr branch lp:bzr-extmerge extmerge" /list) /subsection Configuration 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. /pre( * Go yo your %APPDATA%\Bazaar\2.0 directory On Win Vista it is c:\users\\AppData\Bazaar\2.0 On Win XP it's C:\Documents and Settings\\Application Data\bazaar\2.0 * Open bazaar.conf. If it's not there, create it. * Add the following line to the file: external_merge=" " /pre) The external_merge=" " will tell the extmerge plugin how to run your tool. In the portion you must specify the files for your tool to open. Here's a list of what extmerge will replace in the portion with the appropriate files. /pre( * %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 /pre) /subsection DiffMerge with ExtMerge Plugin I use DiffMerge (http://www.sourcegear.com/diffmerge/) so in my bazaar.conf I have: /pre( external_merge="C:/Program Files/DiffMerge/DiffMerge.exe -nosplash -r %r -t1 Base -t2 This -t3 Other %b %t %o" /pre) /section Putting it all Together So when you do run into a conflict: /list( * Bazaar will notify you and create the three files with BASE, THIS, and OTHER at the tail of their file names. * To use your own tool, run "bzr emerge " or "bzr emerge --all" if you want to run your tool on all conflicts. * Then, use your tool to merge your changes by hand. Your work should be saved to not the other three files. * When you are that the conflict has been resolved, run "bzr resolve " or "bzr resolve --all". This will remove the extra three files that with BASE, THIS, and OTHER at the tail of their file names for that file. * Finally, "bzr commit" your change.