Details
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHG87a581d1391c: templatekw: use ctx1.status(ctx2) instead of repo.status(ctx1, ctx2)
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
( )
| indygreg |
| hg-reviewers |
| Lint Skipped |
| Unit Tests Skipped |
| Path | Packages | |||
|---|---|---|---|---|
| M | mercurial/templatekw.py (9 lines) |
| Commit | Parents | Author | Summary | Date |
|---|---|---|---|---|
| Martin von Zweigbergk | Jul 27 2018, 5:48 PM |
| Status | Author | Revision | |
|---|---|---|---|
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz | ||
| Closed | martinvonz |
| extras = util.sortdict((k, extras[k]) for k in sorted(extras)) | extras = util.sortdict((k, extras[k]) for k in sorted(extras)) | ||||
| makemap = lambda k: {'key': k, 'value': extras[k]} | makemap = lambda k: {'key': k, 'value': extras[k]} | ||||
| c = [makemap(k) for k in extras] | c = [makemap(k) for k in extras] | ||||
| f = _showcompatlist(context, mapping, 'extra', c, plural='extras') | f = _showcompatlist(context, mapping, 'extra', c, plural='extras') | ||||
| return _hybrid(f, extras, makemap, | return _hybrid(f, extras, makemap, | ||||
| lambda k: '%s=%s' % (k, stringutil.escapestr(extras[k]))) | lambda k: '%s=%s' % (k, stringutil.escapestr(extras[k]))) | ||||
| def _showfilesbystat(context, mapping, name, index): | def _showfilesbystat(context, mapping, name, index): | ||||
| repo = context.resource(mapping, 'repo') | |||||
| ctx = context.resource(mapping, 'ctx') | ctx = context.resource(mapping, 'ctx') | ||||
| revcache = context.resource(mapping, 'revcache') | revcache = context.resource(mapping, 'revcache') | ||||
| if 'files' not in revcache: | if 'files' not in revcache: | ||||
| revcache['files'] = repo.status(ctx.p1(), ctx)[:3] | revcache['files'] = ctx.p1().status(ctx)[:3] | ||||
| files = revcache['files'][index] | files = revcache['files'][index] | ||||
| return compatlist(context, mapping, name, files, element='file') | return compatlist(context, mapping, name, files, element='file') | ||||
| @templatekeyword('file_adds', requires={'repo', 'ctx', 'revcache'}) | @templatekeyword('file_adds', requires={'ctx', 'revcache'}) | ||||
| def showfileadds(context, mapping): | def showfileadds(context, mapping): | ||||
| """List of strings. Files added by this changeset.""" | """List of strings. Files added by this changeset.""" | ||||
| return _showfilesbystat(context, mapping, 'file_add', 1) | return _showfilesbystat(context, mapping, 'file_add', 1) | ||||
| @templatekeyword('file_copies', | @templatekeyword('file_copies', | ||||
| requires={'repo', 'ctx', 'cache', 'revcache'}) | requires={'repo', 'ctx', 'cache', 'revcache'}) | ||||
| def showfilecopies(context, mapping): | def showfilecopies(context, mapping): | ||||
| """List of strings. Files copied in this changeset with | """List of strings. Files copied in this changeset with | ||||
| only if the --copied switch is set. | only if the --copied switch is set. | ||||
| """ | """ | ||||
| copies = context.resource(mapping, 'revcache').get('copies') or [] | copies = context.resource(mapping, 'revcache').get('copies') or [] | ||||
| copies = util.sortdict(copies) | copies = util.sortdict(copies) | ||||
| return compatdict(context, mapping, 'file_copy', copies, | return compatdict(context, mapping, 'file_copy', copies, | ||||
| key='name', value='source', fmt='%s (%s)', | key='name', value='source', fmt='%s (%s)', | ||||
| plural='file_copies') | plural='file_copies') | ||||
| @templatekeyword('file_dels', requires={'repo', 'ctx', 'revcache'}) | @templatekeyword('file_dels', requires={'ctx', 'revcache'}) | ||||
| def showfiledels(context, mapping): | def showfiledels(context, mapping): | ||||
| """List of strings. Files removed by this changeset.""" | """List of strings. Files removed by this changeset.""" | ||||
| return _showfilesbystat(context, mapping, 'file_del', 2) | return _showfilesbystat(context, mapping, 'file_del', 2) | ||||
| @templatekeyword('file_mods', requires={'repo', 'ctx', 'revcache'}) | @templatekeyword('file_mods', requires={'ctx', 'revcache'}) | ||||
| def showfilemods(context, mapping): | def showfilemods(context, mapping): | ||||
| """List of strings. Files modified by this changeset.""" | """List of strings. Files modified by this changeset.""" | ||||
| return _showfilesbystat(context, mapping, 'file_mod', 0) | return _showfilesbystat(context, mapping, 'file_mod', 0) | ||||
| @templatekeyword('files', requires={'ctx'}) | @templatekeyword('files', requires={'ctx'}) | ||||
| def showfiles(context, mapping): | def showfiles(context, mapping): | ||||
| """List of strings. All files modified, added, or removed by this | """List of strings. All files modified, added, or removed by this | ||||
| changeset. | changeset. | ||||