diff mercurial/context.py @ 18661:4fb92f14a97a

commit: factor out post-commit cleanup into workingctx This pulls some of the logic for the cleanup that needs to happen after a commit has been made otu of localrepo.commit and into workingctx. This is part of a larger refactoring effort that will eventually allow us to perform some types of merges in-memory.
author David Schleimer <dschleimer@fb.com>
date Fri, 08 Feb 2013 05:36:08 -0800
parents 3e92772d5383
children f02045645d12
line wrap: on
line diff
--- a/mercurial/context.py	Fri Feb 08 05:36:08 2013 -0800
+++ b/mercurial/context.py	Fri Feb 08 05:36:08 2013 -0800
@@ -1138,6 +1138,22 @@
             finally:
                 wlock.release()
 
+    def markcommitted(self, node):
+        """Perform post-commit cleanup necessary after commiting this workingctx
+
+        Specifically, this updates backing stores this working context
+        wraps to reflect the fact that the changes reflected by this
+        workingctx have been committed.  For example, it marks
+        modified and added files as normal in the dirstate.
+
+        """
+
+        for f in self.modified() + self.added():
+            self._repo.dirstate.normal(f)
+        for f in self.removed():
+            self._repo.dirstate.drop(f)
+        self._repo.dirstate.setparents(node)
+
     def dirs(self):
         return set(self._repo.dirstate.dirs())