# HG changeset patch # User Pierre-Yves David # Date 2015-01-30 21:11:02 # Node ID 3b7088a5c64c6e4a4e9dc9859ad86986c151ab58 # Parent e484546a7c18293e5e3f9d883850b81265801c4f discovery: properly exclude locally known but filtered heads The conditional was a bit too narrow and produced buggy result when a node was present in both common and heads (because it pleased the discovery) and it was locally known but filtered. This resulted in buggy getbundle request and server side crash. diff --git a/mercurial/exchange.py b/mercurial/exchange.py --- a/mercurial/exchange.py +++ b/mercurial/exchange.py @@ -946,8 +946,9 @@ def _pulldiscoverychangegroup(pullop): scommon = set(common) filteredrheads = [] for n in rheads: - if n in nm and n not in scommon: - common.append(n) + if n in nm: + if n not in scommon: + common.append(n) else: filteredrheads.append(n) if not filteredrheads: diff --git a/tests/test-treediscovery.t b/tests/test-treediscovery.t --- a/tests/test-treediscovery.t +++ b/tests/test-treediscovery.t @@ -520,7 +520,7 @@ Both have new stuff in existing named br "GET /?cmd=heads HTTP/1.1" 200 - "GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961 "GET /?cmd=between HTTP/1.1" 200 - x-hgarg-1:pairs=d8f638ac69e9ae8dea4f09f11d696546a912d961-d57206cc072a18317c1e381fb60aa31bd3401785 - "GET /?cmd=changegroupsubset HTTP/1.1" 200 - x-hgarg-1:bases=d8f638ac69e9ae8dea4f09f11d696546a912d961&heads=d8f638ac69e9ae8dea4f09f11d696546a912d961+2c8d5d5ec612be65cdfdeac78b7662ab1696324a + "GET /?cmd=changegroupsubset HTTP/1.1" 200 - x-hgarg-1:bases=d8f638ac69e9ae8dea4f09f11d696546a912d961&heads=d8f638ac69e9ae8dea4f09f11d696546a912d961 "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases "GET /?cmd=capabilities HTTP/1.1" 200 - "GET /?cmd=heads HTTP/1.1" 200 -