Patchwork D7822: overlayworkginctx: implement a setparents() to mirror dirstate.setparents()

login
register
mail settings
Submitter phabricator
Date Jan. 13, 2020, 2:19 p.m.
Message ID <477e9e0ba34c6c8468acbd64b4928a37@localhost.localdomain>
Download mbox | patch
Permalink /patch/44268/
State Not Applicable
Headers show

Comments

phabricator - Jan. 13, 2020, 2:19 p.m.
Closed by commit rHG436d106de670: overlayworkginctx: implement a setparents() to mirror dirstate.setparents() (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7822?vs=19142&id=19162

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7822/new/

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

AFFECTED FILES
  hgext/rebase.py
  mercurial/context.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -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)
 
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -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,