简体   繁体   中英

Using mercurial and beyond compare 3(bc3) as the diff tool?

in windows I am able to use winmerge as the external diff tool for hg using mercurial.ini ,etc.
Using some options switch that you can find in web(I think it's a japanese website) Anyway, here for example:

hg winmerge -r1 -r2

will list file(s) change(s) between rev1 and rev2 in winmerge. I can just click which file to diff

but for bc3:

hg bcomp -r1 -r2

will make bc3 open a dialog which stated that a temp dir can't be found.

The most I can do using bc3 and hg is

hg bcomp -r1 -r2 myfile.cpp

which will open diff between rev1 and rev2 of myfile.cpp

So,it seems that hg+bc3 can't successfully acknowledge of all files change between revision. Only able to diff 1 file at a time.
Anyone can use bc3 + hg better ?

edit: Problem Solved !

Got the solution from http://www.scootersoftware.com/support.php?zz=kb_vcs.php>scooter support page. I have to use bcompare instead of bcomp Here's a snippet of my mercurial.ini

[extensions]
hgext.win32text =

;mhd adds
hgext.extdiff = 

;mhd adds for bc
[extdiff]
cmd.bc3 = bcompare
opts.bc3 = /ro

;mhd adds for winmerge
;[extdiff]
;cmd.winmerge = WinMergeU
;opts.winmerge = /r /e /x /ub

Beyond-Compare-3 is an amazing tool. I recommend a few tweaks to the setup:

[extensions]
extdiff =

[extdiff]
cmd.bcomp = C:\Program Files\Beyond Compare 3\BCompare.exe
opts.bcomp = /leftreadonly

[merge-tools]
bcomp.executable = C:\Program Files\Beyond Compare 3\BComp
bcomp.args = /leftreadonly /centerreadonly $local $other $base $output
bcomp.priority = 1

[ui]
merge = bcomp

[tortoisehg]
authorcolor = True
vdiff = bcomp

Personally I found that the best Beyond Compare config can be found in the Mercurial mergetools.rc file file:

[merge-tools]
....
; Windows version of Beyond Compare
beyondcompare3.args=$local $other $base $output /ro /lefttitle=local /centertitle=base /righttitle=other /automerge /reviewconflicts /solo
beyondcompare3.regkey=Software\Scooter Software\Beyond Compare 3
beyondcompare3.regname=ExePath
beyondcompare3.gui=True
beyondcompare3.priority=-2
beyondcompare3.diffargs=/lro /lefttitle='$plabel1' /righttitle='$clabel' /solo /expandall $parent $child

I also found that it is important to NOT include Beyond Compare in extdiff section so it will use beyondcompare3 from the merge-tools section with diffargs arguments. (I have beyondcompare3 specified in both ui.merge and tortoisehg.vdiff )

If you keep getting this "Folder Not Available" error from BC (I did, when I had several instances of BC open simultaneously), try adding option /solo to the command line, ie:

[extdiff]
cmd.bcomp = C:\Program Files\Beyond Compare 3\BCompare.exe
opts.bcomp = /leftreadonly /solo

Source: Scooter Software support forum

Checkout this page from the Scooter Software support page - it also includes settings for most version control systems - one for my bookmarks list!

Snippet:

To configure Mercurial you need to edit the file %USERPROFILE%\\Mercurial.ini or $HOME/.hgrc. Add the following lines, using existing INI sections if they already exist:

Diff

[extensions] extdiff =

[extdiff] 
cmd.bcomp = C:\Program Files\Beyond Compare 3\BCompare.exe
opts.bcomp = /ro

[tortoisehg] vdiff = bcomp 

Once set up you can compare revisions from the command line using

hg bcomp -r <rev1> [-r <rev2>] [<filename>]

3-Way Merge (v3 Pro)

[merge-tools] 
bcomp.executable = C:\Program Files\Beyond Compare 3\BComp 
bcomp.args = $local $other
$base $output bcomp.priority = 1
bcomp.premerge = True bcomp.gui = True

[ui] merge = bcomp

I had to add the following to make it work on my machine:

[extensions]
extdiff =

[extdiff]
cmd.bc3 = C:\Program Files\Beyond Compare 3\BCompare.exe
opts.bc3 = /ro

I tried the suggestions given at the time but none worked.

I found the following works:

  1. Add beyond compare install directory to the yor system path
  2. Open the global settings and set the diff tools to bcompare

Now try a diff - Beyond Compare!

All the answers given so far are for Windows. Here is my configuration for those using Linux.

Diff

[extensions]
extdiff =

[extdiff]
cmd.bcomp = bcompare
opts.bcomp = -ro1

4-Way Merge (v3 Pro)

[merge-tools]
bcomp.executable = bcompare
bcomp.args = -title1='First Parent' -title2='Second Parent' -title3='Common Ancestor' -title4='Output' -ro1 -ro2 -ro3 $local $other $base $output
bcomp.premerge = True
bcomp.gui = True

-ro# : Disables editing on specified side

-title#=<title> : Shows description instead of filename in path edit

# character: 1=Left, 2=Right, 3=Center, 4=Output

For more options of bcompare , simply execute bcompare -help in console.

If you are using TortoiseHg, you can set the merge tool to Beyond Compare by choosing File -> Settings, and then on the TortoiseHg choice, select Visual Diff Tool and Three-way Merge Tool. This setting affects merges which are set through the command line as well.

If you are having trouble getting your configuration to parse correctly please note that any space for any variable or section name will cause the configuration to parse incorrectly. I kept copying and pasting different configures and continued to get errors. It just ended up that spaces were added before many of the variables and it caused it not to parse.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM