hgext/keyword.py
branchstable
changeset 12844 a1b49b9a0328
parent 12732 4bca87c29445
child 12920 1fab4970354e
child 13025 99210fb3bc0a
equal deleted inserted replaced
12843:8aeb6184b008 12844:a1b49b9a0328
   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):