hgkw/keyword.py
branchkwmap-templates
changeset 145 1c2cefa97b96
parent 144 19b3d1de3db0
child 146 df9de07ce002
equal deleted inserted replaced
144:19b3d1de3db0 145:1c2cefa97b96
   226         def commit(self, files=None, text="", user=None, date=None,
   226         def commit(self, files=None, text="", user=None, date=None,
   227                 match=util.always, force=False, lock=None, wlock=None,
   227                 match=util.always, force=False, lock=None, wlock=None,
   228                 force_editor=False, p1=None, p2=None, extra={}):
   228                 force_editor=False, p1=None, p2=None, extra={}):
   229             '''Wraps commit, expanding keywords of committed and
   229             '''Wraps commit, expanding keywords of committed and
   230             configured files in working directory.'''
   230             configured files in working directory.'''
   231 
       
   232             removed = self.status()[2]
       
   233 
       
   234             node = super(kwrepo, self).commit(files=files,
       
   235                     text=text, user=user, date=date,
       
   236                     match=match, force=force, lock=lock, wlock=wlock,
       
   237                     force_editor=force_editor, p1=p1, p2=p2, extra=extra)
       
   238             if node is None:
       
   239                 return node
       
   240 
       
   241             candidates = self.changelog.read(node)[3]
       
   242             candidates = [f for f in candidates if f not in removed
       
   243                     and not self._link(f) and self.kwfmatcher(f)]
       
   244             if not candidates:
       
   245                 return node
       
   246 
       
   247             wrelease = False
   231             wrelease = False
   248             if not wlock:
   232             if not wlock:
   249                 wlock = self.wlock()
   233                 wlock = self.wlock()
   250                 wrelease = True
   234                 wrelease = True
   251             try:
   235             try:
       
   236                 removed = self.status()[2]
       
   237 
       
   238                 node = super(kwrepo, self).commit(files=files,
       
   239                         text=text, user=user, date=date,
       
   240                         match=match, force=force, lock=lock, wlock=wlock,
       
   241                         force_editor=force_editor, p1=p1, p2=p2, extra=extra)
       
   242                 if node is None:
       
   243                     return node
       
   244 
       
   245                 candidates = self.changelog.read(node)[3]
       
   246                 candidates = [f for f in candidates if f not in removed
       
   247                         and not self._link(f) and self.kwfmatcher(f)]
       
   248                 if not candidates:
       
   249                     return node
       
   250 
   252                 kwt = kwtemplater(self.ui, self)
   251                 kwt = kwtemplater(self.ui, self)
   253                 kwt.overwrite(candidates, node)
   252                 kwt.overwrite(candidates, node)
       
   253                 return node
   254             finally:
   254             finally:
   255                 if wrelease:
   255                 if wrelease:
   256                     wlock.release()
   256                     wlock.release()
   257             return node
       
   258 
   257 
   259     repo.__class__ = kwrepo
   258     repo.__class__ = kwrepo