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

login
register
mail settings
Submitter Pierre-Yves David
Date June 5, 2015, 5:20 a.m.
Message ID <cc46b372650d7984942a.1433481600@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/9511/
State Accepted
Headers show

Comments

Pierre-Yves David - June 5, 2015, 5:20 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@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.

Patch

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')