mercurial/templatekw.py
changeset 34657 bfb6fd93b637
parent 34656 eb7fffdc6e5b
child 34847 e27f1f04c2cf
equal deleted inserted replaced
34656:eb7fffdc6e5b 34657:bfb6fd93b637
   646     """
   646     """
   647     return ctx.hex()
   647     return ctx.hex()
   648 
   648 
   649 @templatekeyword('obsolete')
   649 @templatekeyword('obsolete')
   650 def showobsolete(repo, ctx, templ, **args):
   650 def showobsolete(repo, ctx, templ, **args):
   651     """String. Whether the changeset is obsolete.
   651     """String. Whether the changeset is obsolete. (EXPERIMENTAL)"""
   652     """
       
   653     if ctx.obsolete():
   652     if ctx.obsolete():
   654         return 'obsolete'
   653         return 'obsolete'
   655     return ''
   654     return ''
   656 
   655 
   657 @templatekeyword('peerurls')
   656 @templatekeyword('peerurls')
   668         return d
   667         return d
   669     return _hybrid(None, urls, makemap, lambda k: '%s=%s' % (k, urls[k]))
   668     return _hybrid(None, urls, makemap, lambda k: '%s=%s' % (k, urls[k]))
   670 
   669 
   671 @templatekeyword("predecessors")
   670 @templatekeyword("predecessors")
   672 def showpredecessors(repo, ctx, **args):
   671 def showpredecessors(repo, ctx, **args):
   673     """Returns the list if the closest visible successors."""
   672     """Returns the list if the closest visible successors. (EXPERIMENTAL)"""
   674     predecessors = sorted(obsutil.closestpredecessors(repo, ctx.node()))
   673     predecessors = sorted(obsutil.closestpredecessors(repo, ctx.node()))
   675     predecessors = map(hex, predecessors)
   674     predecessors = map(hex, predecessors)
   676 
   675 
   677     return _hybrid(None, predecessors,
   676     return _hybrid(None, predecessors,
   678                    lambda x: {'ctx': repo[x], 'revcache': {}},
   677                    lambda x: {'ctx': repo[x], 'revcache': {}},
   680 
   679 
   681 @templatekeyword("successorssets")
   680 @templatekeyword("successorssets")
   682 def showsuccessorssets(repo, ctx, **args):
   681 def showsuccessorssets(repo, ctx, **args):
   683     """Returns a string of sets of successors for a changectx. Format used
   682     """Returns a string of sets of successors for a changectx. Format used
   684     is: [ctx1, ctx2], [ctx3] if ctx has been splitted into ctx1 and ctx2
   683     is: [ctx1, ctx2], [ctx3] if ctx has been splitted into ctx1 and ctx2
   685     while also diverged into ctx3."""
   684     while also diverged into ctx3. (EXPERIMENTAL)"""
   686     if not ctx.obsolete():
   685     if not ctx.obsolete():
   687         return ''
   686         return ''
   688     args = pycompat.byteskwargs(args)
   687     args = pycompat.byteskwargs(args)
   689 
   688 
   690     ssets = obsutil.successorssets(repo, ctx.node(), closest=True)
   689     ssets = obsutil.successorssets(repo, ctx.node(), closest=True)