incoming: don't request heads that already are common stable
authorMads Kiilerich <madski@unity3d.com>
Fri, 15 Aug 2014 03:24:40 +0200
branchstable
changeset 22182 510cafe72004
parent 22181 851db07bb2de
child 22207 8dda6f6ff564
child 22281 05ea941aafdc
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.
mercurial/bundlerepo.py
tests/test-setdiscovery.t
tests/test-treediscovery.t
--- 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