Mercurial > public > mercurial-scm > evolve
view hgext3rd/topic/flow.py @ 3158:678a9802c56b
topic: add an option to automatically publish topic-less changeset
This new option will help playing with merge based workflow.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 01 Nov 2017 16:26:33 +0100 |
parents | f286eefbd20d |
children | 90515d0bfb08 |
line wrap: on
line source
from __future__ import absolute_import from mercurial import ( error, node, phases, ) 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))) 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)