Mercurial > public > mercurial-scm > hg
comparison mercurial/wireproto.py @ 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 | 0c4d5e01b31f |
children | 3f0744eeaeaf |
comparison
equal
deleted
inserted
replaced
25127:2b9cda9040f7 | 25128:631766d1f57a |
---|---|
343 return changegroupmod.cg1unpacker(f, 'UN') | 343 return changegroupmod.cg1unpacker(f, 'UN') |
344 | 344 |
345 def getbundle(self, source, **kwargs): | 345 def getbundle(self, source, **kwargs): |
346 self.requirecap('getbundle', _('look up remote changes')) | 346 self.requirecap('getbundle', _('look up remote changes')) |
347 opts = {} | 347 opts = {} |
348 bundlecaps = kwargs.get('bundlecaps') | |
349 if bundlecaps is not None: | |
350 kwargs['bundlecaps'] = sorted(bundlecaps) | |
351 else: | |
352 bundlecaps = () # kwargs could have it to None | |
348 for key, value in kwargs.iteritems(): | 353 for key, value in kwargs.iteritems(): |
349 if value is None: | 354 if value is None: |
350 continue | 355 continue |
351 keytype = gboptsmap.get(key) | 356 keytype = gboptsmap.get(key) |
352 if keytype is None: | 357 if keytype is None: |
360 elif keytype != 'plain': | 365 elif keytype != 'plain': |
361 raise KeyError('unknown getbundle option type %s' | 366 raise KeyError('unknown getbundle option type %s' |
362 % keytype) | 367 % keytype) |
363 opts[key] = value | 368 opts[key] = value |
364 f = self._callcompressable("getbundle", **opts) | 369 f = self._callcompressable("getbundle", **opts) |
365 bundlecaps = kwargs.get('bundlecaps') | |
366 if bundlecaps is None: | |
367 bundlecaps = () # kwargs could have it to None | |
368 if util.any((cap.startswith('HG2') for cap in bundlecaps)): | 370 if util.any((cap.startswith('HG2') for cap in bundlecaps)): |
369 return bundle2.getunbundler(self.ui, f) | 371 return bundle2.getunbundler(self.ui, f) |
370 else: | 372 else: |
371 return changegroupmod.cg1unpacker(f, 'UN') | 373 return changegroupmod.cg1unpacker(f, 'UN') |
372 | 374 |