comparison mercurial/commands.py @ 40037:fcad7fdc6474

identify: show remote bookmarks in `hg id url -Tjson -B` I didn't display bookmarks when `default and not ui.quiet`: it seems strange for templates to depend on --id or -q, and it would take more code for `hg id url -T {node}` to not request remote bookmarks. An alternative I thought of was providing lazy data to the formatter, `fm.data(bookmarks=lambda: fm.formatlist(getbms(), name='bookmark'))`. The plainformatter would naturally not compute it, the templateformatter would compute only what it needs, and the other ones would compute everything, but that's not supported (or I don't see how), so I abandoned this idea. Differential Revision: https://phab.mercurial-scm.org/D4872
author Valentin Gatien-Baron <vgatien-baron@janestreet.com>
date Wed, 03 Oct 2018 18:07:49 -0400
parents 1f12a3ad93f2
children 4fd0fac48922
comparison
equal deleted inserted replaced
40036:acf5dbe39478 40037:fcad7fdc6474
3109 bm = '/'.join(getbms()) 3109 bm = '/'.join(getbms())
3110 if bm: 3110 if bm:
3111 output.append(bm) 3111 output.append(bm)
3112 else: 3112 else:
3113 fm.data(node=hex(remoterev)) 3113 fm.data(node=hex(remoterev))
3114 if 'bookmarks' in fm.datahint(): 3114 if bookmarks or 'bookmarks' in fm.datahint():
3115 fm.data(bookmarks=fm.formatlist(getbms(), name='bookmark')) 3115 fm.data(bookmarks=fm.formatlist(getbms(), name='bookmark'))
3116 else: 3116 else:
3117 if rev: 3117 if rev:
3118 repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn') 3118 repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')
3119 ctx = scmutil.revsingle(repo, rev, None) 3119 ctx = scmutil.revsingle(repo, rev, None)