[PATCH 3 of 6] pull: skip pulling remote bookmarks with bundle1 if a value already exist

Pierre-Yves David pierre-yves.david at ens-lyon.org
Fri Jun 5 00:20:00 CDT 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1433222883 25200
#      Mon Jun 01 22:28:03 2015 -0700
# Node ID cc46b372650d7984942aee75d8d371a59507b511
# Parent  a7c932b591d591c9d02badda319b0924b215fb7d
pull: skip pulling remote bookmarks with bundle1 if a value already exist

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 first step toward this is to setup the logic avoiding pulling the data again
during the discovery phase if some have already been provided.

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -947,10 +947,12 @@ def _pulldiscovery(pullop):
 def _pullbookmarkbundle1(pullop):
     """fetch bookmark data in bundle1 case
 
     If not using bundle2, we have to fetch bookmarks before changeset
     discovery to reduce the chance and impact of race conditions."""
+    if pullop.remotebookmarks is not None:
+        return
     if not _canusebundle2(pullop): # all bundle2 server now support listkeys
         pullop.remotebookmarks = pullop.remote.listkeys('bookmarks')
 
 
 @pulldiscovery('changegroup')


More information about the Mercurial-devel mailing list