hgext3rd/topic/flow.py
changeset 3157 f286eefbd20d
child 3158 678a9802c56b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hgext3rd/topic/flow.py	Mon Oct 30 19:24:14 2017 +0100
@@ -0,0 +1,15 @@
+from __future__ import absolute_import
+
+from mercurial import (
+    error,
+    node,
+)
+
+from mercurial.i18n import _
+
+def enforcesinglehead(repo, tr):
+    for name, heads in repo.filtered('visible').branchmap().iteritems():
+        if len(heads) > 1:
+            hexs = [node.short(n) for n in heads]
+            raise error.Abort(_('%d heads on "%s"') % (len(heads), name),
+                              hint=(', '.join(hexs)))