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

login
register
mail settings
Submitter Pierre-Yves David
Date Feb. 12, 2016, 2:29 p.m.
Message ID <ac9aa93761f3949cb060.1455287348@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/13132/
State Accepted
Headers show

Comments

Pierre-Yves David - Feb. 12, 2016, 2:29 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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: