hgext3rd/topic/flow.py
changeset 3158 678a9802c56b
parent 3157 f286eefbd20d
child 3159 90515d0bfb08
--- a/hgext3rd/topic/flow.py	Mon Oct 30 19:24:14 2017 +0100
+++ b/hgext3rd/topic/flow.py	Wed Nov 01 16:26:33 2017 +0100
@@ -3,6 +3,7 @@
 from mercurial import (
     error,
     node,
+    phases,
 )
 
 from mercurial.i18n import _
@@ -13,3 +14,14 @@
             hexs = [node.short(n) for n in heads]
             raise error.Abort(_('%d heads on "%s"') % (len(heads), name),
                               hint=(', '.join(hexs)))
+
+def publishbarebranch(repo, tr):
+    """Publish changeset without topic"""
+    if 'node' not in tr.hookargs: # no new node
+        return
+    startnode = node.bin(tr.hookargs['node'])
+    topublish = repo.revs('not public() and (%n:) - hidden() - topic()', startnode)
+    if topublish:
+        cl = repo.changelog
+        nodes = [cl.node(r) for r in topublish]
+        repo._phasecache.advanceboundary(repo, tr, phases.public, nodes)