Patchwork [2,of,7] push: check if local and remote support evolution during discovery

login
register
mail settings
Submitter Pierre-Yves David
Date Aug. 21, 2014, 3:20 a.m.
Message ID <2d424c3abcfb14aec61b.1408591252@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/5539/
State Accepted
Headers show

Comments

Pierre-Yves David - Aug. 21, 2014, 3:20 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1408581414 25200
#      Wed Aug 20 17:36:54 2014 -0700
# Node ID 2d424c3abcfb14aec61bf5d585cf847ea77e4470
# Parent  0cb2d84fd1f94e2d2088f4f2cd8a149360af6caa
push: check if local and remote support evolution during discovery

We can now directly prevent any evolution related operation to happen by using
an empty set as outgoing markers. So we detect if no transfers should occurs and
use an empty set in this case.

Patch

diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -278,11 +278,14 @@  def _pushdiscoveryphase(pushop):
     pushop.outdatedphases = future
     pushop.fallbackoutdatedphases = fallback
 
 @pushdiscovery('obsmarker')
 def _pushdiscoveryobsmarkers(pushop):
-    pushop.outobsmarkers = pushop.repo.obsstore
+    if (obsolete._enabled
+        and pushop.repo.obsstore
+        and 'obsolete' in pushop.remote.listkeys('namespaces')):
+        pushop.outobsmarkers = pushop.repo.obsstore
 
 @pushdiscovery('bookmarks')
 def _pushdiscoverybookmarks(pushop):
     ui = pushop.ui
     repo = pushop.repo.unfiltered()
@@ -650,12 +653,11 @@  def _pushobsolete(pushop):
         return
     pushop.ui.debug('try to push obsolete markers to remote\n')
     repo = pushop.repo
     remote = pushop.remote
     pushop.stepsdone.add('obsmarkers')
-    if (obsolete._enabled and repo.obsstore and
-        'obsolete' in remote.listkeys('namespaces')):
+    if (pushop.outobsmarkers):
         rslts = []
         remotedata = obsolete._pushkeyescape(pushop.outobsmarkers)
         for key in sorted(remotedata, reverse=True):
             # reverse sort to ensure we end with dump0
             data = remotedata[key]