D7821: overlayworkingctx: default branch to base context's branch

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sat Jan 11 01:47:53 EST 2020


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

CHANGE DETAILS

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



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


More information about the Mercurial-devel mailing list