##// END OF EJS Templates
commit: hoist the rest of the dirstate manipulation out of commitctx
Matt Mackall -
r8416:9dfee83c default
parent child Browse files
Show More
@@ -814,6 +814,14 b' class localrepository(repo.repository):'
814 extra, changes)
814 extra, changes)
815 ret = self.commitctx(wctx, editor, True)
815 ret = self.commitctx(wctx, editor, True)
816 ms.reset()
816 ms.reset()
817
818 # update dirstate
819 for f in changes[0] + changes[1]:
820 self.dirstate.normal(f)
821 for f in changes[2]:
822 self.dirstate.forget(f)
823 self.dirstate.setparents(ret)
824
817 return ret
825 return ret
818
826
819 finally:
827 finally:
@@ -821,7 +829,7 b' class localrepository(repo.repository):'
821 self.dirstate.invalidate() # didn't successfully commit
829 self.dirstate.invalidate() # didn't successfully commit
822 wlock.release()
830 wlock.release()
823
831
824 def commitctx(self, ctx, editor=None, working=False):
832 def commitctx(self, ctx, editor=None, error=False):
825 """Add a new revision to current repository.
833 """Add a new revision to current repository.
826
834
827 Revision information is passed via the context argument.
835 Revision information is passed via the context argument.
@@ -855,11 +863,8 b' class localrepository(repo.repository):'
855 new[f] = self._filecommit(fctx, m1, m2, linkrev, trp,
863 new[f] = self._filecommit(fctx, m1, m2, linkrev, trp,
856 changed)
864 changed)
857 m1.set(f, fctx.flags())
865 m1.set(f, fctx.flags())
858 if working:
859 self.dirstate.normal(f)
860
861 except (OSError, IOError):
866 except (OSError, IOError):
862 if working:
867 if error:
863 self.ui.warn(_("trouble committing %s!\n") % f)
868 self.ui.warn(_("trouble committing %s!\n") % f)
864 raise
869 raise
865 else:
870 else:
@@ -906,11 +911,6 b' class localrepository(repo.repository):'
906 if self.branchcache:
911 if self.branchcache:
907 self.branchtags()
912 self.branchtags()
908
913
909 if working:
910 self.dirstate.setparents(n)
911 for f in removed:
912 self.dirstate.forget(f)
913
914 self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2)
914 self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2)
915 return n
915 return n
916 finally:
916 finally:
General Comments 0
You need to be logged in to leave comments. Login now