Patchwork [1,of,2] merge: check current wc branch for 'nothing to merge', not its p1

mail settings
Submitter Mads Kiilerich
Date March 12, 2017, 11:44 p.m.
Message ID <42083ac9c3ed1b3be205.1489362245@localhost.localdomain>
Download mbox | patch
Permalink /patch/19259/
State Accepted
Headers show


Mads Kiilerich - March 12, 2017, 11:44 p.m.
# HG changeset patch
# User Mads Kiilerich <>
# Date 1489362106 25200
#      Sun Mar 12 16:41:46 2017 -0700
# Node ID 42083ac9c3ed1b3be205e0f3a621787071587ae5
# Parent  1c3352d7eaf24533ad52d4b8a024211e9189fb0b
merge: check current wc branch for 'nothing to merge', not its p1

The working directory will usually be clean or very clean, and wc will usually
have the same branch as its parent. This change will thus usually not make any
difference and is done as a separate change to show that. It will be used in a
later change.


diff --git a/mercurial/ b/mercurial/
--- a/mercurial/
+++ b/mercurial/
@@ -1544,7 +1544,7 @@  def update(repo, node, branchmerge, forc
                 raise error.Abort(_("merging with a working directory ancestor"
                                    " has no effect"))
             elif pas == [p1]:
-                if not mergeancestor and p1.branch() == p2.branch():
+                if not mergeancestor and wc.branch() == p2.branch():
                     raise error.Abort(_("nothing to merge"),
                                      hint=_("use 'hg update' "
                                             "or check 'hg heads'"))