hgkw/keyword.py
changeset 234 6f1ed470541c
parent 233 e60fdc1990e3
child 235 baef9dcfb219
equal deleted inserted replaced
233:e60fdc1990e3 234:6f1ed470541c
   187         except TypeError:
   187         except TypeError:
   188             # depending on hg rev changeset_templater has extra "brinfo" arg
   188             # depending on hg rev changeset_templater has extra "brinfo" arg
   189             return cmdutil.changeset_templater(self.ui, self.repo,
   189             return cmdutil.changeset_templater(self.ui, self.repo,
   190                                                False, None, '', False)
   190                                                False, None, '', False)
   191 
   191 
       
   192     def _wwrite(self, f, data, man):
       
   193         '''Makes repo.wwrite backwards compatible.'''
       
   194         try:
       
   195             self.repo.wwrite(f, data, man.flags(f))
       
   196         except AttributeError:
       
   197             # older versions want file descriptor as 3. optional arg
       
   198             self.repo.wwrite(f, data)
       
   199 
   192     def _ctxnode(self, node):
   200     def _ctxnode(self, node):
   193         '''Obtains missing node from file context.'''
   201         '''Obtains missing node from file context.'''
   194         if not self.node:
   202         if not self.node:
   195             c = context.filectx(self.repo, self.path, fileid=node)
   203             c = context.filectx(self.repo, self.path, fileid=node)
   196             self.node = c.node()
   204             self.node = c.node()
   239         for f in candidates:
   247         for f in candidates:
   240             fp = self.repo.file(f, kwexp=expand, kwcnt=True)
   248             fp = self.repo.file(f, kwexp=expand, kwcnt=True)
   241             data, kwfound = fp.read(man[f])
   249             data, kwfound = fp.read(man[f])
   242             if kwfound:
   250             if kwfound:
   243                 notify(_('overwriting %s %s keywords\n') % (f, action))
   251                 notify(_('overwriting %s %s keywords\n') % (f, action))
   244                 try:
   252                 self._wwrite(f, data, man)
   245                     self.repo.wwrite(f, data, man.flags(f))
       
   246                 except AttributeError:
       
   247                     # older versions want file descriptor as 3. optional arg
       
   248                     self.repo.wwrite(f, data)
       
   249                 overwritten.append(f)
   253                 overwritten.append(f)
   250         if overwritten:
   254         if overwritten:
   251             try:
   255             try:
   252                 for f in overwritten:
   256                 for f in overwritten:
   253                     self.repo.dirstate.normal(f)
   257                     self.repo.dirstate.normal(f)