##// 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 814 extra, changes)
815 815 ret = self.commitctx(wctx, editor, True)
816 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 825 return ret
818 826
819 827 finally:
@@ -821,7 +829,7 b' class localrepository(repo.repository):'
821 829 self.dirstate.invalidate() # didn't successfully commit
822 830 wlock.release()
823 831
824 def commitctx(self, ctx, editor=None, working=False):
832 def commitctx(self, ctx, editor=None, error=False):
825 833 """Add a new revision to current repository.
826 834
827 835 Revision information is passed via the context argument.
@@ -855,11 +863,8 b' class localrepository(repo.repository):'
855 863 new[f] = self._filecommit(fctx, m1, m2, linkrev, trp,
856 864 changed)
857 865 m1.set(f, fctx.flags())
858 if working:
859 self.dirstate.normal(f)
860
861 866 except (OSError, IOError):
862 if working:
867 if error:
863 868 self.ui.warn(_("trouble committing %s!\n") % f)
864 869 raise
865 870 else:
@@ -906,11 +911,6 b' class localrepository(repo.repository):'
906 911 if self.branchcache:
907 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 914 self.hook("commit", node=hex(n), parent1=xp1, parent2=xp2)
915 915 return n
916 916 finally:
General Comments 0
You need to be logged in to leave comments. Login now