hgkw/keyword.py
branchstable
changeset 470 2c530e5df1d4
parent 469 8b8a196602ac
child 471 2c2f35f8501f
equal deleted inserted replaced
469:8b8a196602ac 470:2c530e5df1d4
   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         if node is not None:     # commit
   176         if node is not None:     # commit
   177             ctx = self.repo.changectx(node)
   177             ctx = self.repo[node]
   178             mf = ctx.manifest()
   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('.')
   182             ctx = self.repo['.']
   183             mf = ctx.manifest()
   183             mf = ctx.manifest()
   184             notify = self.ui.note
   184             notify = self.ui.note
   185         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)]
   186         if candidates:
   186         if candidates:
   187             self.restrict = True # do not expand when reading
   187             self.restrict = True # do not expand when reading
   386     modified, added, removed, deleted, unknown, ignored, clean = status
   386     modified, added, removed, deleted, unknown, ignored, clean = status
   387     files = modified + added + clean
   387     files = modified + added + clean
   388     if opts.get('untracked'):
   388     if opts.get('untracked'):
   389         files += unknown
   389         files += unknown
   390     files.sort()
   390     files.sort()
   391     wctx = repo.changectx(None)
   391     wctx = repo[None]
   392     islink = lambda p: 'l' in wctx.flags(p)
   392     islink = lambda p: 'l' in wctx.flags(p)
   393     kwfiles = [f for f in files if kwt.iskwfile(f, islink)]
   393     kwfiles = [f for f in files if kwt.iskwfile(f, islink)]
   394     cwd = pats and repo.getcwd() or ''
   394     cwd = pats and repo.getcwd() or ''
   395     kwfstats = not opts.get('ignore') and (('K', kwfiles),) or ()
   395     kwfstats = not opts.get('ignore') and (('K', kwfiles),) or ()
   396     if opts.get('all') or opts.get('ignore'):
   396     if opts.get('all') or opts.get('ignore'):
   513                 fp=None, changes=None, opts=None):
   513                 fp=None, changes=None, opts=None):
   514         '''Monkeypatch patch.diff to avoid expansion except when
   514         '''Monkeypatch patch.diff to avoid expansion except when
   515         comparing against working dir.'''
   515         comparing against working dir.'''
   516         if node2 is not None:
   516         if node2 is not None:
   517             kwt.matcher = util.never
   517             kwt.matcher = util.never
   518         elif node1 is not None and node1 != repo.changectx('.').node():
   518         elif node1 is not None and node1 != repo['.'].node():
   519             kwt.restrict = True
   519             kwt.restrict = True
   520         patch_diff(repo, node1, node2, match, fp, changes, opts)
   520         patch_diff(repo, node1, node2, match, fp, changes, opts)
   521 
   521 
   522     def kwweb_annotate(web, req, tmpl):
   522     def kwweb_annotate(web, req, tmpl):
   523         '''Wraps webcommands.annotate turning off keyword expansion.'''
   523         '''Wraps webcommands.annotate turning off keyword expansion.'''