163 ui = context.resource(mapping, 'ui') |
166 ui = context.resource(mapping, 'ui') |
164 node = evalstring(context, mapping, args[0]) |
167 node = evalstring(context, mapping, args[0]) |
165 if ui.debugflag: |
168 if ui.debugflag: |
166 return node |
169 return node |
167 return templatefilters.short(node) |
170 return templatefilters.short(node) |
|
171 |
|
172 @templatefunc('mailmap(author)') |
|
173 def mailmap(context, mapping, args): |
|
174 """Return the author, updated according to the value |
|
175 set in the .mailmap file""" |
|
176 if len(args) != 1: |
|
177 raise error.ParseError(_("mailmap expects one argument")) |
|
178 |
|
179 author = evalfuncarg(context, mapping, args[0]) |
|
180 |
|
181 cache = context.resource(mapping, 'cache') |
|
182 repo = context.resource(mapping, 'repo') |
|
183 |
|
184 if 'mailmap' not in cache: |
|
185 data = repo.wvfs.tryread('.mailmap') |
|
186 cache['mailmap'] = stringutil.parsemailmap(data) |
|
187 |
|
188 return stringutil.mapname(cache['mailmap'], author) or author |
168 |
189 |
169 @templatefunc('pad(text, width[, fillchar=\' \'[, left=False]])', |
190 @templatefunc('pad(text, width[, fillchar=\' \'[, left=False]])', |
170 argspec='text width fillchar left') |
191 argspec='text width fillchar left') |
171 def pad(context, mapping, args): |
192 def pad(context, mapping, args): |
172 """Pad text with a |
193 """Pad text with a |