incoming: don't request heads that already are common
Pull would send a getbundle command where common heads were sent both as common
and head, even though there is no reason to request a common head.
The request was thus twice as big as necessary and more likely to hit HTTP
header size limits.
Instead, don't request heads that already are common.
This is fixed in bundlerepo.getremotechanges . It could perhaps also have been
fixed in discovery.findcommonincoming but that would have a bigger impact.
--- a/mercurial/bundlerepo.py Fri Aug 15 03:24:40 2014 +0200
+++ b/mercurial/bundlerepo.py Fri Aug 15 03:24:40 2014 +0200
@@ -357,6 +357,9 @@
pass
return repo, [], other.close
+ commonset = set(common)
+ rheads = [x for x in rheads if x not in commonset]
+
bundle = None
bundlerepo = None
localrepo = other.local()
--- a/tests/test-setdiscovery.t Fri Aug 15 03:24:40 2014 +0200
+++ b/tests/test-setdiscovery.t Fri Aug 15 03:24:40 2014 +0200
@@ -347,7 +347,7 @@
$ cut -d' ' -f6- access.log | grep -v cmd=known # cmd=known uses random sampling
"GET /?cmd=capabilities HTTP/1.1" 200 -
"GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D513314ca8b3ae4dac8eec56966265b00fcf866db
- "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=513314ca8b3ae4dac8eec56966265b00fcf866db&heads=e64a39e7da8b0d54bc63e81169aff001c13b3477+513314ca8b3ae4dac8eec56966265b00fcf866db
+ "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:common=513314ca8b3ae4dac8eec56966265b00fcf866db&heads=e64a39e7da8b0d54bc63e81169aff001c13b3477
$ cat errors.log
$ cd ..
--- a/tests/test-treediscovery.t Fri Aug 15 03:24:40 2014 +0200
+++ b/tests/test-treediscovery.t Fri Aug 15 03:24:40 2014 +0200
@@ -508,7 +508,7 @@
"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=capabilities HTTP/1.1" 200 -
"GET /?cmd=heads HTTP/1.1" 200 -
"GET /?cmd=branches HTTP/1.1" 200 - x-hgarg-1:nodes=d8f638ac69e9ae8dea4f09f11d696546a912d961