pull: only list remote bookmarks if -B is used to populate pulled heads
authorPierre-Yves David <pierre-yves.david@fb.com>
Thu, 28 May 2015 13:55:03 -0700
changeset 25367 d0f1d8b4de57
parent 25365 4cc3fb23881d
child 25368 ae38370fe282
pull: only list remote bookmarks if -B is used to populate pulled heads Listing remote bookmarks results in network traffic and latency. This should be avoided when possible.
mercurial/commands.py
tests/test-ssh.t
tests/test-treediscovery.t
--- a/mercurial/commands.py	Sat May 30 12:46:30 2015 +0900
+++ b/mercurial/commands.py	Thu May 28 13:55:03 2015 -0700
@@ -5119,11 +5119,11 @@
         revs, checkout = hg.addbranchrevs(repo, other, branches,
                                           opts.get('rev'))
 
-        remotebookmarks = other.listkeys('bookmarks')
 
         if opts.get('bookmark'):
             if not revs:
                 revs = []
+            remotebookmarks = other.listkeys('bookmarks')
             for b in opts['bookmark']:
                 if b not in remotebookmarks:
                     raise util.Abort(_('remote bookmark %s not found!') % b)
--- a/tests/test-ssh.t	Sat May 30 12:46:30 2015 +0900
+++ b/tests/test-ssh.t	Thu May 28 13:55:03 2015 -0700
@@ -458,9 +458,6 @@
   preparing listkeys for "bookmarks"
   sending listkeys command
   received listkey for "bookmarks": 45 bytes
-  preparing listkeys for "bookmarks"
-  sending listkeys command
-  received listkey for "bookmarks": 45 bytes
   query 1; heads
   sending batch command
   searching for changes
--- a/tests/test-treediscovery.t	Sat May 30 12:46:30 2015 +0900
+++ b/tests/test-treediscovery.t	Thu May 28 13:55:03 2015 -0700
@@ -516,7 +516,6 @@
   "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785
   "GET /?cmd=capabilities HTTP/1.1" 200 -
   "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
-  "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks
   "GET /?cmd=heads HTTP/1.1" 200 -
   "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961
   "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785