Alan Franzoni committed 60f0bdb

Fix: hgskipcommit should work when not on the default branch.

Fix misunderstood suggestion from the mercurial mailing list, the second
parent should always be checked for nullrev and False should be returned
instead, because nullrev.branch() will in fact work but will always return

Comments (0)

Files changed (1)

 from mercurial import commands, extensions
+from mercurial.node import nullrev
 def is_merge_commit(repo):
-    return (repo[None].p1().branch()) != (repo[None].p2().branch())
+    parent1 = repo[None].p1()
+    parent2 = repo[None].p2()
+    if parent2.rev() is nullrev:
+        # just one parent, surely not a merge.
+        return False
+    return (parent1.branch()) != (parent2.branch())
 def wrapped_commit(orig, ui, repo, *args, **kwargs):
     if not args and (not is_merge_commit(repo)):