hgkw/keyword.py
branchstable
changeset 847 1a00e2718cde
parent 846 d565787a8a5d
child 848 3e57838f5434
equal deleted inserted replaced
844:e5e1c16fe5b7 847:1a00e2718cde
   203         expansion are not symbolic links.'''
   203         expansion are not symbolic links.'''
   204         return [f for f in cand if self.match(f) and not 'l' in ctx.flags(f)]
   204         return [f for f in cand if self.match(f) and not 'l' in ctx.flags(f)]
   205 
   205 
   206     def overwrite(self, ctx, candidates, lookup, expand, rekw=False):
   206     def overwrite(self, ctx, candidates, lookup, expand, rekw=False):
   207         '''Overwrites selected files expanding/shrinking keywords.'''
   207         '''Overwrites selected files expanding/shrinking keywords.'''
   208         if self.restrict or lookup: # exclude kw_copy
   208         if self.restrict or lookup or self.record: # exclude kw_copy
   209             candidates = self.iskwfile(candidates, ctx)
   209             candidates = self.iskwfile(candidates, ctx)
   210         if not candidates:
   210         if not candidates:
   211             return
   211             return
   212         commit = self.restrict and not lookup
   212         kwcmd = self.restrict and lookup # kwexpand/kwshrink
   213         if self.restrict or expand and lookup:
   213         if self.restrict or expand and lookup:
   214             mf = ctx.manifest()
   214             mf = ctx.manifest()
   215         fctx = ctx
   215         fctx = ctx
   216         subn = (self.restrict or rekw) and self.re_kw.subn or self.re_kwexp.subn
   216         subn = (self.restrict or rekw) and self.re_kw.subn or self.re_kwexp.subn
   217         msg = (expand and _('overwriting %s expanding keywords\n')
   217         msg = (expand and _('overwriting %s expanding keywords\n')
   232             else:
   232             else:
   233                 data, found = _shrinktext(data, subn)
   233                 data, found = _shrinktext(data, subn)
   234             if found:
   234             if found:
   235                 self.ui.note(msg % f)
   235                 self.ui.note(msg % f)
   236                 self.repo.wwrite(f, data, ctx.flags(f))
   236                 self.repo.wwrite(f, data, ctx.flags(f))
   237                 if commit:
   237                 if kwcmd:
   238                     self.repo.dirstate.normal(f)
   238                     self.repo.dirstate.normal(f)
   239                 elif self.record:
   239                 elif self.record:
   240                     self.repo.dirstate.normallookup(f)
   240                     self.repo.dirstate.normallookup(f)
   241 
   241 
   242     def shrink(self, fname, text):
   242     def shrink(self, fname, text):