[PATCH 2 of 2] fetch: do not count inactive branches when inferring a merge

Benjamin Pollack benjamin at bitquabit.com
Tue Mar 17 10:53:27 CDT 2009


# HG changeset patch
# User Benjamin Pollack <benjamin at bitquabit.com>
# Date 1237304860 14400
# Node ID f8525b7c1910ce96e9812236787bb42b753b33c2
# Parent  85397d58c070b08a0fd40b9f012580c6fecf0ff8
fetch: do not count inactive branches when inferring a merge

The fetch extension would erroneously consider inactive branches when
inferring which branches to merge.  It now considers only active
branches.

diff --git a/hgext/fetch.py b/hgext/fetch.py
--- a/hgext/fetch.py
+++ b/hgext/fetch.py
@@ -52,7 +52,9 @@
             raise util.Abort(_('outstanding uncommitted changes'))
         if del_:
             raise util.Abort(_('working directory is missing some files'))
-        if len(repo.branchheads(branch)) > 1:
+        bheads = repo.branchheads(branch)
+        bheads = [head for head in bheads if len(repo[head].children()) == 0]
+        if len(bheads) > 1:
             raise util.Abort(_('multiple heads in this branch '
                                '(use "hg heads ." and "hg merge" to merge)'))
 
@@ -76,6 +78,7 @@
 
         # Is this a simple fast-forward along the current branch?
         newheads = repo.branchheads(branch)
+        newheads = [head for head in newheads if len(repo[head].children()) == 0]
         newchildren = repo.changelog.nodesbetween([parent], newheads)[2]
         if len(newheads) == 1:
             if newchildren[0] != parent:


More information about the Mercurial-devel mailing list