Mercurial > hg
comparison mercurial/bookmarks.py @ 38538:2f7104984857
bookmarks: add support for log-like template keywords and functions
This is basically the same as 5d9b765dbe15 "tags: unblock log-like template
keywords and functions."
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 01 Jul 2018 22:22:07 +0900 |
parents | 04ceb267271a |
children | fbec9c0b32d3 |
comparison
equal
deleted
inserted
replaced
38537:a3be09e277e9 | 38538:2f7104984857 |
---|---|
921 Provides a way for extensions to control how bookmarks are printed (e.g. | 921 Provides a way for extensions to control how bookmarks are printed (e.g. |
922 prepend or postpend names) | 922 prepend or postpend names) |
923 """ | 923 """ |
924 opts = pycompat.byteskwargs(opts) | 924 opts = pycompat.byteskwargs(opts) |
925 fm = ui.formatter('bookmarks', opts) | 925 fm = ui.formatter('bookmarks', opts) |
926 contexthint = fm.contexthint('bookmark rev node active') | |
926 hexfn = fm.hexfunc | 927 hexfn = fm.hexfunc |
927 if len(bmarks) == 0 and fm.isplain(): | 928 if len(bmarks) == 0 and fm.isplain(): |
928 ui.status(_("no bookmarks set\n")) | 929 ui.status(_("no bookmarks set\n")) |
929 for bmark, (n, prefix, label) in sorted(bmarks.iteritems()): | 930 for bmark, (n, prefix, label) in sorted(bmarks.iteritems()): |
930 fm.startitem() | 931 fm.startitem() |
932 if 'ctx' in contexthint: | |
933 fm.context(ctx=repo[n]) | |
931 if not ui.quiet: | 934 if not ui.quiet: |
932 fm.plain(' %s ' % prefix, label=label) | 935 fm.plain(' %s ' % prefix, label=label) |
933 fm.write('bookmark', '%s', bmark, label=label) | 936 fm.write('bookmark', '%s', bmark, label=label) |
934 pad = " " * (25 - encoding.colwidth(bmark)) | 937 pad = " " * (25 - encoding.colwidth(bmark)) |
935 fm.condwrite(not ui.quiet, 'rev node', pad + ' %d:%s', | 938 fm.condwrite(not ui.quiet, 'rev node', pad + ' %d:%s', |