comparison mercurial/templatekw.py @ 34656:eb7fffdc6e5b

help: fix formatting of template keywords Our minirst formatter can't render multi-paragraph definition lists well. Also added periods where appropriate.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 12 Oct 2017 21:42:42 +0900
parents ee0d74083a22
children bfb6fd93b637
comparison
equal deleted inserted replaced
34655:01c57eeb35cb 34656:eb7fffdc6e5b
375 return showlist('children', childrevs, args, element='child') 375 return showlist('children', childrevs, args, element='child')
376 376
377 # Deprecated, but kept alive for help generation a purpose. 377 # Deprecated, but kept alive for help generation a purpose.
378 @templatekeyword('currentbookmark') 378 @templatekeyword('currentbookmark')
379 def showcurrentbookmark(**args): 379 def showcurrentbookmark(**args):
380 """String. The active bookmark, if it is 380 """String. The active bookmark, if it is associated with the changeset.
381 associated with the changeset (DEPRECATED)""" 381 (DEPRECATED)"""
382 return showactivebookmark(**args) 382 return showactivebookmark(**args)
383 383
384 @templatekeyword('activebookmark') 384 @templatekeyword('activebookmark')
385 def showactivebookmark(**args): 385 def showactivebookmark(**args):
386 """String. The active bookmark, if it is 386 """String. The active bookmark, if it is associated with the changeset."""
387 associated with the changeset"""
388 active = args[r'repo']._activebookmark 387 active = args[r'repo']._activebookmark
389 if active and active in args[r'ctx'].bookmarks(): 388 if active and active in args[r'ctx'].bookmarks():
390 return active 389 return active
391 return '' 390 return ''
392 391
503 args = pycompat.byteskwargs(args) 502 args = pycompat.byteskwargs(args)
504 return showlist('file', args['ctx'].files(), args) 503 return showlist('file', args['ctx'].files(), args)
505 504
506 @templatekeyword('graphnode') 505 @templatekeyword('graphnode')
507 def showgraphnode(repo, ctx, **args): 506 def showgraphnode(repo, ctx, **args):
508 """String. The character representing the changeset node in 507 """String. The character representing the changeset node in an ASCII
509 an ASCII revision graph""" 508 revision graph."""
510 wpnodes = repo.dirstate.parents() 509 wpnodes = repo.dirstate.parents()
511 if wpnodes[1] == nullid: 510 if wpnodes[1] == nullid:
512 wpnodes = wpnodes[:1] 511 wpnodes = wpnodes[:1]
513 if ctx.node() in wpnodes: 512 if ctx.node() in wpnodes:
514 return '@' 513 return '@'
669 return d 668 return d
670 return _hybrid(None, urls, makemap, lambda k: '%s=%s' % (k, urls[k])) 669 return _hybrid(None, urls, makemap, lambda k: '%s=%s' % (k, urls[k]))
671 670
672 @templatekeyword("predecessors") 671 @templatekeyword("predecessors")
673 def showpredecessors(repo, ctx, **args): 672 def showpredecessors(repo, ctx, **args):
674 """Returns the list if the closest visible successors 673 """Returns the list if the closest visible successors."""
675 """
676 predecessors = sorted(obsutil.closestpredecessors(repo, ctx.node())) 674 predecessors = sorted(obsutil.closestpredecessors(repo, ctx.node()))
677 predecessors = map(hex, predecessors) 675 predecessors = map(hex, predecessors)
678 676
679 return _hybrid(None, predecessors, 677 return _hybrid(None, predecessors,
680 lambda x: {'ctx': repo[x], 'revcache': {}}, 678 lambda x: {'ctx': repo[x], 'revcache': {}},
681 lambda x: scmutil.formatchangeid(repo[x])) 679 lambda x: scmutil.formatchangeid(repo[x]))
682 680
683 @templatekeyword("successorssets") 681 @templatekeyword("successorssets")
684 def showsuccessorssets(repo, ctx, **args): 682 def showsuccessorssets(repo, ctx, **args):
685 """Returns a string of sets of successors for a changectx 683 """Returns a string of sets of successors for a changectx. Format used
686 684 is: [ctx1, ctx2], [ctx3] if ctx has been splitted into ctx1 and ctx2
687 Format used is: [ctx1, ctx2], [ctx3] if ctx has been splitted into ctx1 and 685 while also diverged into ctx3."""
688 ctx2 while also diverged into ctx3"""
689 if not ctx.obsolete(): 686 if not ctx.obsolete():
690 return '' 687 return ''
691 args = pycompat.byteskwargs(args) 688 args = pycompat.byteskwargs(args)
692 689
693 ssets = obsutil.successorssets(repo, ctx.node(), closest=True) 690 ssets = obsutil.successorssets(repo, ctx.node(), closest=True)
712 return _hybrid(gen(data), data, lambda x: {'successorset': x}, 709 return _hybrid(gen(data), data, lambda x: {'successorset': x},
713 pycompat.identity) 710 pycompat.identity)
714 711
715 @templatekeyword("succsandmarkers") 712 @templatekeyword("succsandmarkers")
716 def showsuccsandmarkers(repo, ctx, **args): 713 def showsuccsandmarkers(repo, ctx, **args):
717 """Returns a list of dict for each final successor of ctx. 714 """Returns a list of dict for each final successor of ctx. The dict
718 715 contains successors node id in "successors" keys and the list of
719 The dict contains successors node id in "successors" keys and the list of 716 obs-markers from ctx to the set of successors in "markers".
720 obs-markers from ctx to the set of successors in "markers"
721
722 (EXPERIMENTAL) 717 (EXPERIMENTAL)
723 """ 718 """
724 719
725 values = obsutil.successorsandmarkers(repo, ctx) 720 values = obsutil.successorsandmarkers(repo, ctx)
726 721
861 return repo.ui.termwidth() 856 return repo.ui.termwidth()
862 857
863 @templatekeyword('troubles') 858 @templatekeyword('troubles')
864 def showtroubles(repo, **args): 859 def showtroubles(repo, **args):
865 """List of strings. Evolution troubles affecting the changeset. 860 """List of strings. Evolution troubles affecting the changeset.
866
867 (DEPRECATED) 861 (DEPRECATED)
868 """ 862 """
869 msg = ("'troubles' is deprecated, " 863 msg = ("'troubles' is deprecated, "
870 "use 'instabilities'") 864 "use 'instabilities'")
871 repo.ui.deprecwarn(msg, '4.4') 865 repo.ui.deprecwarn(msg, '4.4')
873 return showinstabilities(repo=repo, **args) 867 return showinstabilities(repo=repo, **args)
874 868
875 @templatekeyword('instabilities') 869 @templatekeyword('instabilities')
876 def showinstabilities(**args): 870 def showinstabilities(**args):
877 """List of strings. Evolution instabilities affecting the changeset. 871 """List of strings. Evolution instabilities affecting the changeset.
878
879 (EXPERIMENTAL) 872 (EXPERIMENTAL)
880 """ 873 """
881 args = pycompat.byteskwargs(args) 874 args = pycompat.byteskwargs(args)
882 return showlist('instability', args['ctx'].instabilities(), args, 875 return showlist('instability', args['ctx'].instabilities(), args,
883 plural='instabilities') 876 plural='instabilities')