##// END OF EJS Templates
commit: hoist up dirstate invalidate
Matt Mackall -
r8415:221a1801 default
parent child Browse files
Show More
@@ -775,6 +775,7 b' class localrepository(repo.repository):'
775 if files:
775 if files:
776 files = list(set(files))
776 files = list(set(files))
777
777
778 ret = None
778 wlock = self.wlock()
779 wlock = self.wlock()
779 try:
780 try:
780 p1, p2 = self.dirstate.parents()
781 p1, p2 = self.dirstate.parents()
@@ -811,11 +812,13 b' class localrepository(repo.repository):'
811 "(see hg resolve)"))
812 "(see hg resolve)"))
812 wctx = context.workingctx(self, (p1, p2), text, user, date,
813 wctx = context.workingctx(self, (p1, p2), text, user, date,
813 extra, changes)
814 extra, changes)
814 r = self.commitctx(wctx, editor, True)
815 ret = self.commitctx(wctx, editor, True)
815 ms.reset()
816 ms.reset()
816 return r
817 return ret
817
818
818 finally:
819 finally:
820 if ret == None:
821 self.dirstate.invalidate() # didn't successfully commit
819 wlock.release()
822 wlock.release()
820
823
821 def commitctx(self, ctx, editor=None, working=False):
824 def commitctx(self, ctx, editor=None, working=False):
@@ -827,7 +830,6 b' class localrepository(repo.repository):'
827 """
830 """
828
831
829 tr = lock = None
832 tr = lock = None
830 valid = 0 # don't save the dirstate if this isn't set
831 remove = ctx.removed()
833 remove = ctx.removed()
832 p1, p2 = ctx.p1(), ctx.p2()
834 p1, p2 = ctx.p1(), ctx.p2()
833 m1 = p1.manifest().copy()
835 m1 = p1.manifest().copy()
@@ -908,13 +910,10 b' class localrepository(repo.repository):'
908 self.dirstate.setparents(n)
910 self.dirstate.setparents(n)
909 for f in removed:
911 for f in removed:
910 self.dirstate.forget(f)
912 self.dirstate.forget(f)
911 valid = 1 # our dirstate updates are complete
912
913
913 self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2)
914 self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2)
914 return n
915 return n
915 finally:
916 finally:
916 if not valid: # don't save our updated dirstate
917 self.dirstate.invalidate()
918 del tr
917 del tr
919 lock.release()
918 lock.release()
920
919
General Comments 0
You need to be logged in to leave comments. Login now