|
@@
-351,17
+351,20
b' def showauthor(context, mapping):'
|
|
351
|
ctx = context.resource(mapping, 'ctx')
|
|
351
|
ctx = context.resource(mapping, 'ctx')
|
|
352
|
return ctx.user()
|
|
352
|
return ctx.user()
|
|
353
|
|
|
353
|
|
|
354
|
@templatekeyword('bisect')
|
|
354
|
@templatekeyword('bisect', requires={'repo', 'ctx'})
|
|
355
|
def showbisect(repo, ctx, templ, **args):
|
|
355
|
def showbisect(context, mapping):
|
|
356
|
"""String. The changeset bisection status."""
|
|
356
|
"""String. The changeset bisection status."""
|
|
|
|
|
357
|
repo = context.resource(mapping, 'repo')
|
|
|
|
|
358
|
ctx = context.resource(mapping, 'ctx')
|
|
357
|
return hbisect.label(repo, ctx.node())
|
|
359
|
return hbisect.label(repo, ctx.node())
|
|
358
|
|
|
360
|
|
|
359
|
@templatekeyword('branch')
|
|
361
|
@templatekeyword('branch', requires={'ctx'})
|
|
360
|
def showbranch(**args):
|
|
362
|
def showbranch(context, mapping):
|
|
361
|
"""String. The name of the branch on which the changeset was
|
|
363
|
"""String. The name of the branch on which the changeset was
|
|
362
|
committed.
|
|
364
|
committed.
|
|
363
|
"""
|
|
365
|
"""
|
|
364
|
return args[r'ctx'].branch()
|
|
366
|
ctx = context.resource(mapping, 'ctx')
|
|
|
|
|
367
|
return ctx.branch()
|
|
365
|
|
|
368
|
|
|
366
|
@templatekeyword('branches')
|
|
369
|
@templatekeyword('branches')
|
|
367
|
def showbranches(**args):
|
|
370
|
def showbranches(**args):
|
|
@@
-397,28
+400,32
b' def showchildren(**args):'
|
|
397
|
return showlist('children', childrevs, args, element='child')
|
|
400
|
return showlist('children', childrevs, args, element='child')
|
|
398
|
|
|
401
|
|
|
399
|
# Deprecated, but kept alive for help generation a purpose.
|
|
402
|
# Deprecated, but kept alive for help generation a purpose.
|
|
400
|
@templatekeyword('currentbookmark')
|
|
403
|
@templatekeyword('currentbookmark', requires={'repo', 'ctx'})
|
|
401
|
def showcurrentbookmark(**args):
|
|
404
|
def showcurrentbookmark(context, mapping):
|
|
402
|
"""String. The active bookmark, if it is associated with the changeset.
|
|
405
|
"""String. The active bookmark, if it is associated with the changeset.
|
|
403
|
(DEPRECATED)"""
|
|
406
|
(DEPRECATED)"""
|
|
404
|
return showactivebookmark(**args)
|
|
407
|
return showactivebookmark(context, mapping)
|
|
405
|
|
|
408
|
|
|
406
|
@templatekeyword('activebookmark')
|
|
409
|
@templatekeyword('activebookmark', requires={'repo', 'ctx'})
|
|
407
|
def showactivebookmark(**args):
|
|
410
|
def showactivebookmark(context, mapping):
|
|
408
|
"""String. The active bookmark, if it is associated with the changeset."""
|
|
411
|
"""String. The active bookmark, if it is associated with the changeset."""
|
|
409
|
active = args[r'repo']._activebookmark
|
|
412
|
repo = context.resource(mapping, 'repo')
|
|
410
|
if active and active in args[r'ctx'].bookmarks():
|
|
413
|
ctx = context.resource(mapping, 'ctx')
|
|
|
|
|
414
|
active = repo._activebookmark
|
|
|
|
|
415
|
if active and active in ctx.bookmarks():
|
|
411
|
return active
|
|
416
|
return active
|
|
412
|
return ''
|
|
417
|
return ''
|
|
413
|
|
|
418
|
|
|
414
|
@templatekeyword('date')
|
|
419
|
@templatekeyword('date', requires={'ctx'})
|
|
415
|
def showdate(repo, ctx, templ, **args):
|
|
420
|
def showdate(context, mapping):
|
|
416
|
"""Date information. The date when the changeset was committed."""
|
|
421
|
"""Date information. The date when the changeset was committed."""
|
|
|
|
|
422
|
ctx = context.resource(mapping, 'ctx')
|
|
417
|
return ctx.date()
|
|
423
|
return ctx.date()
|
|
418
|
|
|
424
|
|
|
419
|
@templatekeyword('desc')
|
|
425
|
@templatekeyword('desc', requires={'ctx'})
|
|
420
|
def showdescription(repo, ctx, templ, **args):
|
|
426
|
def showdescription(context, mapping):
|
|
421
|
"""String. The text of the changeset description."""
|
|
427
|
"""String. The text of the changeset description."""
|
|
|
|
|
428
|
ctx = context.resource(mapping, 'ctx')
|
|
422
|
s = ctx.description()
|
|
429
|
s = ctx.description()
|
|
423
|
if isinstance(s, encoding.localstr):
|
|
430
|
if isinstance(s, encoding.localstr):
|
|
424
|
# try hard to preserve utf-8 bytes
|
|
431
|
# try hard to preserve utf-8 bytes
|
|
@@
-426,11
+433,12
b' def showdescription(repo, ctx, templ, **'
|
|
426
|
else:
|
|
433
|
else:
|
|
427
|
return s.strip()
|
|
434
|
return s.strip()
|
|
428
|
|
|
435
|
|
|
429
|
@templatekeyword('diffstat')
|
|
436
|
@templatekeyword('diffstat', requires={'ctx'})
|
|
430
|
def showdiffstat(repo, ctx, templ, **args):
|
|
437
|
def showdiffstat(context, mapping):
|
|
431
|
"""String. Statistics of changes with the following format:
|
|
438
|
"""String. Statistics of changes with the following format:
|
|
432
|
"modified files: +added/-removed lines"
|
|
439
|
"modified files: +added/-removed lines"
|
|
433
|
"""
|
|
440
|
"""
|
|
|
|
|
441
|
ctx = context.resource(mapping, 'ctx')
|
|
434
|
stats = patch.diffstatdata(util.iterlines(ctx.diff(noprefix=False)))
|
|
442
|
stats = patch.diffstatdata(util.iterlines(ctx.diff(noprefix=False)))
|
|
435
|
maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats)
|
|
443
|
maxname, maxtotal, adds, removes, binary = patch.diffstatsum(stats)
|
|
436
|
return '%d: +%d/-%d' % (len(stats), adds, removes)
|
|
444
|
return '%d: +%d/-%d' % (len(stats), adds, removes)
|
|
@@
-524,10
+532,12
b' def showfiles(**args):'
|
|
524
|
args = pycompat.byteskwargs(args)
|
|
532
|
args = pycompat.byteskwargs(args)
|
|
525
|
return showlist('file', args['ctx'].files(), args)
|
|
533
|
return showlist('file', args['ctx'].files(), args)
|
|
526
|
|
|
534
|
|
|
527
|
@templatekeyword('graphnode')
|
|
535
|
@templatekeyword('graphnode', requires={'repo', 'ctx'})
|
|
528
|
def showgraphnode(repo, ctx, **args):
|
|
536
|
def showgraphnode(context, mapping):
|
|
529
|
"""String. The character representing the changeset node in an ASCII
|
|
537
|
"""String. The character representing the changeset node in an ASCII
|
|
530
|
revision graph."""
|
|
538
|
revision graph."""
|
|
|
|
|
539
|
repo = context.resource(mapping, 'repo')
|
|
|
|
|
540
|
ctx = context.resource(mapping, 'ctx')
|
|
531
|
return getgraphnode(repo, ctx)
|
|
541
|
return getgraphnode(repo, ctx)
|
|
532
|
|
|
542
|
|
|
533
|
def getgraphnode(repo, ctx):
|
|
543
|
def getgraphnode(repo, ctx):
|
|
@@
-545,14
+555,14
b' def getgraphnode(repo, ctx):'
|
|
545
|
else:
|
|
555
|
else:
|
|
546
|
return 'o'
|
|
556
|
return 'o'
|
|
547
|
|
|
557
|
|
|
548
|
@templatekeyword('graphwidth')
|
|
558
|
@templatekeyword('graphwidth', requires=())
|
|
549
|
def showgraphwidth(repo, ctx, templ, **args):
|
|
559
|
def showgraphwidth(context, mapping):
|
|
550
|
"""Integer. The width of the graph drawn by 'log --graph' or zero."""
|
|
560
|
"""Integer. The width of the graph drawn by 'log --graph' or zero."""
|
|
551
|
# just hosts documentation; should be overridden by template mapping
|
|
561
|
# just hosts documentation; should be overridden by template mapping
|
|
552
|
return 0
|
|
562
|
return 0
|
|
553
|
|
|
563
|
|
|
554
|
@templatekeyword('index')
|
|
564
|
@templatekeyword('index', requires=())
|
|
555
|
def showindex(**args):
|
|
565
|
def showindex(context, mapping):
|
|
556
|
"""Integer. The current iteration of the loop. (0 indexed)"""
|
|
566
|
"""Integer. The current iteration of the loop. (0 indexed)"""
|
|
557
|
# just hosts documentation; should be overridden by template mapping
|
|
567
|
# just hosts documentation; should be overridden by template mapping
|
|
558
|
raise error.Abort(_("can't use index in this context"))
|
|
568
|
raise error.Abort(_("can't use index in this context"))
|
|
@@
-683,24
+693,27
b' def shownamespaces(**args):'
|
|
683
|
|
|
693
|
|
|
684
|
return _hybrid(f, namespaces, makemap, pycompat.identity)
|
|
694
|
return _hybrid(f, namespaces, makemap, pycompat.identity)
|
|
685
|
|
|
695
|
|
|
686
|
@templatekeyword('node')
|
|
696
|
@templatekeyword('node', requires={'ctx'})
|
|
687
|
def shownode(repo, ctx, templ, **args):
|
|
697
|
def shownode(context, mapping):
|
|
688
|
"""String. The changeset identification hash, as a 40 hexadecimal
|
|
698
|
"""String. The changeset identification hash, as a 40 hexadecimal
|
|
689
|
digit string.
|
|
699
|
digit string.
|
|
690
|
"""
|
|
700
|
"""
|
|
|
|
|
701
|
ctx = context.resource(mapping, 'ctx')
|
|
691
|
return ctx.hex()
|
|
702
|
return ctx.hex()
|
|
692
|
|
|
703
|
|
|
693
|
@templatekeyword('obsolete')
|
|
704
|
@templatekeyword('obsolete', requires={'ctx'})
|
|
694
|
def showobsolete(repo, ctx, templ, **args):
|
|
705
|
def showobsolete(context, mapping):
|
|
695
|
"""String. Whether the changeset is obsolete. (EXPERIMENTAL)"""
|
|
706
|
"""String. Whether the changeset is obsolete. (EXPERIMENTAL)"""
|
|
|
|
|
707
|
ctx = context.resource(mapping, 'ctx')
|
|
696
|
if ctx.obsolete():
|
|
708
|
if ctx.obsolete():
|
|
697
|
return 'obsolete'
|
|
709
|
return 'obsolete'
|
|
698
|
return ''
|
|
710
|
return ''
|
|
699
|
|
|
711
|
|
|
700
|
@templatekeyword('peerurls')
|
|
712
|
@templatekeyword('peerurls', requires={'repo'})
|
|
701
|
def showpeerurls(repo, **args):
|
|
713
|
def showpeerurls(context, mapping):
|
|
702
|
"""A dictionary of repository locations defined in the [paths] section
|
|
714
|
"""A dictionary of repository locations defined in the [paths] section
|
|
703
|
of your configuration file."""
|
|
715
|
of your configuration file."""
|
|
|
|
|
716
|
repo = context.resource(mapping, 'repo')
|
|
704
|
# see commands.paths() for naming of dictionary keys
|
|
717
|
# see commands.paths() for naming of dictionary keys
|
|
705
|
paths = repo.ui.paths
|
|
718
|
paths = repo.ui.paths
|
|
706
|
urls = util.sortdict((k, p.rawloc) for k, p in sorted(paths.iteritems()))
|
|
719
|
urls = util.sortdict((k, p.rawloc) for k, p in sorted(paths.iteritems()))
|
|
@@
-711,9
+724,11
b' def showpeerurls(repo, **args):'
|
|
711
|
return d
|
|
724
|
return d
|
|
712
|
return _hybrid(None, urls, makemap, lambda k: '%s=%s' % (k, urls[k]))
|
|
725
|
return _hybrid(None, urls, makemap, lambda k: '%s=%s' % (k, urls[k]))
|
|
713
|
|
|
726
|
|
|
714
|
@templatekeyword("predecessors")
|
|
727
|
@templatekeyword("predecessors", requires={'repo', 'ctx'})
|
|
715
|
def showpredecessors(repo, ctx, **args):
|
|
728
|
def showpredecessors(context, mapping):
|
|
716
|
"""Returns the list if the closest visible successors. (EXPERIMENTAL)"""
|
|
729
|
"""Returns the list if the closest visible successors. (EXPERIMENTAL)"""
|
|
|
|
|
730
|
repo = context.resource(mapping, 'repo')
|
|
|
|
|
731
|
ctx = context.resource(mapping, 'ctx')
|
|
717
|
predecessors = sorted(obsutil.closestpredecessors(repo, ctx.node()))
|
|
732
|
predecessors = sorted(obsutil.closestpredecessors(repo, ctx.node()))
|
|
718
|
predecessors = map(hex, predecessors)
|
|
733
|
predecessors = map(hex, predecessors)
|
|
719
|
|
|
734
|
|
|
@@
-721,19
+736,21
b' def showpredecessors(repo, ctx, **args):'
|
|
721
|
lambda x: {'ctx': repo[x], 'revcache': {}},
|
|
736
|
lambda x: {'ctx': repo[x], 'revcache': {}},
|
|
722
|
lambda x: scmutil.formatchangeid(repo[x]))
|
|
737
|
lambda x: scmutil.formatchangeid(repo[x]))
|
|
723
|
|
|
738
|
|
|
724
|
@templatekeyword('reporoot')
|
|
739
|
@templatekeyword('reporoot', requires={'repo'})
|
|
725
|
def showreporoot(repo, **args):
|
|
740
|
def showreporoot(context, mapping):
|
|
726
|
"""String. The root directory of the current repository."""
|
|
741
|
"""String. The root directory of the current repository."""
|
|
|
|
|
742
|
repo = context.resource(mapping, 'repo')
|
|
727
|
return repo.root
|
|
743
|
return repo.root
|
|
728
|
|
|
744
|
|
|
729
|
@templatekeyword("successorssets")
|
|
745
|
@templatekeyword("successorssets", requires={'repo', 'ctx'})
|
|
730
|
def showsuccessorssets(repo, ctx, **args):
|
|
746
|
def showsuccessorssets(context, mapping):
|
|
731
|
"""Returns a string of sets of successors for a changectx. Format used
|
|
747
|
"""Returns a string of sets of successors for a changectx. Format used
|
|
732
|
is: [ctx1, ctx2], [ctx3] if ctx has been splitted into ctx1 and ctx2
|
|
748
|
is: [ctx1, ctx2], [ctx3] if ctx has been splitted into ctx1 and ctx2
|
|
733
|
while also diverged into ctx3. (EXPERIMENTAL)"""
|
|
749
|
while also diverged into ctx3. (EXPERIMENTAL)"""
|
|
|
|
|
750
|
repo = context.resource(mapping, 'repo')
|
|
|
|
|
751
|
ctx = context.resource(mapping, 'ctx')
|
|
734
|
if not ctx.obsolete():
|
|
752
|
if not ctx.obsolete():
|
|
735
|
return ''
|
|
753
|
return ''
|
|
736
|
args = pycompat.byteskwargs(args)
|
|
|
|
|
737
|
|
|
754
|
|
|
738
|
ssets = obsutil.successorssets(repo, ctx.node(), closest=True)
|
|
755
|
ssets = obsutil.successorssets(repo, ctx.node(), closest=True)
|
|
739
|
ssets = [[hex(n) for n in ss] for ss in ssets]
|
|
756
|
ssets = [[hex(n) for n in ss] for ss in ssets]
|
|
@@
-797,30
+814,34
b' def showsuccsandmarkers(repo, ctx, **arg'
|
|
797
|
f = _showlist('succsandmarkers', data, pycompat.byteskwargs(args))
|
|
814
|
f = _showlist('succsandmarkers', data, pycompat.byteskwargs(args))
|
|
798
|
return _hybrid(f, data, lambda x: x, pycompat.identity)
|
|
815
|
return _hybrid(f, data, lambda x: x, pycompat.identity)
|
|
799
|
|
|
816
|
|
|
800
|
@templatekeyword('p1rev')
|
|
817
|
@templatekeyword('p1rev', requires={'ctx'})
|
|
801
|
def showp1rev(repo, ctx, templ, **args):
|
|
818
|
def showp1rev(context, mapping):
|
|
802
|
"""Integer. The repository-local revision number of the changeset's
|
|
819
|
"""Integer. The repository-local revision number of the changeset's
|
|
803
|
first parent, or -1 if the changeset has no parents."""
|
|
820
|
first parent, or -1 if the changeset has no parents."""
|
|
|
|
|
821
|
ctx = context.resource(mapping, 'ctx')
|
|
804
|
return ctx.p1().rev()
|
|
822
|
return ctx.p1().rev()
|
|
805
|
|
|
823
|
|
|
806
|
@templatekeyword('p2rev')
|
|
824
|
@templatekeyword('p2rev', requires={'ctx'})
|
|
807
|
def showp2rev(repo, ctx, templ, **args):
|
|
825
|
def showp2rev(context, mapping):
|
|
808
|
"""Integer. The repository-local revision number of the changeset's
|
|
826
|
"""Integer. The repository-local revision number of the changeset's
|
|
809
|
second parent, or -1 if the changeset has no second parent."""
|
|
827
|
second parent, or -1 if the changeset has no second parent."""
|
|
|
|
|
828
|
ctx = context.resource(mapping, 'ctx')
|
|
810
|
return ctx.p2().rev()
|
|
829
|
return ctx.p2().rev()
|
|
811
|
|
|
830
|
|
|
812
|
@templatekeyword('p1node')
|
|
831
|
@templatekeyword('p1node', requires={'ctx'})
|
|
813
|
def showp1node(repo, ctx, templ, **args):
|
|
832
|
def showp1node(context, mapping):
|
|
814
|
"""String. The identification hash of the changeset's first parent,
|
|
833
|
"""String. The identification hash of the changeset's first parent,
|
|
815
|
as a 40 digit hexadecimal string. If the changeset has no parents, all
|
|
834
|
as a 40 digit hexadecimal string. If the changeset has no parents, all
|
|
816
|
digits are 0."""
|
|
835
|
digits are 0."""
|
|
|
|
|
836
|
ctx = context.resource(mapping, 'ctx')
|
|
817
|
return ctx.p1().hex()
|
|
837
|
return ctx.p1().hex()
|
|
818
|
|
|
838
|
|
|
819
|
@templatekeyword('p2node')
|
|
839
|
@templatekeyword('p2node', requires={'ctx'})
|
|
820
|
def showp2node(repo, ctx, templ, **args):
|
|
840
|
def showp2node(context, mapping):
|
|
821
|
"""String. The identification hash of the changeset's second
|
|
841
|
"""String. The identification hash of the changeset's second
|
|
822
|
parent, as a 40 digit hexadecimal string. If the changeset has no second
|
|
842
|
parent, as a 40 digit hexadecimal string. If the changeset has no second
|
|
823
|
parent, all digits are 0."""
|
|
843
|
parent, all digits are 0."""
|
|
|
|
|
844
|
ctx = context.resource(mapping, 'ctx')
|
|
824
|
return ctx.p2().hex()
|
|
845
|
return ctx.p2().hex()
|
|
825
|
|
|
846
|
|
|
826
|
@templatekeyword('parents')
|
|
847
|
@templatekeyword('parents')
|
|
@@
-841,19
+862,22
b' def showparents(**args):'
|
|
841
|
return _hybrid(f, prevs, lambda x: {'ctx': repo[x], 'revcache': {}},
|
|
862
|
return _hybrid(f, prevs, lambda x: {'ctx': repo[x], 'revcache': {}},
|
|
842
|
lambda x: scmutil.formatchangeid(repo[x]), keytype=int)
|
|
863
|
lambda x: scmutil.formatchangeid(repo[x]), keytype=int)
|
|
843
|
|
|
864
|
|
|
844
|
@templatekeyword('phase')
|
|
865
|
@templatekeyword('phase', requires={'ctx'})
|
|
845
|
def showphase(repo, ctx, templ, **args):
|
|
866
|
def showphase(context, mapping):
|
|
846
|
"""String. The changeset phase name."""
|
|
867
|
"""String. The changeset phase name."""
|
|
|
|
|
868
|
ctx = context.resource(mapping, 'ctx')
|
|
847
|
return ctx.phasestr()
|
|
869
|
return ctx.phasestr()
|
|
848
|
|
|
870
|
|
|
849
|
@templatekeyword('phaseidx')
|
|
871
|
@templatekeyword('phaseidx', requires={'ctx'})
|
|
850
|
def showphaseidx(repo, ctx, templ, **args):
|
|
872
|
def showphaseidx(context, mapping):
|
|
851
|
"""Integer. The changeset phase index. (ADVANCED)"""
|
|
873
|
"""Integer. The changeset phase index. (ADVANCED)"""
|
|
|
|
|
874
|
ctx = context.resource(mapping, 'ctx')
|
|
852
|
return ctx.phase()
|
|
875
|
return ctx.phase()
|
|
853
|
|
|
876
|
|
|
854
|
@templatekeyword('rev')
|
|
877
|
@templatekeyword('rev', requires={'ctx'})
|
|
855
|
def showrev(repo, ctx, templ, **args):
|
|
878
|
def showrev(context, mapping):
|
|
856
|
"""Integer. The repository-local changeset revision number."""
|
|
879
|
"""Integer. The repository-local changeset revision number."""
|
|
|
|
|
880
|
ctx = context.resource(mapping, 'ctx')
|
|
857
|
return scmutil.intrev(ctx)
|
|
881
|
return scmutil.intrev(ctx)
|
|
858
|
|
|
882
|
|
|
859
|
def showrevslist(name, revs, **args):
|
|
883
|
def showrevslist(name, revs, **args):
|
|
@@
-892,9
+916,10
b' def showtags(**args):'
|
|
892
|
"""List of strings. Any tags associated with the changeset."""
|
|
916
|
"""List of strings. Any tags associated with the changeset."""
|
|
893
|
return shownames('tags', **args)
|
|
917
|
return shownames('tags', **args)
|
|
894
|
|
|
918
|
|
|
895
|
@templatekeyword('termwidth')
|
|
919
|
@templatekeyword('termwidth', requires={'ui'})
|
|
896
|
def showtermwidth(ui, **args):
|
|
920
|
def showtermwidth(context, mapping):
|
|
897
|
"""Integer. The width of the current terminal."""
|
|
921
|
"""Integer. The width of the current terminal."""
|
|
|
|
|
922
|
ui = context.resource(mapping, 'ui')
|
|
898
|
return ui.termwidth()
|
|
923
|
return ui.termwidth()
|
|
899
|
|
|
924
|
|
|
900
|
@templatekeyword('instabilities')
|
|
925
|
@templatekeyword('instabilities')
|
|
@@
-906,10
+931,11
b' def showinstabilities(**args):'
|
|
906
|
return showlist('instability', args['ctx'].instabilities(), args,
|
|
931
|
return showlist('instability', args['ctx'].instabilities(), args,
|
|
907
|
plural='instabilities')
|
|
932
|
plural='instabilities')
|
|
908
|
|
|
933
|
|
|
909
|
@templatekeyword('verbosity')
|
|
934
|
@templatekeyword('verbosity', requires={'ui'})
|
|
910
|
def showverbosity(ui, **args):
|
|
935
|
def showverbosity(context, mapping):
|
|
911
|
"""String. The current output verbosity in 'debug', 'quiet', 'verbose',
|
|
936
|
"""String. The current output verbosity in 'debug', 'quiet', 'verbose',
|
|
912
|
or ''."""
|
|
937
|
or ''."""
|
|
|
|
|
938
|
ui = context.resource(mapping, 'ui')
|
|
913
|
# see logcmdutil.changesettemplater for priority of these flags
|
|
939
|
# see logcmdutil.changesettemplater for priority of these flags
|
|
914
|
if ui.debugflag:
|
|
940
|
if ui.debugflag:
|
|
915
|
return 'debug'
|
|
941
|
return 'debug'
|