comparison mercurial/templatefuncs.py @ 37931:faa41fd282d1

templatefuncs: show hint if extdata source is evaluated to empty (issue5843)
author Yuya Nishihara <yuya@tcha.org>
date Thu, 19 Apr 2018 21:00:12 +0900
parents da083d9fafab
children bd7a3fa71a72
comparison
equal deleted inserted replaced
37930:892592475094 37931:faa41fd282d1
111 if 'source' not in args: 111 if 'source' not in args:
112 # i18n: "extdata" is a keyword 112 # i18n: "extdata" is a keyword
113 raise error.ParseError(_('extdata expects one argument')) 113 raise error.ParseError(_('extdata expects one argument'))
114 114
115 source = evalstring(context, mapping, args['source']) 115 source = evalstring(context, mapping, args['source'])
116 if not source:
117 sym = templateutil.findsymbolicname(args['source'])
118 if sym:
119 raise error.ParseError(_('empty data source specified'),
120 hint=_("did you mean extdata('%s')?") % sym)
121 else:
122 raise error.ParseError(_('empty data source specified'))
116 cache = context.resource(mapping, 'cache').setdefault('extdata', {}) 123 cache = context.resource(mapping, 'cache').setdefault('extdata', {})
117 ctx = context.resource(mapping, 'ctx') 124 ctx = context.resource(mapping, 'ctx')
118 if source in cache: 125 if source in cache:
119 data = cache[source] 126 data = cache[source]
120 else: 127 else: