hgkw/keyword.py
changeset 415 d1026365eff6
parent 413 1b6610abf538
child 416 b69dca43ef08
equal deleted inserted replaced
413:1b6610abf538 415:d1026365eff6
   119     kwt = kwx['templater']
   119     kwt = kwx['templater']
   120     self.lines = kwt.shrinklines(self.fname, self.lines)
   120     self.lines = kwt.shrinklines(self.fname, self.lines)
   121 
   121 
   122 def _kw_diff(repo, node1=None, node2=None, files=None, match=util.always,
   122 def _kw_diff(repo, node1=None, node2=None, files=None, match=util.always,
   123              fp=None, changes=None, opts=None):
   123              fp=None, changes=None, opts=None):
   124     # only expand if comparing against working dir
   124     '''Monkeypatch patch.diff to avoid expansion except when
       
   125     comparing against working dir.'''
   125     if node2 is not None:
   126     if node2 is not None:
   126         kwx['templater'].matcher = util.never
   127         kwx['templater'].matcher = util.never
   127     elif node1 is not None and node1 != repo.changectx().node():
   128     elif node1 is not None and node1 != repo.changectx().node():
   128         kwx['templater'].restrict = True
   129         kwx['templater'].restrict = True
   129     _patch_diff(repo, node1=node1, node2=node2, files=files, match=match,
   130     _patch_diff(repo, node1=node1, node2=node2, files=files, match=match,
   182         templatefilters.filters['utcdate'] = utcdate
   183         templatefilters.filters['utcdate'] = utcdate
   183         self.ct = cmdutil.changeset_templater(self.ui, self.repo,
   184         self.ct = cmdutil.changeset_templater(self.ui, self.repo,
   184                                               False, '', False)
   185                                               False, '', False)
   185 
   186 
   186     def getnode(self, path, fnode):
   187     def getnode(self, path, fnode):
   187         '''Derives changenode from file context.'''
   188         '''Derives changenode from file path and filenode.'''
       
   189         # used by kwfilelog.read and kwexpand
   188         c = context.filectx(self.repo, path, fileid=fnode)
   190         c = context.filectx(self.repo, path, fileid=fnode)
   189         return c.node()
   191         return c.node()
   190 
   192 
   191     def substitute(self, data, path, node, subfunc):
   193     def substitute(self, data, path, node, subfunc):
   192         '''Replaces keywords in data with expanded template.'''
   194         '''Replaces keywords in data with expanded template.'''