<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 17, 2019 at 10:07 AM Pierre-Yves David <<a href="mailto:pierre-yves.david@ens-lyon.org">pierre-yves.david@ens-lyon.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"># HG changeset patch<br>
# User Pierre-Yves David <<a href="mailto:pierre-yves.david@octobus.net" target="_blank">pierre-yves.david@octobus.net</a>><br>
# Date 1555516590 -7200<br>
#      Wed Apr 17 17:56:30 2019 +0200<br>
# Node ID 6882a0101d389e27d697bf2e9717de176f273309<br>
# Parent  607a0de9bae31df526da75b68ab2853787d8c31e<br>
# EXP-Topic discovery-speedup<br>
# Available At <a href="https://bitbucket.org/octobus/mercurial-devel/" rel="noreferrer" target="_blank">https://bitbucket.org/octobus/mercurial-devel/</a><br>
#              hg pull <a href="https://bitbucket.org/octobus/mercurial-devel/" rel="noreferrer" target="_blank">https://bitbucket.org/octobus/mercurial-devel/</a> -r 6882a0101d38<br>
peer: introduce a limitedarguments attributes<br>
<br>
When set to True, it signal that the peer cannot receive too larges arguments<br>
and that algorithm must adapt. This should only be True for http peer that does<br>
not support argument passed as "post".<br>
<br>
This will be useful to unlock better discovery performance in the next<br>
changesets.<br>
<br>
I am using a dedicated argument because this is not really a usual<br>
"capabilities" things. An alternative approach would be to adds a<br>
"large-arguments" to all peer, but the http peers. That seemed a bit too hacky<br>
to me.<br>
<br>
diff --git a/mercurial/httppeer.py b/mercurial/httppeer.py<br>
--- a/mercurial/httppeer.py<br>
+++ b/mercurial/httppeer.py<br>
@@ -382,6 +382,7 @@ class httppeer(wireprotov1peer.wirepeer)<br>
         self._path = path<br>
         self._url = url<br>
         self._caps = caps<br>
+        self.limitedarguments = caps is not None and 'httppostargs' not in caps<br></blockquote><div><br></div><div>Is `'httppostargs' not in caps` enough to know that httppostargs will be used for the "heads" request? As I said in an earlier email, I'm not sure it will be respected for GET requests (and "heads" is a GET request, right?). Did you check that this will not result in a GET request?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
         self._urlopener = opener<br>
         self._requestbuilder = requestbuilder<br>
<br>
@@ -750,6 +751,9 @@ class httpv2executor(object):<br>
<br>
 @interfaceutil.implementer(repository.ipeerv2)<br>
 class httpv2peer(object):<br>
+<br>
+    limitedarguments = False<br>
+<br>
     def __init__(self, ui, repourl, apipath, opener, requestbuilder,<br>
                  apidescriptor):<br>
         self.ui = ui<br>
diff --git a/mercurial/repository.py b/mercurial/repository.py<br>
--- a/mercurial/repository.py<br>
+++ b/mercurial/repository.py<br>
@@ -291,6 +291,10 @@ class ipeercommandexecutor(interfaceutil<br>
 class ipeerrequests(interfaceutil.Interface):<br>
     """Interface for executing commands on a peer."""<br>
<br>
+    limitedarguments = interfaceutil.Attribute(<br>
+        """True if the peer cannot receive large argument value for commands."""<br>
+    )<br>
+<br>
     def commandexecutor():<br>
         """A context manager that resolves to an ipeercommandexecutor.<br>
<br>
@@ -329,6 +333,8 @@ class ipeerv2(ipeerconnection, ipeercapa<br>
 class peer(object):<br>
     """Base class for peer repositories."""<br>
<br>
+    limitedarguments = False<br>
+<br>
     def capable(self, name):<br>
         caps = self.capabilities()<br>
         if name in caps:<br>
</blockquote></div></div>