comparison mercurial/templater.py @ 34012:38f08eaba6b0

template: compute user in obsfateusers Extract, deduplicate users informations from obs markers in order to display them. Print all users for the moment, we might want to display users only in verbose mode later.
author Boris Feld <boris.feld@octobus.net>
date Mon, 03 Jul 2017 15:34:00 +0200
parents 3d0f8918351b
children c35c0f54f420
comparison
equal deleted inserted replaced
34011:3d0f8918351b 34012:38f08eaba6b0
848 raise error.ParseError(_("mod expects two arguments")) 848 raise error.ParseError(_("mod expects two arguments"))
849 849
850 func = lambda a, b: a % b 850 func = lambda a, b: a % b
851 return runarithmetic(context, mapping, (func, args[0], args[1])) 851 return runarithmetic(context, mapping, (func, args[0], args[1]))
852 852
853 @templatefunc('obsfateusers(markers)')
854 def obsfateusers(context, mapping, args):
855 """Compute obsfate related information based on markers (EXPERIMENTAL)"""
856 if len(args) != 1:
857 # i18n: "obsfateusers" is a keyword
858 raise error.ParseError(_("obsfateusers expects one arguments"))
859
860 markers = evalfuncarg(context, mapping, args[0])
861
862 try:
863 data = obsutil.markersusers(markers)
864 return templatekw.hybridlist(data, name='user')
865 except (TypeError, KeyError, ValueError):
866 # i18n: "obsfateusers" is a keyword
867 msg = _("obsfateusers first argument should be an iterable of "
868 "obsmakers")
869 raise error.ParseError(msg)
870
853 @templatefunc('obsfateverb(successors)') 871 @templatefunc('obsfateverb(successors)')
854 def obsfateverb(context, mapping, args): 872 def obsfateverb(context, mapping, args):
855 """Compute obsfate related information based on successors (EXPERIMENTAL)""" 873 """Compute obsfate related information based on successors (EXPERIMENTAL)"""
856 if len(args) != 1: 874 if len(args) != 1:
857 # i18n: "obsfateverb" is a keyword 875 # i18n: "obsfateverb" is a keyword