##// END OF EJS Templates
templatefuncs: show hint if extdata source is evaluated to empty (issue5843)
Yuya Nishihara -
r37950:faa41fd2 default
parent child Browse files
Show More
@@ -113,6 +113,13 b' def extdata(context, mapping, args):'
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:
@@ -82,6 +82,13 b' test bad extdata() template source'
82 $ hg log -T "{extdata('unknown')}\n"
82 $ hg log -T "{extdata('unknown')}\n"
83 abort: unknown extdata source 'unknown'
83 abort: unknown extdata source 'unknown'
84 [255]
84 [255]
85 $ hg log -T "{extdata(unknown)}\n"
86 hg: parse error: empty data source specified
87 (did you mean extdata('unknown')?)
88 [255]
89 $ hg log -T "{extdata('{unknown}')}\n"
90 hg: parse error: empty data source specified
91 [255]
85
92
86 we don't fix up relative file URLs, but we do run shell commands in repo root
93 we don't fix up relative file URLs, but we do run shell commands in repo root
87
94
General Comments 0
You need to be logged in to leave comments. Login now