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') |
|
927 hexfn = fm.hexfunc |
926 hexfn = fm.hexfunc |
928 if len(bmarks) == 0 and fm.isplain(): |
927 if len(bmarks) == 0 and fm.isplain(): |
929 ui.status(_("no bookmarks set\n")) |
928 ui.status(_("no bookmarks set\n")) |
930 for bmark, (n, prefix, label) in sorted(bmarks.iteritems()): |
929 for bmark, (n, prefix, label) in sorted(bmarks.iteritems()): |
931 fm.startitem() |
930 fm.startitem() |
932 if 'ctx' in contexthint: |
931 fm.context(repo=repo) |
933 fm.context(ctx=repo[n]) |
|
934 if not ui.quiet: |
932 if not ui.quiet: |
935 fm.plain(' %s ' % prefix, label=label) |
933 fm.plain(' %s ' % prefix, label=label) |
936 fm.write('bookmark', '%s', bmark, label=label) |
934 fm.write('bookmark', '%s', bmark, label=label) |
937 pad = " " * (25 - encoding.colwidth(bmark)) |
935 pad = " " * (25 - encoding.colwidth(bmark)) |
938 fm.condwrite(not ui.quiet, 'rev node', pad + ' %d:%s', |
936 fm.condwrite(not ui.quiet, 'rev node', pad + ' %d:%s', |