hgkw/keyword.py
changeset 807 f14ab0ca530d
parent 804 b7fbc49d5c75
child 808 cd9ec33f5bca
equal deleted inserted replaced
806:a0dc79015ddf 807:f14ab0ca530d
   196         '''Overwrites selected files expanding/shrinking keywords.'''
   196         '''Overwrites selected files expanding/shrinking keywords.'''
   197         if self.record:
   197         if self.record:
   198             candidates = [f for f in ctx.files() if f in ctx]
   198             candidates = [f for f in ctx.files() if f in ctx]
   199         candidates = [f for f in candidates if self.iskwfile(f, ctx.flags)]
   199         candidates = [f for f in candidates if self.iskwfile(f, ctx.flags)]
   200         if candidates:
   200         if candidates:
       
   201             restrict = self.restrict
   201             self.restrict = True        # do not expand when reading
   202             self.restrict = True        # do not expand when reading
   202             mf = ctx.manifest()
   203             mf = ctx.manifest()
   203             msg = (expand and _('overwriting %s expanding keywords\n')
   204             msg = (expand and _('overwriting %s expanding keywords\n')
   204                    or _('overwriting %s shrinking keywords\n'))
   205                    or _('overwriting %s shrinking keywords\n'))
   205             for f in candidates:
   206             for f in candidates:
   221                     self.repo.wwrite(f, data, mf.flags(f))
   222                     self.repo.wwrite(f, data, mf.flags(f))
   222                     if iswctx:
   223                     if iswctx:
   223                         self.repo.dirstate.normal(f)
   224                         self.repo.dirstate.normal(f)
   224                     elif self.record:
   225                     elif self.record:
   225                         self.repo.dirstate.normallookup(f)
   226                         self.repo.dirstate.normallookup(f)
   226             self.restrict = False
   227             self.restrict = restrict
   227 
   228 
   228     def shrinktext(self, text):
   229     def shrinktext(self, text):
   229         '''Unconditionally removes all keyword substitutions from text.'''
   230         '''Unconditionally removes all keyword substitutions from text.'''
   230         return self.re_kw.sub(r'$\1$', text)
   231         return self.re_kw.sub(r'$\1$', text)
   231 
   232