hgkw/keyword.py
branchstable
changeset 467 1dfcc2e2cdb3
parent 466 ddb8a222249b
child 468 235800d4708a
equal deleted inserted replaced
466:ddb8a222249b 467:1dfcc2e2cdb3
   171         Caveat: localrepository._link fails on Windows.'''
   171         Caveat: localrepository._link fails on Windows.'''
   172         return self.matcher(path) and not islink(path)
   172         return self.matcher(path) and not islink(path)
   173 
   173 
   174     def overwrite(self, node, expand, files):
   174     def overwrite(self, node, expand, files):
   175         '''Overwrites selected files expanding/shrinking keywords.'''
   175         '''Overwrites selected files expanding/shrinking keywords.'''
   176         ctx = self.repo.changectx(node)
       
   177         mf = ctx.manifest()
       
   178         if node is not None:     # commit
   176         if node is not None:     # commit
       
   177             ctx = self.repo.changectx(node)
       
   178             mf = ctx.manifest()
   179             files = [f for f in ctx.files() if f in mf]
   179             files = [f for f in ctx.files() if f in mf]
   180             notify = self.ui.debug
   180             notify = self.ui.debug
   181         else:                    # kwexpand/kwshrink
   181         else:                    # kwexpand/kwshrink
       
   182             ctx = self.repo.changectx('.')
       
   183             mf = ctx.manifest()
   182             notify = self.ui.note
   184             notify = self.ui.note
   183         candidates = [f for f in files if self.iskwfile(f, mf.linkf)]
   185         candidates = [f for f in files if self.iskwfile(f, mf.linkf)]
   184         if candidates:
   186         if candidates:
   185             self.restrict = True # do not expand when reading
   187             self.restrict = True # do not expand when reading
   186             candidates.sort()
   188             candidates.sort()
   511                 fp=None, changes=None, opts=None):
   513                 fp=None, changes=None, opts=None):
   512         '''Monkeypatch patch.diff to avoid expansion except when
   514         '''Monkeypatch patch.diff to avoid expansion except when
   513         comparing against working dir.'''
   515         comparing against working dir.'''
   514         if node2 is not None:
   516         if node2 is not None:
   515             kwt.matcher = util.never
   517             kwt.matcher = util.never
   516         elif node1 is not None and node1 != repo.changectx().node():
   518         elif node1 is not None and node1 != repo.changectx('.').node():
   517             kwt.restrict = True
   519             kwt.restrict = True
   518         patch_diff(repo, node1, node2, match, fp, changes, opts)
   520         patch_diff(repo, node1, node2, match, fp, changes, opts)
   519 
   521 
   520     def kwweb_annotate(web, req, tmpl):
   522     def kwweb_annotate(web, req, tmpl):
   521         '''Wraps webcommands.annotate turning off keyword expansion.'''
   523         '''Wraps webcommands.annotate turning off keyword expansion.'''