[PATCH 4 of 4 main-line-of-work] getbundle: sort bundlecaps before exchanging then over the wire
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Fri May 15 20:45:37 CDT 2015
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1431259873 25200
# Sun May 10 05:11:13 2015 -0700
# Node ID dfe2bac65fb1d4b6cdd3a95f116ce7822614912d
# Parent c66322e088ae697101200a961480c5f8ff171997
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).
diff --git a/mercurial/wireproto.py b/mercurial/wireproto.py
--- a/mercurial/wireproto.py
+++ b/mercurial/wireproto.py
@@ -343,10 +343,15 @@ class wirepeer(peer.peerrepository):
return changegroupmod.cg1unpacker(f, 'UN')
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
keytype = gboptsmap.get(key)
if keytype is None:
@@ -360,13 +365,10 @@ class wirepeer(peer.peerrepository):
elif keytype != 'plain':
raise KeyError('unknown getbundle option type %s'
% 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:
return changegroupmod.cg1unpacker(f, 'UN')
More information about the Mercurial-devel
mailing list