hgkw/keyword.py
branchstable
changeset 542 057f4a64df03
parent 540 e30c2a251010
child 543 72477fcc575b
equal deleted inserted replaced
540:e30c2a251010 542:057f4a64df03
   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, force_editor=False,
   456                    p1=None, p2=None, extra={}, empty_ok=False):
   456                    extra={}, empty_ok=False):
   457             wlock = lock = None
   457             wlock = lock = None
   458             _p1 = _p2 = None
   458             _p1 = _p2 = None
   459             try:
   459             try:
   460                 wlock = self.wlock()
   460                 wlock = self.wlock()
   461                 lock = self.lock()
   461                 lock = self.lock()
   465                     if name.split('.', 1)[0] == 'commit':
   465                     if name.split('.', 1)[0] == 'commit':
   466                         commithooks[name] = cmd
   466                         commithooks[name] = cmd
   467                         ui.setconfig('hooks', name, None)
   467                         ui.setconfig('hooks', name, None)
   468                 if commithooks:
   468                 if commithooks:
   469                     # store parents for commit hook environment
   469                     # store parents for commit hook environment
   470                     if p1 is None:
   470                     _p1, _p2 = repo.dirstate.parents()
   471                         _p1, _p2 = repo.dirstate.parents()
       
   472                     else:
       
   473                         _p1, _p2 = p1, p2 or nullid
       
   474                     _p1 = hex(_p1)
   471                     _p1 = hex(_p1)
   475                     if _p2 == nullid:
   472                     if _p2 == nullid:
   476                         _p2 = ''
   473                         _p2 = ''
   477                     else:
   474                     else:
   478                         _p2 = hex(_p2)
   475                         _p2 = hex(_p2)
   479 
   476 
   480                 n = super(kwrepo, self).commit(files, text, user, date, match,
   477                 n = super(kwrepo, self).commit(files, text, user, date, match,
   481                                                force, force_editor, p1, p2,
   478                                                force, force_editor,
   482                                                extra, empty_ok)
   479                                                extra, empty_ok)
   483 
   480 
   484                 # restore commit hooks
   481                 # restore commit hooks
   485                 for name, cmd in commithooks.iteritems():
   482                 for name, cmd in commithooks.iteritems():
   486                     ui.setconfig('hooks', name, cmd)
   483                     ui.setconfig('hooks', name, cmd)