changeset 25128:631766d1f57a

getbundle: sort bundlecaps before exchanging then over the wire The 'bundlecaps' argument is built as a set, we need to stabilise the order before exchanging them. Otherwise, in the test, http logs are unstable when the 'bundlecaps' contains something (eg: using bundle2).
author Pierre-Yves David <pierre-yves.david@fb.com>
date Sun, 10 May 2015 05:11:13 -0700
parents 2b9cda9040f7
children 40a2cf1c765b
files mercurial/wireproto.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/wireproto.py	Sun May 10 04:39:11 2015 -0700
+++ b/mercurial/wireproto.py	Sun May 10 05:11:13 2015 -0700
@@ -345,6 +345,11 @@
     def getbundle(self, source, **kwargs):
         self.requirecap('getbundle', _('look up remote changes'))
         opts = {}
+        bundlecaps = kwargs.get('bundlecaps')
+        if bundlecaps is not None:
+            kwargs['bundlecaps'] = sorted(bundlecaps)
+        else:
+            bundlecaps = () # kwargs could have it to None
         for key, value in kwargs.iteritems():
             if value is None:
                 continue
@@ -362,9 +367,6 @@
                                % keytype)
             opts[key] = value
         f = self._callcompressable("getbundle", **opts)
-        bundlecaps = kwargs.get('bundlecaps')
-        if bundlecaps is None:
-            bundlecaps = () # kwargs could have it to None
         if util.any((cap.startswith('HG2') for cap in bundlecaps)):
             return bundle2.getunbundler(self.ui, f)
         else: