##// END OF EJS Templates
bundle2: move all parts into a `bx2` namespace...
Pierre-Yves David -
r21146:4676135a default
parent child Browse files
Show More
@@ -317,7 +317,7 b' def processbundle(repo, unbundler, trans'
317 if output is not None:
317 if output is not None:
318 output = op.ui.popbuffer()
318 output = op.ui.popbuffer()
319 if output:
319 if output:
320 outpart = bundlepart('output',
320 outpart = bundlepart('b2x:output',
321 advisoryparams=[('in-reply-to',
321 advisoryparams=[('in-reply-to',
322 str(part.id))],
322 str(part.id))],
323 data=output)
323 data=output)
@@ -676,7 +676,7 b' class unbundlepart(unpackermixin):'
676 return data
676 return data
677
677
678
678
679 @parthandler('changegroup')
679 @parthandler('b2x:changegroup')
680 def handlechangegroup(op, inpart):
680 def handlechangegroup(op, inpart):
681 """apply a changegroup part on the repo
681 """apply a changegroup part on the repo
682
682
@@ -695,19 +695,19 b' def handlechangegroup(op, inpart):'
695 if op.reply is not None:
695 if op.reply is not None:
696 # This is definitly not the final form of this
696 # This is definitly not the final form of this
697 # return. But one need to start somewhere.
697 # return. But one need to start somewhere.
698 part = bundlepart('reply:changegroup', (),
698 part = bundlepart('b2x:reply:changegroup', (),
699 [('in-reply-to', str(inpart.id)),
699 [('in-reply-to', str(inpart.id)),
700 ('return', '%i' % ret)])
700 ('return', '%i' % ret)])
701 op.reply.addpart(part)
701 op.reply.addpart(part)
702 assert not inpart.read()
702 assert not inpart.read()
703
703
704 @parthandler('reply:changegroup')
704 @parthandler('b2x:reply:changegroup')
705 def handlechangegroup(op, inpart):
705 def handlechangegroup(op, inpart):
706 p = dict(inpart.advisoryparams)
706 p = dict(inpart.advisoryparams)
707 ret = int(p['return'])
707 ret = int(p['return'])
708 op.records.add('changegroup', {'return': ret}, int(p['in-reply-to']))
708 op.records.add('changegroup', {'return': ret}, int(p['in-reply-to']))
709
709
710 @parthandler('check:heads')
710 @parthandler('b2x:check:heads')
711 def handlechangegroup(op, inpart):
711 def handlechangegroup(op, inpart):
712 """check that head of the repo did not change
712 """check that head of the repo did not change
713
713
@@ -722,13 +722,13 b' def handlechangegroup(op, inpart):'
722 if heads != op.repo.heads():
722 if heads != op.repo.heads():
723 raise exchange.PushRaced()
723 raise exchange.PushRaced()
724
724
725 @parthandler('output')
725 @parthandler('b2x:output')
726 def handleoutput(op, inpart):
726 def handleoutput(op, inpart):
727 """forward output captured on the server to the client"""
727 """forward output captured on the server to the client"""
728 for line in inpart.read().splitlines():
728 for line in inpart.read().splitlines():
729 op.ui.write(('remote: %s\n' % line))
729 op.ui.write(('remote: %s\n' % line))
730
730
731 @parthandler('replycaps')
731 @parthandler('b2x:replycaps')
732 def handlereplycaps(op, inpart):
732 def handlereplycaps(op, inpart):
733 """Notify that a reply bundle should be created
733 """Notify that a reply bundle should be created
734
734
@@ -212,13 +212,14 b' def _pushbundle2(pushop):'
212 bundler = bundle2.bundle20(pushop.ui, caps)
212 bundler = bundle2.bundle20(pushop.ui, caps)
213 # create reply capability
213 # create reply capability
214 capsblob = bundle2.encodecaps(pushop.repo.bundle2caps)
214 capsblob = bundle2.encodecaps(pushop.repo.bundle2caps)
215 bundler.addpart(bundle2.bundlepart('replycaps', data=capsblob))
215 bundler.addpart(bundle2.bundlepart('b2x:replycaps', data=capsblob))
216 if not pushop.force:
216 if not pushop.force:
217 part = bundle2.bundlepart('CHECK:HEADS', data=iter(pushop.remoteheads))
217 part = bundle2.bundlepart('B2X:CHECK:HEADS',
218 data=iter(pushop.remoteheads))
218 bundler.addpart(part)
219 bundler.addpart(part)
219 # add the changegroup bundle
220 # add the changegroup bundle
220 cg = changegroup.getlocalbundle(pushop.repo, 'push', pushop.outgoing)
221 cg = changegroup.getlocalbundle(pushop.repo, 'push', pushop.outgoing)
221 cgpart = bundle2.bundlepart('CHANGEGROUP', data=cg.getchunks())
222 cgpart = bundle2.bundlepart('B2X:CHANGEGROUP', data=cg.getchunks())
222 bundler.addpart(cgpart)
223 bundler.addpart(cgpart)
223 stream = util.chunkbuffer(bundler.getchunks())
224 stream = util.chunkbuffer(bundler.getchunks())
224 reply = pushop.remote.unbundle(stream, ['force'], 'push')
225 reply = pushop.remote.unbundle(stream, ['force'], 'push')
@@ -668,7 +669,7 b' def getbundle(repo, source, heads=None, '
668 blob = urllib.unquote(bcaps[len('bundle2='):])
669 blob = urllib.unquote(bcaps[len('bundle2='):])
669 b2caps.update(bundle2.decodecaps(blob))
670 b2caps.update(bundle2.decodecaps(blob))
670 bundler = bundle2.bundle20(repo.ui, b2caps)
671 bundler = bundle2.bundle20(repo.ui, b2caps)
671 part = bundle2.bundlepart('changegroup', data=cg.getchunks())
672 part = bundle2.bundlepart('b2x:changegroup', data=cg.getchunks())
672 bundler.addpart(part)
673 bundler.addpart(part)
673 return util.chunkbuffer(bundler.getchunks())
674 return util.chunkbuffer(bundler.getchunks())
674
675
@@ -73,7 +73,7 b' Create an extension to test bundle2 API'
73 >
73 >
74 > if opts['reply']:
74 > if opts['reply']:
75 > capsstring = 'ping-pong\nelephants=babar,celeste\ncity%3D%21=celeste%2Cville'
75 > capsstring = 'ping-pong\nelephants=babar,celeste\ncity%3D%21=celeste%2Cville'
76 > bundler.addpart(bundle2.bundlepart('replycaps', data=capsstring))
76 > bundler.addpart(bundle2.bundlepart('b2x:replycaps', data=capsstring))
77 >
77 >
78 > revs = opts['rev']
78 > revs = opts['rev']
79 > if 'rev' in opts:
79 > if 'rev' in opts:
@@ -85,7 +85,7 b' Create an extension to test bundle2 API'
85 > headcommon = [c.node() for c in repo.set('parents(%ld) - %ld', revs, revs)]
85 > headcommon = [c.node() for c in repo.set('parents(%ld) - %ld', revs, revs)]
86 > outgoing = discovery.outgoing(repo.changelog, headcommon, headmissing)
86 > outgoing = discovery.outgoing(repo.changelog, headcommon, headmissing)
87 > cg = changegroup.getlocalbundle(repo, 'test:bundle2', outgoing, None)
87 > cg = changegroup.getlocalbundle(repo, 'test:bundle2', outgoing, None)
88 > part = bundle2.bundlepart('changegroup', data=cg.getchunks())
88 > part = bundle2.bundlepart('b2x:changegroup', data=cg.getchunks())
89 > bundler.addpart(part)
89 > bundler.addpart(part)
90 >
90 >
91 > if opts['parts']:
91 > if opts['parts']:
@@ -543,18 +543,21 b' unbundle with a reply'
543 The reply is a bundle
543 The reply is a bundle
544
544
545 $ cat ../reply.hg2
545 $ cat ../reply.hg2
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)
546 HG2X\x00\x00\x00\x1f (esc)
547 b2x:output\x00\x00\x00\x00\x00\x01\x0b\x01in-reply-to3\x00\x00\x00\xd9The choir starts singing: (esc)
547 Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko
548 Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko
548 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
549 Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko
549 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.
550 Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko.
550 \x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to4\x00\x00\x00\xc9debugreply: capabilities: (esc)
551 \x00\x00\x00\x00\x00\x1f (esc)
552 b2x:output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to4\x00\x00\x00\xc9debugreply: capabilities: (esc)
551 debugreply: 'city=!'
553 debugreply: 'city=!'
552 debugreply: 'celeste,ville'
554 debugreply: 'celeste,ville'
553 debugreply: 'elephants'
555 debugreply: 'elephants'
554 debugreply: 'babar'
556 debugreply: 'babar'
555 debugreply: 'celeste'
557 debugreply: 'celeste'
556 debugreply: 'ping-pong'
558 debugreply: 'ping-pong'
557 \x00\x00\x00\x00\x00\x1e test:pong\x00\x00\x00\x02\x01\x00\x0b\x01in-reply-to6\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x03\x00\x01\x0b\x01in-reply-to6\x00\x00\x00=received ping request (id 6) (esc)
559 \x00\x00\x00\x00\x00\x1e test:pong\x00\x00\x00\x02\x01\x00\x0b\x01in-reply-to6\x00\x00\x00\x00\x00\x1f (esc)
560 b2x:output\x00\x00\x00\x03\x00\x01\x0b\x01in-reply-to6\x00\x00\x00=received ping request (id 6) (esc)
558 replying to ping request (id 6)
561 replying to ping request (id 6)
559 \x00\x00\x00\x00\x00\x00 (no-eol) (esc)
562 \x00\x00\x00\x00\x00\x00 (no-eol) (esc)
560
563
@@ -562,11 +565,11 b' The reply is valid'
562
565
563 $ hg statbundle2 < ../reply.hg2
566 $ hg statbundle2 < ../reply.hg2
564 options count: 0
567 options count: 0
565 :output:
568 :b2x:output:
566 mandatory: 0
569 mandatory: 0
567 advisory: 1
570 advisory: 1
568 payload: 217 bytes
571 payload: 217 bytes
569 :output:
572 :b2x:output:
570 mandatory: 0
573 mandatory: 0
571 advisory: 1
574 advisory: 1
572 payload: 201 bytes
575 payload: 201 bytes
@@ -574,7 +577,7 b' The reply is valid'
574 mandatory: 1
577 mandatory: 1
575 advisory: 0
578 advisory: 0
576 payload: 0 bytes
579 payload: 0 bytes
577 :output:
580 :b2x:output:
578 mandatory: 0
581 mandatory: 0
579 advisory: 1
582 advisory: 1
580 payload: 61 bytes
583 payload: 61 bytes
@@ -672,7 +675,7 b' Support for changegroup'
672 start emission of HG2X stream
675 start emission of HG2X stream
673 bundle parameter:
676 bundle parameter:
674 start of parts
677 start of parts
675 bundle part: "changegroup"
678 bundle part: "b2x:changegroup"
676 bundling: 1/4 changesets (25.00%)
679 bundling: 1/4 changesets (25.00%)
677 bundling: 2/4 changesets (50.00%)
680 bundling: 2/4 changesets (50.00%)
678 bundling: 3/4 changesets (75.00%)
681 bundling: 3/4 changesets (75.00%)
@@ -687,7 +690,7 b' Support for changegroup'
687 end of bundle
690 end of bundle
688
691
689 $ cat ../rev.hg2
692 $ cat ../rev.hg2
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)
693 HG2X\x00\x00\x00\x16\x0fb2x:changegroup\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 \x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x02D (esc)
694 \x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x02D (esc)
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)
695 \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 \x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x02E (esc)
696 \x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x02E (esc)
@@ -726,7 +729,8 b' with reply'
726 addchangegroup return: 1
729 addchangegroup return: 1
727
730
728 $ cat ../rev-reply.hg2
731 $ cat ../rev-reply.hg2
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)
732 HG2X\x00\x00\x003\x15b2x:reply:changegroup\x00\x00\x00\x00\x00\x02\x0b\x01\x06\x01in-reply-to1return1\x00\x00\x00\x00\x00\x1f (esc)
733 b2x:output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to1\x00\x00\x00dadding changesets (esc)
730 adding manifests
734 adding manifests
731 adding file changes
735 adding file changes
732 added 0 changesets with 0 changes to 3 files
736 added 0 changesets with 0 changes to 3 files
General Comments 0
You need to be logged in to leave comments. Login now