# HG changeset patch # User Boris Feld # Date 1505879253 -7200 # Node ID e45ec589f9621a7518b8657db2f0406409cbbbad # Parent 12b355964de8db35ad0a7c28c86d71fd225a8b9b 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 12b355964de8 -r e45ec589f962 mercurial/exchange.py --- a/mercurial/exchange.py Fri Sep 29 11:41:24 2017 -0700 +++ 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 12b355964de8 -r e45ec589f962 tests/test-treediscovery.t --- a/tests/test-treediscovery.t Fri Sep 29 11:41:24 2017 -0700 +++ 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