mercurial/localrepo.py
changeset 41362 57c462db87fd
parent 41361 092c5d05ba01
child 41363 b87a009d1b3b
equal deleted inserted replaced
41361:092c5d05ba01 41362:57c462db87fd
  2407         if not force:
  2407         if not force:
  2408             vdirs = []
  2408             vdirs = []
  2409             match.explicitdir = vdirs.append
  2409             match.explicitdir = vdirs.append
  2410             match.bad = fail
  2410             match.bad = fail
  2411 
  2411 
  2412         wlock = lock = tr = None
  2412         wlock = lock = None
  2413         try:
  2413         try:
  2414             wlock = self.wlock()
  2414             wlock = self.wlock()
  2415             lock = self.lock() # for recent changelog (see issue4368)
  2415             lock = self.lock() # for recent changelog (see issue4368)
  2416 
  2416 
  2417             wctx = self[None]
  2417             wctx = self[None]
  2471             p1, p2 = self.dirstate.parents()
  2471             p1, p2 = self.dirstate.parents()
  2472             hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '')
  2472             hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '')
  2473             try:
  2473             try:
  2474                 self.hook("precommit", throw=True, parent1=hookp1,
  2474                 self.hook("precommit", throw=True, parent1=hookp1,
  2475                           parent2=hookp2)
  2475                           parent2=hookp2)
  2476                 tr = self.transaction('commit')
  2476                 with self.transaction('commit'):
  2477                 ret = self.commitctx(cctx, True)
  2477                     ret = self.commitctx(cctx, True)
  2478                 # update bookmarks, dirstate and mergestate
  2478                     # update bookmarks, dirstate and mergestate
  2479                 bookmarks.update(self, [p1, p2], ret)
  2479                     bookmarks.update(self, [p1, p2], ret)
  2480                 cctx.markcommitted(ret)
  2480                     cctx.markcommitted(ret)
  2481                 ms.reset()
  2481                     ms.reset()
  2482                 tr.close()
       
  2483             except: # re-raises
  2482             except: # re-raises
  2484                 if edited:
  2483                 if edited:
  2485                     self.ui.write(
  2484                     self.ui.write(
  2486                         _('note: commit message saved in %s\n') % msgfn)
  2485                         _('note: commit message saved in %s\n') % msgfn)
  2487                 raise
  2486                 raise
  2488 
  2487 
  2489         finally:
  2488         finally:
  2490             lockmod.release(tr, lock, wlock)
  2489             lockmod.release(lock, wlock)
  2491 
  2490 
  2492         def commithook(node=hex(ret), parent1=hookp1, parent2=hookp2):
  2491         def commithook(node=hex(ret), parent1=hookp1, parent2=hookp2):
  2493             # hack for command that use a temporary commit (eg: histedit)
  2492             # hack for command that use a temporary commit (eg: histedit)
  2494             # temporary commit got stripped before hook release
  2493             # temporary commit got stripped before hook release
  2495             if self.changelog.hasnode(ret):
  2494             if self.changelog.hasnode(ret):