Mercurial > evolve
diff hgext3rd/topic/stack.py @ 2668:1d2c66dc4ee3
topic: explicitly pass topic as a keyword argument
This clarify all callers before adding more logic related to bare branch in
stack.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 28 Jun 2017 01:58:09 +0200 |
parents | 62eb5a2d2112 |
children | b933a8068c17 |
line wrap: on
line diff
--- a/hgext3rd/topic/stack.py Tue Jun 27 15:21:38 2017 +0200 +++ b/hgext3rd/topic/stack.py Wed Jun 28 01:58:09 2017 +0200 @@ -10,7 +10,7 @@ ) from .evolvebits import builddependencies, _orderrevs, _singlesuccessor -def getstack(repo, topic): +def getstack(repo, topic=None): # XXX need sorting trevs = repo.revs("topic(%s) - obsolete()", topic) return _orderrevs(repo, trevs) @@ -21,7 +21,9 @@ """ return ' '.join(prefix % suffix for suffix in labelssuffix) -def showstack(ui, repo, topic, opts): +def showstack(ui, repo, topic=None, opts=None): + if opts is None: + opts = {} if topic not in repo.topics: raise error.Abort(_('cannot resolve "%s": no such topic found') % topic) @@ -35,7 +37,7 @@ if topic == repo.currenttopic: label = 'topic.active' - data = stackdata(repo, topic) + data = stackdata(repo, topic=topic) fm.plain(_('### topic: %s') % ui.label(topic, label), label='topic.stack.summary.topic') @@ -56,7 +58,7 @@ fm.plain('%d behind' % data['behindcount'], label='topic.stack.summary.behindcount') fm.plain('\n') - for idx, r in enumerate(getstack(repo, topic), 1): + for idx, r in enumerate(getstack(repo, topic=topic), 1): ctx = repo[r] p1 = ctx.p1() if p1.obsolete(): @@ -111,7 +113,7 @@ fm.plain('\n') fm.end() -def stackdata(repo, topic): +def stackdata(repo, topic=None): """get various data about a stack :changesetcount: number of non-obsolete changesets in the stack