##// END OF EJS Templates
bundle2: use HG2X in the header...
Pierre-Yves David -
r21144:7a20fe8d default
parent child Browse files
Show More
@@ -151,7 +151,7 b' from i18n import _'
151 151 _pack = struct.pack
152 152 _unpack = struct.unpack
153 153
154 _magicstring = 'HG20'
154 _magicstring = 'HG2X'
155 155
156 156 _fstreamparamsize = '>H'
157 157 _fpartheadersize = '>H'
@@ -456,7 +456,7 b' class unbundle20(unpackermixin):'
456 456 magic, version = header[0:2], header[2:4]
457 457 if magic != 'HG':
458 458 raise util.Abort(_('not a Mercurial bundle'))
459 if version != '20':
459 if version != '2X':
460 460 raise util.Abort(_('unknown bundle version %s') % version)
461 461 self.ui.debug('start processing of %s stream\n' % header)
462 462
@@ -32,7 +32,7 b' def readbundle(ui, fh, fname, vfs=None):'
32 32 if alg is None:
33 33 alg = changegroup.readexactly(fh, 2)
34 34 return changegroup.unbundle10(fh, alg)
35 elif version == '20':
35 elif version == '2X':
36 36 return bundle2.unbundle20(ui, fh, header=magic + version)
37 37 else:
38 38 raise util.Abort(_('%s: unknown bundle version %s') % (fname, version))
@@ -545,7 +545,7 b' def _pullbundle2(pullop):'
545 545 """pull data using bundle2
546 546
547 547 For now, the only supported data are changegroup."""
548 kwargs = {'bundlecaps': set(['HG20'])}
548 kwargs = {'bundlecaps': set(['HG2X'])}
549 549 capsblob = bundle2.encodecaps(pullop.repo.bundle2caps)
550 550 kwargs['bundlecaps'].add('bundle2=' + urllib.quote(capsblob))
551 551 # pulling changegroup
@@ -644,7 +644,7 b' def _pullobsolete(pullop):'
644 644 def getbundle(repo, source, heads=None, common=None, bundlecaps=None):
645 645 """return a full bundle (with potentially multiple kind of parts)
646 646
647 Could be a bundle HG10 or a bundle HG20 depending on bundlecaps
647 Could be a bundle HG10 or a bundle HG2X depending on bundlecaps
648 648 passed. For now, the bundle can contain only changegroup, but this will
649 649 changes when more part type will be available for bundle2.
650 650
@@ -658,7 +658,7 b' def getbundle(repo, source, heads=None, '
658 658 # build bundle here.
659 659 cg = changegroup.getbundle(repo, source, heads=heads,
660 660 common=common, bundlecaps=bundlecaps)
661 if bundlecaps is None or 'HG20' not in bundlecaps:
661 if bundlecaps is None or 'HG2X' not in bundlecaps:
662 662 return cg
663 663 # very crude first implementation,
664 664 # the bundle API will change and the generation will be done lazily.
@@ -109,7 +109,7 b' class localpeer(peer.peerrepository):'
109 109 format='HG10'):
110 110 cg = exchange.getbundle(self._repo, source, heads=heads,
111 111 common=common, bundlecaps=bundlecaps)
112 if bundlecaps is not None and 'HG20' in bundlecaps:
112 if bundlecaps is not None and 'HG2X' in bundlecaps:
113 113 # When requesting a bundle2, getbundle returns a stream to make the
114 114 # wire level function happier. We need to build a proper object
115 115 # from it in local peer.
@@ -180,7 +180,7 b' class localrepository(object):'
180 180 requirements = ['revlogv1']
181 181 filtername = None
182 182
183 bundle2caps = {'HG20': ()}
183 bundle2caps = {'HG2X': ()}
184 184
185 185 # a list of (ui, featureset) functions.
186 186 # only functions defined in module of enabled extensions are invoked
@@ -335,7 +335,7 b' class wirepeer(peer.peerrepository):'
335 335 if bundlecaps is not None:
336 336 opts['bundlecaps'] = ','.join(bundlecaps)
337 337 f = self._callcompressable("getbundle", **opts)
338 if bundlecaps is not None and 'HG20' in bundlecaps:
338 if bundlecaps is not None and 'HG2X' in bundlecaps:
339 339 return bundle2.unbundle20(self.ui, f)
340 340 else:
341 341 return changegroupmod.unbundle10(f, 'UN')
@@ -201,7 +201,7 b' Empty bundle'
201 201 Test bundling
202 202
203 203 $ hg bundle2
204 HG20\x00\x00\x00\x00 (no-eol) (esc)
204 HG2X\x00\x00\x00\x00 (no-eol) (esc)
205 205
206 206 Test unbundling
207 207
@@ -231,7 +231,7 b' Simplest possible parameters form'
231 231 Test generation simple option
232 232
233 233 $ hg bundle2 --param 'caution'
234 HG20\x00\x07caution\x00\x00 (no-eol) (esc)
234 HG2X\x00\x07caution\x00\x00 (no-eol) (esc)
235 235
236 236 Test unbundling
237 237
@@ -243,7 +243,7 b' Test unbundling'
243 243 Test generation multiple option
244 244
245 245 $ hg bundle2 --param 'caution' --param 'meal'
246 HG20\x00\x0ccaution meal\x00\x00 (no-eol) (esc)
246 HG2X\x00\x0ccaution meal\x00\x00 (no-eol) (esc)
247 247
248 248 Test unbundling
249 249
@@ -259,7 +259,7 b' advisory parameters, with value'
259 259 Test generation
260 260
261 261 $ hg bundle2 --param 'caution' --param 'meal=vegan' --param 'elephants'
262 HG20\x00\x1ccaution meal=vegan elephants\x00\x00 (no-eol) (esc)
262 HG2X\x00\x1ccaution meal=vegan elephants\x00\x00 (no-eol) (esc)
263 263
264 264 Test unbundling
265 265
@@ -277,7 +277,7 b' parameter with special char in value'
277 277 Test generation
278 278
279 279 $ hg bundle2 --param 'e|! 7/=babar%#==tutu' --param simple
280 HG20\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00 (no-eol) (esc)
280 HG2X\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00 (no-eol) (esc)
281 281
282 282 Test unbundling
283 283
@@ -301,7 +301,7 b' Test debug output'
301 301 bundling debug
302 302
303 303 $ hg bundle2 --debug --param 'e|! 7/=babar%#==tutu' --param simple ../out.hg2
304 start emission of HG20 stream
304 start emission of HG2X stream
305 305 bundle parameter: e%7C%21%207/=babar%25%23%3D%3Dtutu simple
306 306 start of parts
307 307 end of bundle
@@ -309,12 +309,12 b' bundling debug'
309 309 file content is ok
310 310
311 311 $ cat ../out.hg2
312 HG20\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00 (no-eol) (esc)
312 HG2X\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00 (no-eol) (esc)
313 313
314 314 unbundling debug
315 315
316 316 $ hg statbundle2 --debug < ../out.hg2
317 start processing of HG20 stream
317 start processing of HG2X stream
318 318 reading bundle2 stream parameters
319 319 ignoring unknown parameter 'e|! 7/'
320 320 ignoring unknown parameter 'simple'
@@ -348,7 +348,7 b' Test part'
348 348 =================
349 349
350 350 $ hg bundle2 --parts ../parts.hg2 --debug
351 start emission of HG20 stream
351 start emission of HG2X stream
352 352 bundle parameter:
353 353 start of parts
354 354 bundle part: "test:empty"
@@ -360,7 +360,7 b' Test part'
360 360 end of bundle
361 361
362 362 $ cat ../parts.hg2
363 HG20\x00\x00\x00\x11 (esc)
363 HG2X\x00\x00\x00\x11 (esc)
364 364 test:empty\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11 (esc)
365 365 test:empty\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x10 test:song\x00\x00\x00\x02\x00\x00\x00\x00\x00\xb2Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko (esc)
366 366 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
@@ -396,7 +396,7 b' Test part'
396 396 parts count: 6
397 397
398 398 $ hg statbundle2 --debug < ../parts.hg2
399 start processing of HG20 stream
399 start processing of HG2X stream
400 400 reading bundle2 stream parameters
401 401 options count: 0
402 402 start extraction of bundle2 parts
@@ -466,7 +466,7 b' Test actual unbundling of test part'
466 466 Process the bundle
467 467
468 468 $ hg unbundle2 --debug < ../parts.hg2
469 start processing of HG20 stream
469 start processing of HG2X stream
470 470 reading bundle2 stream parameters
471 471 start extraction of bundle2 parts
472 472 part header size: 17
@@ -543,7 +543,7 b' unbundle with a reply'
543 543 The reply is a bundle
544 544
545 545 $ cat ../reply.hg2
546 HG20\x00\x00\x00\x1b\x06output\x00\x00\x00\x00\x00\x01\x0b\x01in-reply-to3\x00\x00\x00\xd9The choir starts singing: (esc)
546 HG2X\x00\x00\x00\x1b\x06output\x00\x00\x00\x00\x00\x01\x0b\x01in-reply-to3\x00\x00\x00\xd9The choir starts singing: (esc)
547 547 Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko
548 548 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
549 549 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.
@@ -669,7 +669,7 b' Support for changegroup'
669 669 9520eea781bcca16c1e15acc0ba14335a0e8e5ba
670 670 eea13746799a9e0bfd88f29d3c2e9dc9389f524f
671 671 02de42196ebee42ef284b6780a87cdc96e8eaab6
672 start emission of HG20 stream
672 start emission of HG2X stream
673 673 bundle parameter:
674 674 start of parts
675 675 bundle part: "changegroup"
@@ -687,7 +687,7 b' Support for changegroup'
687 687 end of bundle
688 688
689 689 $ cat ../rev.hg2
690 HG20\x00\x00\x00\x12\x0bchangegroup\x00\x00\x00\x00\x00\x00\x00\x00\x06\x13\x00\x00\x00\xa42\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j_\xdd\xd9\x89W\xc8\xa5JMCm\xfe\x1d\xa9\xd8\x7f!\xa1\xb9{\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x002\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)6e1f4c47ecb533ffd0c8e52cdc88afb6cd39e20c (esc)
690 HG2X\x00\x00\x00\x12\x0bchangegroup\x00\x00\x00\x00\x00\x00\x00\x00\x06\x13\x00\x00\x00\xa42\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j_\xdd\xd9\x89W\xc8\xa5JMCm\xfe\x1d\xa9\xd8\x7f!\xa1\xb9{\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x002\xafv\x86\xd4\x03\xcfE\xb5\xd9_-p\xce\xbe\xa5\x87\xac\x80j\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)6e1f4c47ecb533ffd0c8e52cdc88afb6cd39e20c (esc)
691 691 \x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x02D (esc)
692 692 \x00\x00\x00i\x00\x00\x00j\x00\x00\x00\x01D\x00\x00\x00\xa4\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\xcd\x01\x0b\x8c\xd9\x98\xf3\x98\x1aZ\x81\x15\xf9O\x8d\xa4\xabP`\x89\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x95 \xee\xa7\x81\xbc\xca\x16\xc1\xe1Z\xcc\x0b\xa1C5\xa0\xe8\xe5\xba\x00\x00\x00\x00\x00\x00\x00)\x00\x00\x00)4dece9c826f69490507b98c6383a3009b295837d (esc)
693 693 \x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x02E (esc)
@@ -726,7 +726,7 b' with reply'
726 726 addchangegroup return: 1
727 727
728 728 $ cat ../rev-reply.hg2
729 HG20\x00\x00\x00/\x11reply:changegroup\x00\x00\x00\x00\x00\x02\x0b\x01\x06\x01in-reply-to1return1\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to1\x00\x00\x00dadding changesets (esc)
729 HG2X\x00\x00\x00/\x11reply:changegroup\x00\x00\x00\x00\x00\x02\x0b\x01\x06\x01in-reply-to1return1\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to1\x00\x00\x00dadding changesets (esc)
730 730 adding manifests
731 731 adding file changes
732 732 added 0 changesets with 0 changes to 3 files
General Comments 0
You need to be logged in to leave comments. Login now