[PATCH 1 of 2] filemerge: add $revbase and $revother substitutions in merge tool arguments

Adrian Buehlmann adrian at cadifra.com
Fri Jul 13 07:26:25 CDT 2012


On 2012-07-13 13:41, Adrian Buehlmann wrote:
> What we probably need to do, is to think about whether we really should still
> assume those arguments to be paths.
> 
> Since Windows can deal well with slashes as separator in paths, I think that
> localpath() call in filemerge.py can be removed.

What I forgot though is, that on Windows, some merge tools use slash ("/") to mark options.

For example, TortoiseHg has in hgrc.d/MergeTools.rc (excerpt):

  [merge-tools]
  ; Windows version of BeyondCompare 3
  beyondcompare3.priority=-1
  beyondcompare3.args=$local $other $base /mergeoutput=$output /ro /lefttitle=parent1 /centertitle=base /righttitle=parent2 /outputtitle=merged /automerge /reviewconflicts /solo
  beyondcompare3.premerge=False
  beyondcompare3.regkey=Software\Scooter Software\Beyond Compare 3
  beyondcompare3.regkeyalt=Software\Wow6432Node\Scooter Software\Beyond Compare 3
  beyondcompare3.regname=ExePath
  beyondcompare3.gui=True
  beyondcompare3.diffargs=/lro /lefttitle='$plabel1' /righttitle='$clabel' /solo /expandall $parent $child
  beyondcompare3.diff3args=$parent1 $parent2 $child /lefttitle='$plabel1' /centertitle='$clabel' /righttitle='$plabel2' /solo /ro
  beyondcompare3.dirdiff=True

so this is a tool which is using "/" for marking command line options.

If we start using / as separator in paths, way may run into problems there.

But the arguments for the tool call would still be wrapped into double quotes
thanks to:

        args = util.interpolate(r'\$', replace, args, lambda s: '"%s"' % s)

and running

  $ copy "C:/Users/adi/Desktop/temp/foo.txt" "C:/Users/adi/Desktop/temp/bla.txt" /V
          1 file(s) copied.

in a cmd.exe terminal on Windows works fine.

The quotes are definitely needed anyway because path arguments may contain spaces.


More information about the Mercurial-devel mailing list