##// END OF EJS Templates
commit: push repo lock down into _commitctx
Matt Mackall -
r8405:7cbf8fcd default
parent child Browse files
Show More
@@ -774,10 +774,9 b' class localrepository(repo.repository):'
774 force = True
774 force = True
775 if files:
775 if files:
776 files = list(set(files))
776 files = list(set(files))
777 try:
777
778 wlock = self.wlock()
778 wlock = self.wlock()
779 lock = self.lock()
779 try:
780
781 p1, p2 = self.dirstate.parents()
780 p1, p2 = self.dirstate.parents()
782
781
783 if (not force and p2 != nullid and
782 if (not force and p2 != nullid and
@@ -817,7 +816,7 b' class localrepository(repo.repository):'
817 return r
816 return r
818
817
819 finally:
818 finally:
820 release(lock, wlock)
819 wlock.release()
821
820
822 def commitctx(self, ctx):
821 def commitctx(self, ctx):
823 """Add a new revision to current repository.
822 """Add a new revision to current repository.
@@ -825,15 +824,12 b' class localrepository(repo.repository):'
825 Revision information is passed in the context.memctx argument.
824 Revision information is passed in the context.memctx argument.
826 commitctx() does not touch the working directory.
825 commitctx() does not touch the working directory.
827 """
826 """
828 lock = self.lock()
829 try:
830 return self._commitctx(ctx, force=True, force_editor=False,
827 return self._commitctx(ctx, force=True, force_editor=False,
831 empty_ok=True, working=False)
828 empty_ok=True, working=False)
832 finally:
833 lock.release()
834
829
835 def _commitctx(self, ctx, force=False, force_editor=False, empty_ok=False,
830 def _commitctx(self, ctx, force=False, force_editor=False, empty_ok=False,
836 working=True):
831 working=True):
832 lock = self.lock()
837 tr = None
833 tr = None
838 valid = 0 # don't save the dirstate if this isn't set
834 valid = 0 # don't save the dirstate if this isn't set
839 try:
835 try:
@@ -958,6 +954,7 b' class localrepository(repo.repository):'
958 if not valid: # don't save our updated dirstate
954 if not valid: # don't save our updated dirstate
959 self.dirstate.invalidate()
955 self.dirstate.invalidate()
960 del tr
956 del tr
957 lock.release()
961
958
962 def walk(self, match, node=None):
959 def walk(self, match, node=None):
963 '''
960 '''
General Comments 0
You need to be logged in to leave comments. Login now