Show More
@@ -352,12 +352,16 b' def linerange(req):' | |||||
352 | def formatlinerange(fromline, toline): |
|
352 | def formatlinerange(fromline, toline): | |
353 | return '%d:%d' % (fromline + 1, toline) |
|
353 | return '%d:%d' % (fromline + 1, toline) | |
354 |
|
354 | |||
355 |
def succsandmarkers( |
|
355 | def succsandmarkers(context, mapping): | |
356 | for item in templatekw.showsuccsandmarkers(repo, ctx, **args): |
|
356 | repo = context.resource(mapping, 'repo') | |
|
357 | for item in templatekw.showsuccsandmarkers(context, mapping): | |||
357 | item['successors'] = _siblings(repo[successor] |
|
358 | item['successors'] = _siblings(repo[successor] | |
358 | for successor in item['successors']) |
|
359 | for successor in item['successors']) | |
359 | yield item |
|
360 | yield item | |
360 |
|
361 | |||
|
362 | # teach templater succsandmarkers is switched to (context, mapping) API | |||
|
363 | succsandmarkers._requires = {'repo', 'ctx', 'templ'} | |||
|
364 | ||||
361 | def commonentry(repo, ctx): |
|
365 | def commonentry(repo, ctx): | |
362 | node = ctx.node() |
|
366 | node = ctx.node() | |
363 | return { |
|
367 | return { |
@@ -658,23 +658,21 b' def showmanifest(**args):' | |||||
658 | # rev and node are completely different from changeset's. |
|
658 | # rev and node are completely different from changeset's. | |
659 | return _mappable(f, None, f, lambda x: {'rev': mrev, 'node': mhex}) |
|
659 | return _mappable(f, None, f, lambda x: {'rev': mrev, 'node': mhex}) | |
660 |
|
660 | |||
661 | @templatekeyword('obsfate') |
|
661 | @templatekeyword('obsfate', requires={'ui', 'repo', 'ctx', 'templ'}) | |
662 |
def showobsfate( |
|
662 | def showobsfate(context, mapping): | |
663 | # this function returns a list containing pre-formatted obsfate strings. |
|
663 | # this function returns a list containing pre-formatted obsfate strings. | |
664 | # |
|
664 | # | |
665 | # This function will be replaced by templates fragments when we will have |
|
665 | # This function will be replaced by templates fragments when we will have | |
666 | # the verbosity templatekw available. |
|
666 | # the verbosity templatekw available. | |
667 |
succsandmarkers = showsuccsandmarkers( |
|
667 | succsandmarkers = showsuccsandmarkers(context, mapping) | |
668 |
|
668 | |||
669 | args = pycompat.byteskwargs(args) |
|
669 | ui = context.resource(mapping, 'ui') | |
670 | ui = args['ui'] |
|
|||
671 |
|
||||
672 | values = [] |
|
670 | values = [] | |
673 |
|
671 | |||
674 | for x in succsandmarkers: |
|
672 | for x in succsandmarkers: | |
675 | values.append(obsutil.obsfateprinter(x['successors'], x['markers'], ui)) |
|
673 | values.append(obsutil.obsfateprinter(x['successors'], x['markers'], ui)) | |
676 |
|
674 | |||
677 |
return |
|
675 | return compatlist(context, mapping, "fate", values) | |
678 |
|
676 | |||
679 | def shownames(context, mapping, namespace): |
|
677 | def shownames(context, mapping, namespace): | |
680 | """helper method to generate a template keyword for a namespace""" |
|
678 | """helper method to generate a template keyword for a namespace""" | |
@@ -796,13 +794,16 b' def showsuccessorssets(context, mapping)' | |||||
796 | return _hybrid(gen(data), data, lambda x: {'successorset': x}, |
|
794 | return _hybrid(gen(data), data, lambda x: {'successorset': x}, | |
797 | pycompat.identity) |
|
795 | pycompat.identity) | |
798 |
|
796 | |||
799 | @templatekeyword("succsandmarkers") |
|
797 | @templatekeyword("succsandmarkers", requires={'repo', 'ctx', 'templ'}) | |
800 |
def showsuccsandmarkers( |
|
798 | def showsuccsandmarkers(context, mapping): | |
801 | """Returns a list of dict for each final successor of ctx. The dict |
|
799 | """Returns a list of dict for each final successor of ctx. The dict | |
802 | contains successors node id in "successors" keys and the list of |
|
800 | contains successors node id in "successors" keys and the list of | |
803 | obs-markers from ctx to the set of successors in "markers". |
|
801 | obs-markers from ctx to the set of successors in "markers". | |
804 | (EXPERIMENTAL) |
|
802 | (EXPERIMENTAL) | |
805 | """ |
|
803 | """ | |
|
804 | repo = context.resource(mapping, 'repo') | |||
|
805 | ctx = context.resource(mapping, 'ctx') | |||
|
806 | templ = context.resource(mapping, 'templ') | |||
806 |
|
807 | |||
807 | values = obsutil.successorsandmarkers(repo, ctx) |
|
808 | values = obsutil.successorsandmarkers(repo, ctx) | |
808 |
|
809 | |||
@@ -833,8 +834,7 b' def showsuccsandmarkers(repo, ctx, **arg' | |||||
833 |
|
834 | |||
834 | data.append({'successors': successors, 'markers': finalmarkers}) |
|
835 | data.append({'successors': successors, 'markers': finalmarkers}) | |
835 |
|
836 | |||
836 | args = pycompat.byteskwargs(args) |
|
837 | f = _showlist('succsandmarkers', data, templ, mapping) | |
837 | f = _showlist('succsandmarkers', data, args['templ'], args) |
|
|||
838 | return _hybrid(f, data, lambda x: x, pycompat.identity) |
|
838 | return _hybrid(f, data, lambda x: x, pycompat.identity) | |
839 |
|
839 | |||
840 | @templatekeyword('p1rev', requires={'ctx'}) |
|
840 | @templatekeyword('p1rev', requires={'ctx'}) |
General Comments 0
You need to be logged in to leave comments.
Login now