# HG changeset patch # User Martin von Zweigbergk # Date 2020-01-11 01:03:23 # Node ID 2ecbc4ec87d89f28f6404348a9da6c6ec43aac01 # Parent 6cfaebb625d3310316cbe080bc32893836889efc 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 diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -1430,7 +1430,7 @@ def commitmemorynode(repo, p1, p2, wctx, # 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'] diff --git a/mercurial/context.py b/mercurial/context.py --- a/mercurial/context.py +++ b/mercurial/context.py @@ -2445,6 +2445,9 @@ class overlayworkingctx(committablectx): # necessary for memctx to register a deletion. return None + if branch is None: + branch = self._wrappedctx.branch() + return memctx( self._repo, parents,