comparison mercurial/templater.py @ 35010:b81ad5b78a81

obsfate: makes successorsetverb takes the markers as argument Right now, successorsetverb only needs successors to compute the verb. But we will want use additional information (effect-flags and operation) in the near future to compute a better verb. Add the markers parameter now so extensions (like Evolve) could wrap the function and start experimenting around better obsfate verbs. As successorsetverb now takes both successorset and markers parameters, rename it to obsfateverb, successorsetandmarkersverb was too long. Differential Revision: https://phab.mercurial-scm.org/D1191
author Boris Feld <boris.feld@octobus.net>
date Thu, 19 Oct 2017 12:35:47 +0200
parents d3ea6a1c798f
children 073bc922d349
comparison
equal deleted inserted replaced
35007:407ec7f3ff02 35010:b81ad5b78a81
1003 # i18n: "obsfateusers" is a keyword 1003 # i18n: "obsfateusers" is a keyword
1004 msg = _("obsfateusers first argument should be an iterable of " 1004 msg = _("obsfateusers first argument should be an iterable of "
1005 "obsmakers") 1005 "obsmakers")
1006 raise error.ParseError(msg) 1006 raise error.ParseError(msg)
1007 1007
1008 @templatefunc('obsfateverb(successors)') 1008 @templatefunc('obsfateverb(successors, markers)')
1009 def obsfateverb(context, mapping, args): 1009 def obsfateverb(context, mapping, args):
1010 """Compute obsfate related information based on successors (EXPERIMENTAL)""" 1010 """Compute obsfate related information based on successors (EXPERIMENTAL)"""
1011 if len(args) != 1: 1011 if len(args) != 2:
1012 # i18n: "obsfateverb" is a keyword 1012 # i18n: "obsfateverb" is a keyword
1013 raise error.ParseError(_("obsfateverb expects one arguments")) 1013 raise error.ParseError(_("obsfateverb expects two arguments"))
1014 1014
1015 successors = evalfuncarg(context, mapping, args[0]) 1015 successors = evalfuncarg(context, mapping, args[0])
1016 markers = evalfuncarg(context, mapping, args[1])
1016 1017
1017 try: 1018 try:
1018 return obsutil.successorsetverb(successors) 1019 return obsutil.obsfateverb(successors, markers)
1019 except TypeError: 1020 except TypeError:
1020 # i18n: "obsfateverb" is a keyword 1021 # i18n: "obsfateverb" is a keyword
1021 errmsg = _("obsfateverb first argument should be countable") 1022 errmsg = _("obsfateverb first argument should be countable")
1022 raise error.ParseError(errmsg) 1023 raise error.ParseError(errmsg)
1023 1024