Mercurial > public > mercurial-scm > hg
diff mercurial/context.py @ 42295:fdd4d668ceb5
context: move contents of committablectx.markcommitted() to workingctx
Same reasoning as previous commits: this function updates the
dirstate. By not updating the dirstate here, we also fix the
close-head test.
Differential Revision: https://phab.mercurial-scm.org/D6365
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 10 May 2019 21:55:59 -0700 |
parents | 4fbfc893e6b9 |
children | df2f22befdc8 |
line wrap: on
line diff
--- a/mercurial/context.py Fri May 10 22:18:11 2019 -0700 +++ b/mercurial/context.py Fri May 10 21:55:59 2019 -0700 @@ -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)