Mercurial > hg
comparison mercurial/templater.py @ 34287:7cdc8c5a481a
templates: introduce a obsfateoperation() function
Differential Revision: https://phab.mercurial-scm.org/D723
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 15 Sep 2017 10:43:22 -0700 |
parents | 448725a2ef73 |
children | e473f482b9b3 |
comparison
equal
deleted
inserted
replaced
34286:ecc96506c49d | 34287:7cdc8c5a481a |
---|---|
876 raise error.ParseError(_("mod expects two arguments")) | 876 raise error.ParseError(_("mod expects two arguments")) |
877 | 877 |
878 func = lambda a, b: a % b | 878 func = lambda a, b: a % b |
879 return runarithmetic(context, mapping, (func, args[0], args[1])) | 879 return runarithmetic(context, mapping, (func, args[0], args[1])) |
880 | 880 |
881 @templatefunc('obsfateoperations(markers)') | |
882 def obsfateoperations(context, mapping, args): | |
883 """Compute obsfate related information based on markers (EXPERIMENTAL)""" | |
884 if len(args) != 1: | |
885 # i18n: "obsfateoperations" is a keyword | |
886 raise error.ParseError(_("obsfateoperations expects one arguments")) | |
887 | |
888 markers = evalfuncarg(context, mapping, args[0]) | |
889 | |
890 try: | |
891 data = obsutil.markersoperations(markers) | |
892 return templatekw.hybridlist(data, name='operation') | |
893 except (TypeError, KeyError): | |
894 # i18n: "obsfateoperations" is a keyword | |
895 errmsg = _("obsfateoperations first argument should be an iterable") | |
896 raise error.ParseError(errmsg) | |
897 | |
881 @templatefunc('obsfatedate(markers)') | 898 @templatefunc('obsfatedate(markers)') |
882 def obsfatedate(context, mapping, args): | 899 def obsfatedate(context, mapping, args): |
883 """Compute obsfate related information based on markers (EXPERIMENTAL)""" | 900 """Compute obsfate related information based on markers (EXPERIMENTAL)""" |
884 if len(args) != 1: | 901 if len(args) != 1: |
885 # i18n: "obsfatedate" is a keyword | 902 # i18n: "obsfatedate" is a keyword |