views:

1369

answers:

3

I searched a lot, found that some people claimed they did that, but I can't make it to work.

How to you use WinMerge, my favorite diff tool on Windows, with Bazaar?

I know difftools plugin (shipped with Bazaar) handles this but the controller.py file doesn't list it, and I fail to see where to specify a path. Looks like it searches in PATH variable, and reports bzr: ERROR: Cannot find 'winmerge' in (long list of paths). I tried to put a .cmd file, then a shortcut to WinMergeU.exe in Bazaar's directory, renaming accordingly (winmerge.cmd, winmerge.lnk) the register_diff_tool parameter. No more error, but nothing is launched...

So, does somebody has any success using WinMerge (or perhaps some other Windows tool) with Bazaar?

I would be interested to use it with extmerge plugin too...


EDIT After the first two answers, I tried some variants which I list here for reference. None worked:

# As suggested:
# Bad: bzr: ERROR: [Errno 22] Invalid argument: 'c:\\docume~1\\philho\\locals~1\\temp\\bzr_C:/Program Files/_Text/WinMerge/WinMergeU.exeh7angm.log'
wdiff = diff --using "C:/Program Files/_Text/WinMerge/WinMergeU.exe"
# Bad: bzr: ERROR: Cannot find 'C:Progra~1_TextWinMergeWinMergeU.exe' in <PATH>
wdiff = diff --using C:\Progra~1\_Text\WinMerge\WinMergeU.exe

# Variants:
# Bad: bzr: ERROR: [Errno 22] Invalid argument: 'c:\\docume~1\\philho\\locals~1\\temp\\bzr_C:/Progra~1/_Text/WinMerge/WinMergeU.exejuttft.log'
wdiff = diff --using C:/Progra~1/_Text/WinMerge/WinMergeU.exe
# Bad: bzr: ERROR: [Errno 22] Invalid argument: 'c:\\docume~1\\philho\\locals~1\\temp\\bzr_C:\\Program Files\\_Text\\WinMerge\\WinMergeU.exehpabjl.log'
wdiff = diff --using "C:\\Program Files\\_Text\\WinMerge\\WinMergeU.exe"
# Bad: bzr: ERROR: [Errno 22] Invalid argument: 'c:\\docume~1\\philho\\locals~1\\temp\\bzr_C:\\Progra~1\\_Text\\WinMerge\\WinMergeU.exe4gi5or.log'
wdiff = diff --using C:\\Progra~1\\_Text\\WinMerge\\WinMergeU.exe

Using:

Bazaar (bzr) 1.11
  Python interpreter: C:\Program Files\_Dev\Bazaar\python25.dll 2.5.2

Actually, the awful (and embarrassing) truth is that it appears that one of my earlier attempts worked, but I saw nothing... because I was testing against a committed file! I suppose I was expecting that by default it compared last two revisions or something.

Anyway, as I wrote in a comment, I don't want to put WinMerge directory in my already too long path, so I took at middle road, making a command file and putting it in Bazaar's directory which is already in the path. At least it works, and I can easily add parameters if needed.

[ALIASES]
wdiff = diff --using winmerge.cmd

# winmerge.cmd contains:
"C:\Program Files\_Text\WinMerge\WinMergeU.exe" %1 %2

Maybe I should put that as solution in the thread, although it lacks elegance.

For the record, while we are on the topic of external tools, I also added to bazaar.conf:

editor = C:/Program Files/_Text/SciTE/SciTE.exe

It is used by commit (without -m option), for example.

Next step: extmerge. Looking closer, it doesn't seem WinMerge is usable there, not having 3-way merge. I might use Perforce's merge, it is free and I am used to it.
Just a note for those as confused as me: extmerge isn't a GUI replacement for merge. If you run it, it will report no conflict, even if merge reports them. Actually, you have to run merge first, then extmerge to use the generated/altered files and do the job...
If you want to use WinMerge anyway, perhaps to compare OTHER to THIS, you can use:

external_merge = "C:/Program Files/_Text/WinMerge/WinMergeU.exe %o %t %r"

I hope my attempts/remarks here will be useful to some other people... :-)

[UPDATE]
Oookaaay!
So I was confused! A message in the Bazaar mailing list enlightened my poor soul: "You know that bzr also provides diff --using, right? You prefer the version in difftools?" -- Aaron Bentley, 2009-04-03 in Re: difftools, ‘bzr diff --using footool’, and ‘diffuse’

Aargh! No, I didn't know that.
I removed difftools plugin, edited my line to:

wdiff = diff --using "C:/Program Files/_Text/WinMerge/WinMergeU.exe"

and it worked perfectly fine, out of the box! I am not sure why this difftools plugin isn't marked as obsolete.

I leave this question as a reference in case other newbies like me are confused too. And I can at least elect an answer. Thanks!

+3  A: 
bzr diff --using "C:/Program Files/WinMerge/WinMergeU.exe"

You can add this to aliases in bazaar.conf

Or, if you have C:\Program Files\WinMerge in your PATH environment variable you can use it as:

bzr diff --using WinMergeU.exe
bialix
Thanks. It doesn't work (see update) and I don't want to add to an already long path. :-) Still upvoted for help.
PhiLho
So the problem is you don't want to add winmerge to PATH? Then setup alias.
bialix
If you mean like in the method http://www.pctools.com/guides/registry/detail/111/ Windows already created it, and apparently this works only with the Run command, not on the command line. If you mean something else, can you elaborate, please? :-)
PhiLho
No, I mean alias in the bazaar.conf, as described in the answer of Evan.bzr has support for App Paths, but apparently it's not used by difftool plugin.
bialix
+2  A: 

Did you read the README file that came with the difftools plugin? It explained the --using option.

Also, going by bazaar installed on my windows machine, which hasn't been updated in a while, you'll find your config file in C:\Documents and Settings\*username*\Application Data\bazaar\2.0\bazaar.conf

Add the following under the [ALIASES] section (adding that section if it doesn't exist):

[ALIASES]
gdiff = diff --using C:\Progra~1\WinMerge\WinMergeU.exe

Change the path to suit your installation. Then you can just go

bazaar gdiff

instead of

bazaar diff
Evan
Of course I have read it and tried aliases before. But thanks to your suggestion (which doesn't work for me, alas), I tried some variants (see update). Upvoted for help.
PhiLho
If you setup alias as suggested you don't need to change your PATH environment variable.
bialix
+2  A: 

This seemed to work for me:

bzr diff --using "C:\\program files\\winmerge\\winmergeu.exe"

As an aside, if you can't get it working, I would suggest using the q* UI tools, like:

bzr qdiff
bzr qlog
bzr qcommit

..etc

FryGuy
Thanks, I haven't tried lower case variant... Alas, it still doesn't work for me. It finds the program (otherwise the error is different) but it issues this weird error.And I am aware of the Qt tools, they are good, but a bit too lightweight for my taste. :-)
PhiLho
well windows is case insensitive, so that part shouldn't matter.
FryGuy