comparison hgext3rd/evolve/templatekw.py @ 2489:84a8219a2f9a

template: add the obsfate template Reuse _getobsoletefate and nextvisiblesuccessors to easily get the obsolescence fate of any node. The limitation is that obsfate is as precise as these two functions, which is not great for nextvisiblesuccessors.
author Boris Feld <boris.feld@octobus.net>
date Fri, 26 May 2017 13:28:49 +0200
parents 590da9c523ae
children 94f171534918
comparison
equal deleted inserted replaced
2488:1bdbe8f55339 2489:84a8219a2f9a
8 """evolve templates 8 """evolve templates
9 """ 9 """
10 10
11 from . import ( 11 from . import (
12 exthelper, 12 exthelper,
13 obshistory
13 ) 14 )
14 15
15 from mercurial import ( 16 from mercurial import (
16 templatekw, 17 templatekw,
17 node, 18 node,
94 for ss in ssets: 95 for ss in ssets:
95 final.append('[%s]' % ', '.join(map(node.short, ss))) 96 final.append('[%s]' % ', '.join(map(node.short, ss)))
96 97
97 return ', '.join(final) 98 return ', '.join(final)
98 99
100 @eh.templatekw("obsfate")
101 def showobsfate(repo, ctx, templ, **args):
102 if not ctx.obsolete():
103 return ''
104
105 successorssets = closestsuccessors(repo, ctx.node())
106 return obshistory._getobsfate(successorssets)
107
99 # copy from mercurial.obsolete with a small change to stop at first known changeset. 108 # copy from mercurial.obsolete with a small change to stop at first known changeset.
100 109
101 def directsuccessorssets(repo, initialnode, cache=None): 110 def directsuccessorssets(repo, initialnode, cache=None):
102 """return set of all direct successors of initial nodes 111 """return set of all direct successors of initial nodes
103 """ 112 """