hgkw/keyword.py
changeset 229 8e5ba738e36d
parent 228 88362a9b5afd
child 230 9fe9a9839387
equal deleted inserted replaced
228:88362a9b5afd 229:8e5ba738e36d
   459             return filelog.filelog(self.sopener, f)
   459             return filelog.filelog(self.sopener, f)
   460 
   460 
   461         def commit(self, files=None, text='', user=None, date=None,
   461         def commit(self, files=None, text='', user=None, date=None,
   462                    match=util.always, force=False, lock=None, wlock=None,
   462                    match=util.always, force=False, lock=None, wlock=None,
   463                    force_editor=False, p1=None, p2=None, extra={}):
   463                    force_editor=False, p1=None, p2=None, extra={}):
       
   464             # (w)lock arguments removed in 126f527b3ba3
       
   465             # so they are None or what was passed to commit
       
   466             # use private _(w)lock for deletion
       
   467             _lock = lock
       
   468             _wlock = wlock
       
   469             del wlock, lock
   464             try:
   470             try:
   465                 kwlock = lock
   471                 if not _wlock:
   466                 kwwlock = wlock
   472                     _wlock = self.wlock()
   467                 del wlock, lock
   473                 if not _lock:
   468             except NameError:
   474                     _lock = self.lock()
   469                 # (w)lock arguments removed in recent Hg versions
       
   470                 kwwlock = kwlock = None
       
   471             try:
       
   472                 if not kwwlock:
       
   473                     kwwlock = self.wlock()
       
   474                 if not kwlock:
       
   475                     kwlock = self.lock()
       
   476                 try:
   475                 try:
   477                     node = super(kwrepo,
   476                     node = super(kwrepo,
   478                                  self).commit(files=files, text=text,
   477                                  self).commit(files=files, text=text,
   479                                               user=user, date=date,
   478                                               user=user, date=date,
   480                                               match=match, force=force,
   479                                               match=match, force=force,
   481                                               lock=kwlock, wlock=kwwlock,
   480                                               lock=_lock, wlock=_wlock,
   482                                               force_editor=force_editor,
   481                                               force_editor=force_editor,
   483                                               p1=p1, p2=p2, extra=extra)
   482                                               p1=p1, p2=p2, extra=extra)
   484                 except TypeError:
   483                 except TypeError:
   485                     node = super(kwrepo,
   484                     node = super(kwrepo,
   486                                  self).commit(files=files, text=text,
   485                                  self).commit(files=files, text=text,
   496                         expand = commit = True
   495                         expand = commit = True
   497                         kwt = kwtemplater(ui, self, expand, node=node)
   496                         kwt = kwtemplater(ui, self, expand, node=node)
   498                         kwt.overwrite(candidates, mn, commit)
   497                         kwt.overwrite(candidates, mn, commit)
   499                 return node
   498                 return node
   500             finally:
   499             finally:
   501                 del kwwlock, kwlock
   500                 del _wlock, _lock
   502 
   501 
   503     repo.__class__ = kwrepo
   502     repo.__class__ = kwrepo
   504 
   503 
   505 
   504 
   506 cmdtable = {
   505 cmdtable = {