2

In trying to get my real differencing engine up, I've trimmed to a very minimal setup, but still have no output and no indication of why nothing appears to happen. (Search of SO and Mercurial site (including the mercurial wiki) for extdiff gave me all the ideas I've tried, though perhaps I haven't tried all.)

I have tried a bash script and a .bat file; I have tried each of the scripts located in the "root" of the E: drive, identified as /cygdrive/e/ or as E:/ I have tried with and without quoting the path to the script. I think I've exhausted the combinations and have yet to get any indications of what (if anything) is running. When invoked directly, FdbCmp.bat behaves as expected; it is in a directory on my $PATH and in the Windows Path environment variable.

Other suggestions? It looks like it is simple enough and should "just work"

mercurial.ini includes

[extdiff]  
hgext.extdiff
cmd.fdiff0 = "e:/Program Files/DbCmp/FdbCmp.bat"
opts.fdiff0 = $root --file $local --file $other

FdbCmp.bat:

@echo off
echo FdbCmp.bat testing
echo FdbCmp.bat args: ::%1:: ::%2:: ::%3 ::%4:: ::%5:: ::%6:: ::%7:: ::%8:: ::%9::

hg showconfig | grep extdiff returns the expected results (among a few other lines)

extdiff.cmd.fdiff0="e:/Program Files/DbCmp/FdbCmp.bat"  
extdiff.opts.fdiff0=$root --file $local --file $other  
extensions.hgext.extdiff=  

hg fdiff0 returns with $? = 0 (cygwin bash or CMD.EXE) and no output displayed. I expected the FdbCmp.bat file would have printed something.

hg fdiff0 a b c (where files a, b, c do not exist) returns the following. This is expected, as the files don't exist and Hg reports that.

a: The system cannot find the file specified  
b: The system cannot find the file specified  
c: The system cannot find the file specified  

hg fdiff0 file1 file2 file3 where all files exist returns with no error and no output. This is unexpected - FdbCmp.bat should have been invoked and printed its something.

Just testing the .bat file alone gives the expected results:
$ FdbCmp.bat moo cow oink pig

FdbCmp.bat testing  
FdbCmp.bat args: ::moo:: ::cow:: ::oink ::pig:: :::: :::: :::: :::: ::::  

hg --version is 2.4.6-35ba170c0f82

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Donald Locker
  • 148
  • 2
  • 9
  • I should note that the result of "hg fdiff0 a b c" (where files a, b, c do not exist) is expected ("system cannot find..."; what is not expected is no error and no output for "hg fdiff0 file1 file2 file3" where the three files do exist. – Donald Locker Feb 07 '13 at 11:34

2 Answers2

1

I suppose, you have to re-read "Extdiff extension" wiki page

Anyway, if you want to use instead of hg diff FILE1 FILE2 something like hg fdiff FILE1 FILE2 for diffing, you have (see differences)

  • Add to global mercurial.ini (or project's .hgrc)

[extensions]

hgext.extdiff =

(maybe just extdiff =, have to test)

  • Create new [exdiff] section in file and in this section define new command for external diff and command options (diff with 3 files???), maybe like this (FdbCmp.bat added to PATH)

cmd.fdiff = FdbCmp.bat

opts.fdiff = $0 --file $1 --file $2

for my sample above resuling command

hg fdiff /PATH/TO/ B C

must produce as result under the hood

FdbCmp.bat /PATH/TO/ --file B --file C

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Lazy Badger
  • 94,711
  • 9
  • 78
  • 110
1

A re-read of the extdiff section of the documentation shows that options "will be inserted to the command between the program name and the files/directories to diff", unlike the merge-tools behaviour where options and files may be intermixed as required to build an appropriate comand line. The $local, $root, ... variables do not exist within the context of extdiff; they are merge-tools features that do not apply here.

The relevant mercurial.ini section now is

[extensions]
# enable the extdiff extension
hgext.extdiff =

[extdiff]
# define a jpeg differencing script; no options required
cmd.jpgdiff = HgJpgDiff.bat
# HgJpgDiff.bat is in a directory in my $PATH and contains:
# @rem ... various lines to test if we have been handed directories or files to compare
# @rem ...we only compare files, so this is the only active line
# JpgDiff --file %1 --file %2

[diff-patterns]
**.jpg=jpgdiff

and all works as desired now. Echoing parameters to a file helped to debug; nothing was ever displayed on the screen.

Many thanks.

Donald Locker
  • 148
  • 2
  • 9