[PATCH 5 of 6] destutil: consistently retrieve 'p1' and 'branch'

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Feb 12 09:29:08 EST 2016


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1454939788 -3600
#      Mon Feb 08 14:56:28 2016 +0100
# Node ID ac9aa93761f3949cb060b94cbbc62925ffc33427
# Parent  d6574d816512a8d5e7ed4f8a36e4556ce6788393
# EXP-Topic destination
# Available At http://hg.netv6.net/marmoute-wip/mercurial/
#              hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r ac9aa93761f3
destutil: consistently retrieve 'p1' and 'branch'

We already read p1 from the dirstate so let's read the branch from it too.

diff --git a/mercurial/destutil.py b/mercurial/destutil.py
--- a/mercurial/destutil.py
+++ b/mercurial/destutil.py
@@ -192,11 +192,11 @@ def _destmergebook(repo):
 
 def _destmergebranch(repo):
     """find merge destination based on branch heads"""
     node = None
     parent = repo.dirstate.p1()
-    branch = repo[None].branch()
+    branch = repo.dirstate.branch()
     bheads = repo.branchheads(branch)
     nbhs = [bh for bh in bheads if not repo[bh].bookmarks()]
 
     if parent not in bheads:
         if len(repo.heads()) <= 1:


More information about the Mercurial-devel mailing list