mercurial/localrepo.py
changeset 26998 4414d500604f
parent 26996 bf3eec62212f
child 27071 dfb31eebd949
equal deleted inserted replaced
26997:1791f9aa782f 26998:4414d500604f
  1453         if not force:
  1453         if not force:
  1454             vdirs = []
  1454             vdirs = []
  1455             match.explicitdir = vdirs.append
  1455             match.explicitdir = vdirs.append
  1456             match.bad = fail
  1456             match.bad = fail
  1457 
  1457 
  1458         wlock = self.wlock()
  1458         wlock = lock = tr = None
  1459         try:
  1459         try:
       
  1460             wlock = self.wlock()
  1460             wctx = self[None]
  1461             wctx = self[None]
  1461             merge = len(wctx.parents()) > 1
  1462             merge = len(wctx.parents()) > 1
  1462 
  1463 
  1463             if not force and merge and match.ispartial():
  1464             if not force and merge and match.ispartial():
  1464                 raise error.Abort(_('cannot partially commit a merge '
  1465                 raise error.Abort(_('cannot partially commit a merge '
  1589                     sr = sub.commit(cctx._text, user, date)
  1590                     sr = sub.commit(cctx._text, user, date)
  1590                     newstate[s] = (newstate[s][0], sr)
  1591                     newstate[s] = (newstate[s][0], sr)
  1591                 subrepo.writestate(self, newstate)
  1592                 subrepo.writestate(self, newstate)
  1592 
  1593 
  1593             p1, p2 = self.dirstate.parents()
  1594             p1, p2 = self.dirstate.parents()
       
  1595             lock = self.lock()
  1594             hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '')
  1596             hookp1, hookp2 = hex(p1), (p2 != nullid and hex(p2) or '')
  1595             try:
  1597             try:
  1596                 self.hook("precommit", throw=True, parent1=hookp1,
  1598                 self.hook("precommit", throw=True, parent1=hookp1,
  1597                           parent2=hookp2)
  1599                           parent2=hookp2)
       
  1600                 tr = self.transaction('commit')
  1598                 ret = self.commitctx(cctx, True)
  1601                 ret = self.commitctx(cctx, True)
  1599             except: # re-raises
  1602             except: # re-raises
  1600                 if edited:
  1603                 if edited:
  1601                     self.ui.write(
  1604                     self.ui.write(
  1602                         _('note: commit message saved in %s\n') % msgfn)
  1605                         _('note: commit message saved in %s\n') % msgfn)
  1603                 raise
  1606                 raise
  1604 
       
  1605             # update bookmarks, dirstate and mergestate
  1607             # update bookmarks, dirstate and mergestate
  1606             bookmarks.update(self, [p1, p2], ret)
  1608             bookmarks.update(self, [p1, p2], ret)
  1607             cctx.markcommitted(ret)
  1609             cctx.markcommitted(ret)
  1608             ms.reset()
  1610             ms.reset()
       
  1611             tr.close()
       
  1612 
  1609         finally:
  1613         finally:
  1610             wlock.release()
  1614             lockmod.release(tr, lock, wlock)
  1611 
  1615 
  1612         def commithook(node=hex(ret), parent1=hookp1, parent2=hookp2):
  1616         def commithook(node=hex(ret), parent1=hookp1, parent2=hookp2):
  1613             # hack for command that use a temporary commit (eg: histedit)
  1617             # hack for command that use a temporary commit (eg: histedit)
  1614             # temporary commit got stripped before hook release
  1618             # temporary commit got stripped before hook release
  1615             if self.changelog.hasnode(ret):
  1619             if self.changelog.hasnode(ret):