Skip to content
Snippets Groups Projects
Commit 1c38777f authored by Steven Stallion's avatar Steven Stallion
Browse files

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).
parent 0528b69f
No related branches found
No related tags found
No related merge requests found
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
$parent1, $plabel1 - filename, descriptive label of first parent $parent1, $plabel1 - filename, descriptive label of first parent
$child, $clabel - filename, descriptive label of child revision $child, $clabel - filename, descriptive label of child revision
$parent2, $plabel2 - filename, descriptive label of second parent $parent2, $plabel2 - filename, descriptive label of second parent
$root - repository root
$parent is an alias for $parent1. $parent is an alias for $parent1.
The extdiff extension will look in your [diff-tools] and [merge-tools] The extdiff extension will look in your [diff-tools] and [merge-tools]
...@@ -205,7 +206,8 @@ ...@@ -205,7 +206,8 @@
# returned for parent2 # returned for parent2
replace = dict(parent=dir1a, parent1=dir1a, parent2=dir1b, replace = dict(parent=dir1a, parent1=dir1a, parent2=dir1b,
plabel1=label1a, plabel2=label1b, plabel1=label1a, plabel2=label1b,
clabel=label2, child=dir2) clabel=label2, child=dir2,
root=repo.root)
def quote(match): def quote(match):
key = match.group()[1:] key = match.group()[1:]
if not do3way and key == 'parent2': if not do3way and key == 'parent2':
...@@ -213,7 +215,7 @@ ...@@ -213,7 +215,7 @@
return util.shellquote(replace[key]) return util.shellquote(replace[key])
# Match parent2 first, so 'parent1?' will match both parent1 and parent # 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): if not do3way and not re.search(regex, args):
args += ' $parent1 $child' args += ' $parent1 $child'
args = re.sub(regex, quote, args) args = re.sub(regex, quote, args)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment