fetch: do not count inactive branches when inferring a merge
authorBenjamin Pollack <benjamin@bitquabit.com>
Tue, 17 Mar 2009 11:47:40 -0400
changeset 7854 423b4482c5cb
parent 7853 af062a9fea9b
child 7855 aa1a87f7544f
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.
hgext/fetch.py
--- a/hgext/fetch.py	Tue Mar 17 13:43:11 2009 -0500
+++ b/hgext/fetch.py	Tue Mar 17 11:47:40 2009 -0400
@@ -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: