changeset 39989:c9026e9297e3

identify: only query remote bookmarks if needed Instead of all the time when operating on a remote repo. This perf regression was introduced in 15a79ac823e8, in 4.3. This datahint method returns nothing for -Tjson, -Tpickle, -Tdebug --config ui.formatdebug=true and --config ui.formatjson, so the bookmarks won't show up. I don't know what these formatters are for. plainformatter and templateformatter work properly, and the few other uses of datahint should have the same kind of problem. There is further weirdness where "--template '{node}'" is not enough to avoid querying the bookmarks, you also need to pass --id or -q. Differential Revision: https://phab.mercurial-scm.org/D4819
author Valentin Gatien-Baron <vgatien-baron@janestreet.com>
date Mon, 01 Oct 2018 09:58:42 -0400
parents a8ec8bce14c6
children a91398dc73ab
files mercurial/commands.py
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Oct 03 13:59:19 2018 +0300
+++ b/mercurial/commands.py	Mon Oct 01 09:58:42 2018 -0400
@@ -3023,6 +3023,7 @@
             output = [hexrev]
         fm.data(id=hexrev)
 
+        @util.cachefunc
         def getbms():
             bms = []
 
@@ -3033,17 +3034,17 @@
 
             return sorted(bms)
 
-        bms = getbms()
         if bookmarks:
-            output.extend(bms)
+            output.extend(getbms())
         elif default and not ui.quiet:
             # multiple bookmarks for a single parent separated by '/'
-            bm = '/'.join(bms)
+            bm = '/'.join(getbms())
             if bm:
                 output.append(bm)
 
         fm.data(node=hex(remoterev))
-        fm.data(bookmarks=fm.formatlist(bms, name='bookmark'))
+        if 'bookmarks' in fm.datahint():
+            fm.data(bookmarks=fm.formatlist(getbms(), name='bookmark'))
     else:
         if rev:
             repo = scmutil.unhidehashlikerevs(repo, [rev], 'nowarn')