[PATCH 1 of 7 bundle2] discovery: avoid dropping remote heads hidden locally

Boris Feld boris.feld at octobus.net
Thu Sep 28 05:08:36 UTC 2017


# HG changeset patch
# User Boris Feld <boris.feld at octobus.net>
# Date 1505879253 -7200
#      Wed Sep 20 05:47:33 2017 +0200
# Node ID 5458212fddf54bad3e7590e2ea2600073597044e
# Parent  2d0c306a88c226d96cf29036b6d6b08bd0abc3b4
# EXP-Topic b2.phases
discovery: avoid dropping remote heads hidden locally

An extra post processing was added to recognize remote heads that are hidden
locally as "common" instead of "unknown". However, this processing was
removing such hidden heads from the remote heads sets.

It had no impact because we used to pull phase information from all remote
heads.

This series will replace the phase pulling operation to a more efficient
process but requires the unmodified pulled set information.

diff -r 2d0c306a88c2 -r 5458212fddf5 mercurial/exchange.py
--- a/mercurial/exchange.py	Tue Sep 26 16:14:57 2017 +0300
+++ b/mercurial/exchange.py	Wed Sep 20 05:47:33 2017 +0200
@@ -1313,8 +1313,7 @@
     common, fetch, rheads = tmp
     nm = pullop.repo.unfiltered().changelog.nodemap
     if fetch and rheads:
-        # If a remote heads in filtered locally, lets drop it from the unknown
-        # remote heads and put in back in common.
+        # If a remote heads is filtered locally, put in back in common.
         #
         # This is a hackish solution to catch most of "common but locally
         # hidden situation".  We do not performs discovery on unfiltered
@@ -1324,16 +1323,12 @@
         # If a set of such "common but filtered" changeset exist on the server
         # but are not including a remote heads, we'll not be able to detect it,
         scommon = set(common)
-        filteredrheads = []
         for n in rheads:
             if n in nm:
                 if n not in scommon:
                     common.append(n)
-            else:
-                filteredrheads.append(n)
-        if not filteredrheads:
+        if set(rheads).issubset(set(common)):
             fetch = []
-        rheads = filteredrheads
     pullop.common = common
     pullop.fetch = fetch
     pullop.rheads = rheads
diff -r 2d0c306a88c2 -r 5458212fddf5 tests/test-treediscovery.t
--- a/tests/test-treediscovery.t	Tue Sep 26 16:14:57 2017 +0300
+++ b/tests/test-treediscovery.t	Wed Sep 20 05:47:33 2017 +0200
@@ -520,7 +520,7 @@
   "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
   "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961 x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
   "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785 x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
-  "GET /?cmd=changegroupsubset HTTP/1.1" 200 - x-hgarg-1:bases=d8f638ac69e9ae8dea4f09f11d696546a912d961&heads=d8f638ac69e9ae8dea4f09f11d696546a912d961 x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
+  "GET /?cmd=changegroupsubset HTTP/1.1" 200 - x-hgarg-1:bases=d8f638ac69e9ae8dea4f09f11d696546a912d961&heads=d8f638ac69e9ae8dea4f09f11d696546a912d961+2c8d5d5ec612be65cdfdeac78b7662ab1696324a x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
   "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2
   "GET /?cmd=capabilities HTTP/1.1" 200 -
   "GET /?cmd=heads HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=zstd,zlib,none,bzip2


More information about the Mercurial-devel mailing list