Mercurial > evolve
changeset 4152:fb22c7a6ca8b
topic: add topicidx template keyword
This keyword will be useful where we want to see the index of
the changeset in the stack when we run `hg stack`.
author | Sushil khanchi <sushilkhanchi97@gmail.com> |
---|---|
date | Mon, 01 Oct 2018 12:37:42 +0530 |
parents | 0c84b48c5e4b |
children | e1f6f9da82c1 |
files | hgext3rd/topic/__init__.py |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/topic/__init__.py Tue Oct 09 15:14:32 2018 +0200 +++ b/hgext3rd/topic/__init__.py Mon Oct 01 12:37:42 2018 +0530 @@ -546,11 +546,21 @@ """:topic: String. The topic of the changeset""" ctx = context.resource(mapping, 'ctx') return ctx.topic() + + @templatekeyword('topicidx', requires={'ctx'}) + def topicidxkw(context, mapping): + """:topicidx: Integer. Index of the changeset as a stack alias""" + ctx = context.resource(mapping, 'ctx') + return ctx.topicidx() else: def topickw(**args): """:topic: String. The topic of the changeset""" return args['ctx'].topic() + def topicidxkw(**args): + """:topicidx: Integer. Index of the changeset as a stack alias""" + return args['ctx'].topicidx() + def wrapinit(orig, self, repo, *args, **kwargs): orig(self, repo, *args, **kwargs) if constants.extrakey not in self._extra: