D6365: context: move contents of committablectx.markcommitted() to workingctx
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Sat May 11 06:11:59 UTC 2019
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
Same reasoning as previous commits: this function updates the
dirstate. By not updating the dirstate here, we also fix the
close-head test.
REPOSITORY
rHG Mercurial
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
@@ -1225,18 +1225,7 @@
modified and added files as normal in the dirstate.
"""
-
- 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())
+ pass
def dirty(self, missing=False, merge=True, branch=True):
return False
@@ -1657,7 +1646,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: mercurial-devel
More information about the Mercurial-devel
mailing list