Mercurial > public > mercurial-scm > evolve
diff hgext3rd/topic/topicmap.py @ 3397:f7129e3d5a38
topic: suggest using topic when user creates a new head on branch
This patch adds a message to use topics when user creates a new head on a
branch.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 27 Dec 2017 04:09:50 +0530 |
parents | 417490bdf28a |
children | 49d442a2207f |
line wrap: on
line diff
--- a/hgext3rd/topic/topicmap.py Mon Jan 15 18:41:29 2018 +0100 +++ b/hgext3rd/topic/topicmap.py Wed Dec 27 04:09:50 2017 +0530 @@ -1,6 +1,7 @@ import contextlib import hashlib +from mercurial.i18n import _ from mercurial.node import nullid from mercurial import ( branchmap, @@ -94,7 +95,23 @@ if ctx.topic() and ctx.branch() == branch: subbranch = "%s:%s" % (branch, ctx.topic()) bheads = repo.branchheads("%s:%s" % (subbranch, ctx.topic())) - return orig(repo, node, branch, bheads=bheads, opts=opts) + + ret = orig(repo, node, branch, bheads=bheads, opts=opts) + + # logic copy-pasted from cmdutil.commitstatus() + if opts is None: + opts = {} + ctx = repo[node] + if ctx.topic(): + return ret + parents = ctx.parents() + + if (not opts.get('amend') and bheads and node not in bheads and not + [x for x in parents if x.node() in bheads and x.branch() == branch]): + repo.ui.status(_("(consider using topic for lightweight branches." + " See 'hg help topic')\n")) + + return ret def _wrapbmcache(ui): class topiccache(_topiccache, branchmap.branchcache):