hgkw/keyword.py
changeset 544 492234da500b
parent 543 72477fcc575b
child 549 9084fb1593e6
equal deleted inserted replaced
541:69c9e89471ae 544:492234da500b
   450         def wread(self, filename):
   450         def wread(self, filename):
   451             data = super(kwrepo, self).wread(filename)
   451             data = super(kwrepo, self).wread(filename)
   452             return kwt.wread(filename, data)
   452             return kwt.wread(filename, data)
   453 
   453 
   454         def commit(self, files=None, text='', user=None, date=None,
   454         def commit(self, files=None, text='', user=None, date=None,
   455                    match=None, force=False, force_editor=False,
   455                    match=None, force=False, editor=None, extra={}):
   456                    p1=None, p2=None, extra={}, empty_ok=False):
       
   457             wlock = lock = None
   456             wlock = lock = None
   458             _p1 = _p2 = None
   457             _p1 = _p2 = None
   459             try:
   458             try:
   460                 wlock = self.wlock()
   459                 wlock = self.wlock()
   461                 lock = self.lock()
   460                 lock = self.lock()
   465                     if name.split('.', 1)[0] == 'commit':
   464                     if name.split('.', 1)[0] == 'commit':
   466                         commithooks[name] = cmd
   465                         commithooks[name] = cmd
   467                         ui.setconfig('hooks', name, None)
   466                         ui.setconfig('hooks', name, None)
   468                 if commithooks:
   467                 if commithooks:
   469                     # store parents for commit hook environment
   468                     # store parents for commit hook environment
   470                     if p1 is None:
   469                     _p1, _p2 = repo.dirstate.parents()
   471                         _p1, _p2 = repo.dirstate.parents()
       
   472                     else:
       
   473                         _p1, _p2 = p1, p2 or nullid
       
   474                     _p1 = hex(_p1)
   470                     _p1 = hex(_p1)
   475                     if _p2 == nullid:
   471                     if _p2 == nullid:
   476                         _p2 = ''
   472                         _p2 = ''
   477                     else:
   473                     else:
   478                         _p2 = hex(_p2)
   474                         _p2 = hex(_p2)
   479 
   475 
   480                 n = super(kwrepo, self).commit(files, text, user, date, match,
   476                 n = super(kwrepo, self).commit(files, text, user, date, match,
   481                                                force, force_editor, p1, p2,
   477                                                force, editor, extra)
   482                                                extra, empty_ok)
       
   483 
   478 
   484                 # restore commit hooks
   479                 # restore commit hooks
   485                 for name, cmd in commithooks.iteritems():
   480                 for name, cmd in commithooks.iteritems():
   486                     ui.setconfig('hooks', name, cmd)
   481                     ui.setconfig('hooks', name, cmd)
   487                 if n is not None:
   482                 if n is not None: