hgkw/keyword.py
changeset 235 baef9dcfb219
parent 234 6f1ed470541c
child 236 e52075167842
equal deleted inserted replaced
234:6f1ed470541c 235:baef9dcfb219
   195             self.repo.wwrite(f, data, man.flags(f))
   195             self.repo.wwrite(f, data, man.flags(f))
   196         except AttributeError:
   196         except AttributeError:
   197             # older versions want file descriptor as 3. optional arg
   197             # older versions want file descriptor as 3. optional arg
   198             self.repo.wwrite(f, data)
   198             self.repo.wwrite(f, data)
   199 
   199 
       
   200     def _normal(self, files):
       
   201         '''Backwards compatible repo.dirstate.normal/update.'''
       
   202         try:
       
   203             for f in files:
       
   204                 self.repo.dirstate.normal(f)
       
   205         except AttributeError:
       
   206             # older versions don't know about dirstate.normal
       
   207             self.repo.dirstate.update(files, 'n')
       
   208 
   200     def _ctxnode(self, node):
   209     def _ctxnode(self, node):
   201         '''Obtains missing node from file context.'''
   210         '''Obtains missing node from file context.'''
   202         if not self.node:
   211         if not self.node:
   203             c = context.filectx(self.repo, self.path, fileid=node)
   212             c = context.filectx(self.repo, self.path, fileid=node)
   204             self.node = c.node()
   213             self.node = c.node()
   249             data, kwfound = fp.read(man[f])
   258             data, kwfound = fp.read(man[f])
   250             if kwfound:
   259             if kwfound:
   251                 notify(_('overwriting %s %s keywords\n') % (f, action))
   260                 notify(_('overwriting %s %s keywords\n') % (f, action))
   252                 self._wwrite(f, data, man)
   261                 self._wwrite(f, data, man)
   253                 overwritten.append(f)
   262                 overwritten.append(f)
   254         if overwritten:
   263         self._normal(overwritten)
   255             try:
       
   256                 for f in overwritten:
       
   257                     self.repo.dirstate.normal(f)
       
   258             except AttributeError:
       
   259                 # older versions don't know about dirstate.normal
       
   260                 self.repo.dirstate.update(overwritten, 'n')
       
   261 
   264 
   262 class kwfilelog(filelog.filelog):
   265 class kwfilelog(filelog.filelog):
   263     '''
   266     '''
   264     Subclass of filelog to hook into its read, add, cmp methods.
   267     Subclass of filelog to hook into its read, add, cmp methods.
   265     Keywords are "stored" unexpanded, and processed on reading.
   268     Keywords are "stored" unexpanded, and processed on reading.