hgkw/keyword.py
changeset 808 cd9ec33f5bca
parent 807 f14ab0ca530d
child 809 028b6584decb
equal deleted inserted replaced
807:f14ab0ca530d 808:cd9ec33f5bca
   515         # shrink keywords read from working dir
   515         # shrink keywords read from working dir
   516         self.lines = kwt.shrinklines(self.fname, self.lines)
   516         self.lines = kwt.shrinklines(self.fname, self.lines)
   517 
   517 
   518     def kw_diff(orig, repo, node1=None, node2=None, match=None, changes=None,
   518     def kw_diff(orig, repo, node1=None, node2=None, match=None, changes=None,
   519                 opts=None, prefix=''):
   519                 opts=None, prefix=''):
   520         '''Monkeypatch patch.diff to avoid expansion except when
   520         '''Monkeypatch patch.diff to avoid expansion.'''
   521         comparing against working dir.'''
   521         kwt.restrict = True
   522         if node2 is not None:
       
   523             kwt.match = util.never
       
   524         elif node1 is not None and node1 != repo['.'].node():
       
   525             kwt.restrict = True
       
   526         return orig(repo, node1, node2, match, changes, opts, prefix)
   522         return orig(repo, node1, node2, match, changes, opts, prefix)
   527 
   523 
   528     def kwweb_skip(orig, web, req, tmpl):
   524     def kwweb_skip(orig, web, req, tmpl):
   529         '''Wraps webcommands.x turning off keyword expansion.'''
   525         '''Wraps webcommands.x turning off keyword expansion.'''
   530         kwt.match = util.never
   526         kwt.match = util.never
   546             wlock.release()
   542             wlock.release()
   547 
   543 
   548     repo.__class__ = kwrepo
   544     repo.__class__ = kwrepo
   549 
   545 
   550     extensions.wrapfunction(patch.patchfile, '__init__', kwpatchfile_init)
   546     extensions.wrapfunction(patch.patchfile, '__init__', kwpatchfile_init)
   551     if not kwt.restrict:
   547     extensions.wrapfunction(patch, 'diff', kw_diff)
   552         extensions.wrapfunction(patch, 'diff', kw_diff)
       
   553     for c in 'annotate changeset rev filediff diff'.split():
   548     for c in 'annotate changeset rev filediff diff'.split():
   554         extensions.wrapfunction(webcommands, c, kwweb_skip)
   549         extensions.wrapfunction(webcommands, c, kwweb_skip)
   555     for name in recordextensions.split():
   550     for name in recordextensions.split():
   556         try:
   551         try:
   557             record = extensions.find(name)
   552             record = extensions.find(name)