D6365: context: move contents of committablectx.markcommitted() to workingctx

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Wed May 15 14:04:10 EDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rHGfdd4d668ceb5: context: move contents of committablectx.markcommitted() to workingctx (authored by martinvonz, committed by ).

CHANGED PRIOR TO COMMIT
  https://phab.mercurial-scm.org/D6365?vs=15059&id=15107#toc

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6365?vs=15059&id=15107

REVISION DETAIL
  https://phab.mercurial-scm.org/D6365

AFFECTED FILES
  mercurial/context.py
  tests/fakedirstatewritetime.py
  tests/test-close-head.t

CHANGE DETAILS

diff --git a/tests/test-close-head.t b/tests/test-close-head.t
--- a/tests/test-close-head.t
+++ b/tests/test-close-head.t
@@ -37,7 +37,7 @@
   000000000000
   $ hg --config extensions.closehead= close-head -m 'Close old heads' -r 1 2
   $ hg id
-  340d36cac2f4 tip
+  000000000000
   $ hg bookmark
      @                         1:66f7d451a68b
   $ hg heads
diff --git a/tests/fakedirstatewritetime.py b/tests/fakedirstatewritetime.py
--- a/tests/fakedirstatewritetime.py
+++ b/tests/fakedirstatewritetime.py
@@ -74,5 +74,5 @@
 def extsetup(ui):
     extensions.wrapfunction(context.workingctx, '_poststatusfixup',
                             _poststatusfixup)
-    extensions.wrapfunction(context.committablectx, 'markcommitted',
+    extensions.wrapfunction(context.workingctx, 'markcommitted',
                             markcommitted)
diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -1226,18 +1226,6 @@
 
         """
 
-        with self._repo.dirstate.parentchange():
-            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)
-
-        # write changes out explicitly, because nesting wlock at
-        # runtime may prevent 'wlock.release()' in 'repo.commit()'
-        # from immediately doing so for subsequent changing files
-        self._repo.dirstate.write(self._repo.currenttransaction())
-
     def dirty(self, missing=False, merge=True, branch=True):
         return False
 
@@ -1657,7 +1645,17 @@
         return sorted(f for f in ds.matches(match) if ds[f] != 'r')
 
     def markcommitted(self, node):
-        super(workingctx, self).markcommitted(node)
+        with self._repo.dirstate.parentchange():
+            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)
+
+        # write changes out explicitly, because nesting wlock at
+        # runtime may prevent 'wlock.release()' in 'repo.commit()'
+        # from immediately doing so for subsequent changing files
+        self._repo.dirstate.write(self._repo.currenttransaction())
 
         sparse.aftercommit(self._repo, node)
 



To: martinvonz, #hg-reviewers
Cc: durin42, mercurial-devel


More information about the Mercurial-devel mailing list