changeset 44050:2ecbc4ec87d8

overlayworkingctx: default branch to base context's branch This matches what the dirstate does (it reuses working copy parent's branch unless told otherwise). By moving the default out of `rebase.commitmemorynode()`, it will let us clean that up better later. Differential Revision: https://phab.mercurial-scm.org/D7821
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 10 Jan 2020 17:03:23 -0800
parents 6cfaebb625d3
children 436d106de670
files hgext/rebase.py mercurial/context.py
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Thu Jan 09 15:41:40 2020 -0800
+++ b/hgext/rebase.py	Fri Jan 10 17:03:23 2020 -0800
@@ -1430,7 +1430,7 @@
 
     # By convention, ``extra['branch']`` (set by extrafn) clobbers
     # ``branch`` (used when passing ``--keepbranches``).
-    branch = repo[p1].branch()
+    branch = None
     if b'branch' in extra:
         branch = extra[b'branch']
 
--- a/mercurial/context.py	Thu Jan 09 15:41:40 2020 -0800
+++ b/mercurial/context.py	Fri Jan 10 17:03:23 2020 -0800
@@ -2445,6 +2445,9 @@
                 # necessary for memctx to register a deletion.
                 return None
 
+        if branch is None:
+            branch = self._wrappedctx.branch()
+
         return memctx(
             self._repo,
             parents,