656 f = templ('manifest', **args) |
656 f = templ('manifest', **args) |
657 # TODO: perhaps 'ctx' should be dropped from mapping because manifest |
657 # TODO: perhaps 'ctx' should be dropped from mapping because manifest |
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(**args): |
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(**args) |
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 showlist("fate", values, args) |
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""" |
681 repo = context.resource(mapping, 'repo') |
679 repo = context.resource(mapping, 'repo') |
682 ctx = context.resource(mapping, 'ctx') |
680 ctx = context.resource(mapping, 'ctx') |
794 yield "; ".join(render(d) for d in data) |
792 yield "; ".join(render(d) for d in data) |
795 |
793 |
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(repo, ctx, **args): |
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 |
809 if values is None: |
810 if values is None: |
810 values = [] |
811 values = [] |
831 newmarker = (hexprec, hexsucs) + m[2:5] + (hexparents,) + m[6:] |
832 newmarker = (hexprec, hexsucs) + m[2:5] + (hexparents,) + m[6:] |
832 finalmarkers.append(newmarker) |
833 finalmarkers.append(newmarker) |
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'}) |
841 def showp1rev(context, mapping): |
841 def showp1rev(context, mapping): |
842 """Integer. The repository-local revision number of the changeset's |
842 """Integer. The repository-local revision number of the changeset's |