D4872: identify: show remote bookmarks in `hg id url -Tjson -B`

valentin.gatienbaron (Valentin Gatien-Baron) phabricator at mercurial-scm.org
Wed Oct 3 22:20:00 UTC 2018


valentin.gatienbaron created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4872

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -3044,7 +3044,7 @@
                     output.append(bm)
         else:
             fm.data(node=hex(remoterev))
-            if 'bookmarks' in fm.datahint():
+            if bookmarks or 'bookmarks' in fm.datahint():
                 fm.data(bookmarks=fm.formatlist(getbms(), name='bookmark'))
     else:
         if rev:



To: valentin.gatienbaron, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list