[PATCH] merge: handle case when heads are all bookmarks

John Li jli at janestreet.com
Wed Aug 22 14:53:03 CDT 2012


# HG changeset patch
# User John Li <jli at circularly.org>
# Date 1345648715 14400
# Node ID a76c74593ffc00a20a691abaa4748cf02658b98c
# Parent  a0cf8f4cd38ba8c35132379b680ebf6d0e900e3d
merge: handle case when heads are all bookmarks

If all heads are bookmarks, merge fails to find what node to merge
with (throws an IndexError while indexing into the non-bookmark heads
list) as of 4a02cf4fbb2e. This catches that case and prints an error
to specify a rev explicitly.

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4269,7 +4269,7 @@
                              hint=_("run 'hg heads .' to see heads"))

         parent = repo.dirstate.p1()
-        if len(nbhs) == 1:
+        if len(nbhs) <= 1:
             if len(bheads) > 1:
                 raise util.Abort(_("heads are bookmarked - "
                                    "please merge with an explicit rev"),


More information about the Mercurial-devel mailing list