changeset 25444:1d1fd5d44f57

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.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 01 Jun 2015 22:29:49 -0700
parents 443d3decbdde
children 1457c1f28c92
files mercurial/exchange.py
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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"""