Mercurial > hg
comparison mercurial/templatekw.py @ 38774:87a581d1391c
templatekw: use ctx1.status(ctx2) instead of repo.status(ctx1, ctx2)
Differential Revision: https://phab.mercurial-scm.org/D4001
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 27 Jul 2018 14:48:58 -0700 |
parents | 1c93e0237a24 |
children | 390287321b4b |
comparison
equal
deleted
inserted
replaced
38773:59af0c7d103f | 38774:87a581d1391c |
---|---|
291 f = _showcompatlist(context, mapping, 'extra', c, plural='extras') | 291 f = _showcompatlist(context, mapping, 'extra', c, plural='extras') |
292 return _hybrid(f, extras, makemap, | 292 return _hybrid(f, extras, makemap, |
293 lambda k: '%s=%s' % (k, stringutil.escapestr(extras[k]))) | 293 lambda k: '%s=%s' % (k, stringutil.escapestr(extras[k]))) |
294 | 294 |
295 def _showfilesbystat(context, mapping, name, index): | 295 def _showfilesbystat(context, mapping, name, index): |
296 repo = context.resource(mapping, 'repo') | |
297 ctx = context.resource(mapping, 'ctx') | 296 ctx = context.resource(mapping, 'ctx') |
298 revcache = context.resource(mapping, 'revcache') | 297 revcache = context.resource(mapping, 'revcache') |
299 if 'files' not in revcache: | 298 if 'files' not in revcache: |
300 revcache['files'] = repo.status(ctx.p1(), ctx)[:3] | 299 revcache['files'] = ctx.p1().status(ctx)[:3] |
301 files = revcache['files'][index] | 300 files = revcache['files'][index] |
302 return compatlist(context, mapping, name, files, element='file') | 301 return compatlist(context, mapping, name, files, element='file') |
303 | 302 |
304 @templatekeyword('file_adds', requires={'repo', 'ctx', 'revcache'}) | 303 @templatekeyword('file_adds', requires={'ctx', 'revcache'}) |
305 def showfileadds(context, mapping): | 304 def showfileadds(context, mapping): |
306 """List of strings. Files added by this changeset.""" | 305 """List of strings. Files added by this changeset.""" |
307 return _showfilesbystat(context, mapping, 'file_add', 1) | 306 return _showfilesbystat(context, mapping, 'file_add', 1) |
308 | 307 |
309 @templatekeyword('file_copies', | 308 @templatekeyword('file_copies', |
343 copies = util.sortdict(copies) | 342 copies = util.sortdict(copies) |
344 return compatdict(context, mapping, 'file_copy', copies, | 343 return compatdict(context, mapping, 'file_copy', copies, |
345 key='name', value='source', fmt='%s (%s)', | 344 key='name', value='source', fmt='%s (%s)', |
346 plural='file_copies') | 345 plural='file_copies') |
347 | 346 |
348 @templatekeyword('file_dels', requires={'repo', 'ctx', 'revcache'}) | 347 @templatekeyword('file_dels', requires={'ctx', 'revcache'}) |
349 def showfiledels(context, mapping): | 348 def showfiledels(context, mapping): |
350 """List of strings. Files removed by this changeset.""" | 349 """List of strings. Files removed by this changeset.""" |
351 return _showfilesbystat(context, mapping, 'file_del', 2) | 350 return _showfilesbystat(context, mapping, 'file_del', 2) |
352 | 351 |
353 @templatekeyword('file_mods', requires={'repo', 'ctx', 'revcache'}) | 352 @templatekeyword('file_mods', requires={'ctx', 'revcache'}) |
354 def showfilemods(context, mapping): | 353 def showfilemods(context, mapping): |
355 """List of strings. Files modified by this changeset.""" | 354 """List of strings. Files modified by this changeset.""" |
356 return _showfilesbystat(context, mapping, 'file_mod', 0) | 355 return _showfilesbystat(context, mapping, 'file_mod', 0) |
357 | 356 |
358 @templatekeyword('files', requires={'ctx'}) | 357 @templatekeyword('files', requires={'ctx'}) |