# HG changeset patch # User Steven Stallion # Date 2011-04-28 01:55:46 # Node ID 1c38777f7b8ada15d205d32e0d98ac3fdaa90df9 # Parent 0528b69f8db4995179fa35b7fb2a457723922b2a extdiff: add repository root as a variable Some external diff tools (notably Plan 9 diff(1)) require the absolute path to the file being diffed for proper function. A root variable was added to inform an external tool of the repository root (the tool is invoked with the cwd set to tmproot). diff --git a/hgext/extdiff.py b/hgext/extdiff.py --- a/hgext/extdiff.py +++ b/hgext/extdiff.py @@ -40,6 +40,7 @@ Tool arguments can include variables tha $parent1, $plabel1 - filename, descriptive label of first parent $child, $clabel - filename, descriptive label of child revision $parent2, $plabel2 - filename, descriptive label of second parent + $root - repository root $parent is an alias for $parent1. The extdiff extension will look in your [diff-tools] and [merge-tools] @@ -205,7 +206,8 @@ def dodiff(ui, repo, diffcmd, diffopts, # returned for parent2 replace = dict(parent=dir1a, parent1=dir1a, parent2=dir1b, plabel1=label1a, plabel2=label1b, - clabel=label2, child=dir2) + clabel=label2, child=dir2, + root=repo.root) def quote(match): key = match.group()[1:] if not do3way and key == 'parent2': @@ -213,7 +215,7 @@ def dodiff(ui, repo, diffcmd, diffopts, return util.shellquote(replace[key]) # Match parent2 first, so 'parent1?' will match both parent1 and parent - regex = '\$(parent2|parent1?|child|plabel1|plabel2|clabel)' + regex = '\$(parent2|parent1?|child|plabel1|plabel2|clabel|root)' if not do3way and not re.search(regex, args): args += ' $parent1 $child' args = re.sub(regex, quote, args)