hgkw/keyword.py
changeset 341 5ef2b11df3d3
parent 340 9e9f6cbcf20b
child 344 1346cc5a6461
equal deleted inserted replaced
340:9e9f6cbcf20b 341:5ef2b11df3d3
    94 
    94 
    95 def _kwrestrict(cmd):
    95 def _kwrestrict(cmd):
    96     '''Returns True if cmd should trigger restricted expansion.
    96     '''Returns True if cmd should trigger restricted expansion.
    97     Keywords will only expanded when writing to working dir.
    97     Keywords will only expanded when writing to working dir.
    98     Crucial for mq as expanded keywords should not make it into patches.'''
    98     Crucial for mq as expanded keywords should not make it into patches.'''
    99     return cmd in ('qimport', 'qnew', 'qpush', 'qrefresh', 'record', 'qrecord')
    99     return cmd in ('diff1', 
       
   100                    'qimport', 'qnew', 'qpush', 'qrefresh', 'record', 'qrecord')
   100 
   101 
   101 
   102 
   102 _kwtemplater = None
   103 _kwtemplater = None
   103 
   104 
   104 class kwtemplater(object):
   105 class kwtemplater(object):
   419                     'convert')
   420                     'convert')
   420     hgcmd, func, args, opts, cmdopts = dispatch._parse(ui, sys.argv[1:])
   421     hgcmd, func, args, opts, cmdopts = dispatch._parse(ui, sys.argv[1:])
   421     if hgcmd in nokwcommands:
   422     if hgcmd in nokwcommands:
   422         return
   423         return
   423 
   424 
       
   425     if hgcmd == 'diff':
       
   426         # only expand if comparing against working dir
       
   427         node1, node2 = cmdutil.revpair(repo, cmdopts.get('rev'))
       
   428         if node2 is not None:
       
   429             return
       
   430         # shrink if rev is not current node
       
   431         if node1 is not None and node1 != repo.changectx().node():
       
   432             hgcmd = 'diff1'
       
   433 
   424     inc, exc = [], ['.hgtags']
   434     inc, exc = [], ['.hgtags']
   425     for pat, opt in ui.configitems('keyword'):
   435     for pat, opt in ui.configitems('keyword'):
   426         if opt != 'ignore':
   436         if opt != 'ignore':
   427             inc.append(pat)
   437             inc.append(pat)
   428         else:
   438         else: