hgext/extdiff.py
changeset 14045 1c38777f7b8a
parent 14024 92b768e9f80c
child 14168 135e244776f0
equal deleted inserted replaced
14044:0528b69f8db4 14045:1c38777f7b8a
    38 Tool arguments can include variables that are expanded at runtime::
    38 Tool arguments can include variables that are expanded at runtime::
    39 
    39 
    40   $parent1, $plabel1 - filename, descriptive label of first parent
    40   $parent1, $plabel1 - filename, descriptive label of first parent
    41   $child,   $clabel  - filename, descriptive label of child revision
    41   $child,   $clabel  - filename, descriptive label of child revision
    42   $parent2, $plabel2 - filename, descriptive label of second parent
    42   $parent2, $plabel2 - filename, descriptive label of second parent
       
    43   $root              - repository root
    43   $parent is an alias for $parent1.
    44   $parent is an alias for $parent1.
    44 
    45 
    45 The extdiff extension will look in your [diff-tools] and [merge-tools]
    46 The extdiff extension will look in your [diff-tools] and [merge-tools]
    46 sections for diff tool arguments, when none are specified in [extdiff].
    47 sections for diff tool arguments, when none are specified in [extdiff].
    47 
    48 
   203         # Function to quote file/dir names in the argument string.
   204         # Function to quote file/dir names in the argument string.
   204         # When not operating in 3-way mode, an empty string is
   205         # When not operating in 3-way mode, an empty string is
   205         # returned for parent2
   206         # returned for parent2
   206         replace = dict(parent=dir1a, parent1=dir1a, parent2=dir1b,
   207         replace = dict(parent=dir1a, parent1=dir1a, parent2=dir1b,
   207                        plabel1=label1a, plabel2=label1b,
   208                        plabel1=label1a, plabel2=label1b,
   208                        clabel=label2, child=dir2)
   209                        clabel=label2, child=dir2,
       
   210                        root=repo.root)
   209         def quote(match):
   211         def quote(match):
   210             key = match.group()[1:]
   212             key = match.group()[1:]
   211             if not do3way and key == 'parent2':
   213             if not do3way and key == 'parent2':
   212                 return ''
   214                 return ''
   213             return util.shellquote(replace[key])
   215             return util.shellquote(replace[key])
   214 
   216 
   215         # Match parent2 first, so 'parent1?' will match both parent1 and parent
   217         # Match parent2 first, so 'parent1?' will match both parent1 and parent
   216         regex = '\$(parent2|parent1?|child|plabel1|plabel2|clabel)'
   218         regex = '\$(parent2|parent1?|child|plabel1|plabel2|clabel|root)'
   217         if not do3way and not re.search(regex, args):
   219         if not do3way and not re.search(regex, args):
   218             args += ' $parent1 $child'
   220             args += ' $parent1 $child'
   219         args = re.sub(regex, quote, args)
   221         args = re.sub(regex, quote, args)
   220         cmdline = util.shellquote(diffcmd) + ' ' + args
   222         cmdline = util.shellquote(diffcmd) + ' ' + args
   221 
   223