# HG changeset patch # User Martin von Zweigbergk # Date 1578721288 28800 # Node ID 436d106de67020ce11f3aa743d6826df7d714bcb # Parent 2ecbc4ec87d89f28f6404348a9da6c6ec43aac01 overlayworkginctx: implement a setparents() to mirror dirstate.setparents() This lets us make the in-memory and on-disk code a bit more similar. I'll soon also implement setparents() on the regular workingctx. Differential Revision: https://phab.mercurial-scm.org/D7822 diff -r 2ecbc4ec87d8 -r 436d106de670 hgext/rebase.py --- a/hgext/rebase.py Fri Jan 10 17:03:23 2020 -0800 +++ b/hgext/rebase.py Fri Jan 10 21:41:28 2020 -0800 @@ -1434,9 +1434,9 @@ if b'branch' in extra: branch = extra[b'branch'] + wctx.setparents(repo[p1].node(), repo[p2].node()) memctx = wctx.tomemctx( commitmsg, - parents=(p1, p2), date=date, extra=extra, user=user, diff -r 2ecbc4ec87d8 -r 436d106de670 mercurial/context.py --- a/mercurial/context.py Fri Jan 10 17:03:23 2020 -0800 +++ b/mercurial/context.py Fri Jan 10 21:41:28 2020 -0800 @@ -2161,6 +2161,10 @@ # ``overlayworkingctx`` (e.g. with --collapse). util.clearcachedproperty(self, b'_manifest') + def setparents(self, p1node, p2node=nullid): + assert p1node == self._wrappedctx.node() + self._parents = [self._wrappedctx, self._repo.unfiltered()[p2node]] + def data(self, path): if self.isdirty(path): if self._cache[path][b'exists']: @@ -2415,9 +2419,9 @@ ``text`` is the commit message. ``parents`` (optional) are rev numbers. """ - # Default parents to the wrapped contexts' if not passed. + # Default parents to the wrapped context if not passed. if parents is None: - parents = self._wrappedctx.parents() + parents = self.parents() if len(parents) == 1: parents = (parents[0], None)