pull: skip pulling remote bookmarks with bundle2 if a value already exists
authorPierre-Yves David <pierre-yves.david@fb.com>
Mon, 01 Jun 2015 22:29:49 -0700
changeset 25444 1d1fd5d44f57
parent 25443 443d3decbdde
child 25445 1457c1f28c92
pull: skip pulling remote bookmarks with bundle2 if a value already exists For efficiency and consistency purpose, remote bookmarks, retrieved at the time the pull command code is doing lookup, will be reused during the core pull operation. A second step toward this is to avoid requesting bookmark information in the bundle 2 if we already have them locally.
mercurial/exchange.py
--- a/mercurial/exchange.py	Mon Jun 01 22:28:03 2015 -0700
+++ b/mercurial/exchange.py	Mon Jun 01 22:29:49 2015 -0700
@@ -1006,7 +1006,11 @@
     kwargs['heads'] = pullop.heads or pullop.rheads
     kwargs['cg'] = pullop.fetch
     if 'listkeys' in remotecaps:
-        kwargs['listkeys'] = ['phase', 'bookmarks']
+        kwargs['listkeys'] = ['phase']
+        if pullop.remotebookmarks is None:
+            # make sure to always includes bookmark data when migrating
+            # `hg incoming --bundle` to using this function.
+            kwargs['listkeys'].append('bookmarks')
     if not pullop.fetch:
         pullop.repo.ui.status(_("no changes found\n"))
         pullop.cgresult = 0
@@ -1038,7 +1042,10 @@
     for namespace, value in op.records['listkeys']:
         if namespace == 'bookmarks':
             pullop.remotebookmarks = value
-            _pullbookmarks(pullop)
+
+    # bookmark data were either already there or pulled in the bundle
+    if pullop.remotebookmarks is not None:
+        _pullbookmarks(pullop)
 
 def _pullbundle2extraprepare(pullop, kwargs):
     """hook function so that extensions can extend the getbundle call"""