hgext/extdiff.py
changeset 36300 08f061a48a8f
parent 36299 1fa33bd848ee
child 36301 be5a6fe3643a
equal deleted inserted replaced
36299:1fa33bd848ee 36300:08f061a48a8f
    86 command = registrar.command(cmdtable)
    86 command = registrar.command(cmdtable)
    87 
    87 
    88 configtable = {}
    88 configtable = {}
    89 configitem = registrar.configitem(configtable)
    89 configitem = registrar.configitem(configtable)
    90 
    90 
    91 configitem('extdiff', r'opts\..*',
    91 configitem('extdiff', br'opts\..*',
    92     default='',
    92     default='',
    93     generic=True,
    93     generic=True,
    94 )
    94 )
    95 
    95 
    96 configitem('diff-tools', r'.*\.diffargs$',
    96 configitem('diff-tools', br'.*\.diffargs$',
    97     default=None,
    97     default=None,
    98     generic=True,
    98     generic=True,
    99 )
    99 )
   100 
   100 
   101 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
   101 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
   277             if not do3way and key == 'parent2':
   277             if not do3way and key == 'parent2':
   278                 return pre
   278                 return pre
   279             return pre + util.shellquote(replace[key])
   279             return pre + util.shellquote(replace[key])
   280 
   280 
   281         # Match parent2 first, so 'parent1?' will match both parent1 and parent
   281         # Match parent2 first, so 'parent1?' will match both parent1 and parent
   282         regex = (r'''(['"]?)([^\s'"$]*)'''
   282         regex = (br'''(['"]?)([^\s'"$]*)'''
   283                  r'\$(parent2|parent1?|child|plabel1|plabel2|clabel|root)\1')
   283                  br'\$(parent2|parent1?|child|plabel1|plabel2|clabel|root)\1')
   284         if not do3way and not re.search(regex, cmdline):
   284         if not do3way and not re.search(regex, cmdline):
   285             cmdline += ' $parent1 $child'
   285             cmdline += ' $parent1 $child'
   286         cmdline = re.sub(regex, quote, cmdline)
   286         cmdline = re.sub(regex, quote, cmdline)
   287 
   287 
   288         ui.debug('running %r in %s\n' % (cmdline, tmproot))
   288         ui.debug('running %r in %s\n' % (cmdline, tmproot))