Mercurial > public > mercurial-scm > evolve
diff hgext3rd/topic/flow.py @ 3157:f286eefbd20d
topic: add an option to enforce a single head per name in a repository
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 30 Oct 2017 19:24:14 +0100 |
parents | |
children | 678a9802c56b |
line wrap: on
line diff
--- /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)))