Show More
@@ -503,12 +503,12 b' class unbundle20(object):' | |||||
503 | payloadsize = self._unpack(_fpayloadsize)[0] |
|
503 | payloadsize = self._unpack(_fpayloadsize)[0] | |
504 | self.ui.debug('payload chunk size: %i\n' % payloadsize) |
|
504 | self.ui.debug('payload chunk size: %i\n' % payloadsize) | |
505 | payload = ''.join(payload) |
|
505 | payload = ''.join(payload) | |
506 | current = part(parttype, manparams, advparams, data=payload) |
|
506 | current = bundlepart(parttype, manparams, advparams, data=payload) | |
507 | current.id = partid |
|
507 | current.id = partid | |
508 | return current |
|
508 | return current | |
509 |
|
509 | |||
510 |
|
510 | |||
511 | class part(object): |
|
511 | class bundlepart(object): | |
512 | """A bundle2 part contains application level payload |
|
512 | """A bundle2 part contains application level payload | |
513 |
|
513 | |||
514 | The part `type` is used to route the part to the application level |
|
514 | The part `type` is used to route the part to the application level | |
@@ -598,9 +598,9 b' def handlechangegroup(op, inpart):' | |||||
598 | if op.reply is not None: |
|
598 | if op.reply is not None: | |
599 | # This is definitly not the final form of this |
|
599 | # This is definitly not the final form of this | |
600 | # return. But one need to start somewhere. |
|
600 | # return. But one need to start somewhere. | |
601 | op.reply.addpart(part('reply:changegroup', (), |
|
601 | op.reply.addpart(bundlepart('reply:changegroup', (), | |
602 | [('in-reply-to', str(inpart.id)), |
|
602 | [('in-reply-to', str(inpart.id)), | |
603 | ('return', '%i' % ret)])) |
|
603 | ('return', '%i' % ret)])) | |
604 |
|
604 | |||
605 | @parthandler('reply:changegroup') |
|
605 | @parthandler('reply:changegroup') | |
606 | def handlechangegroup(op, inpart): |
|
606 | def handlechangegroup(op, inpart): |
@@ -604,7 +604,7 b' def getbundle(repo, source, heads=None, ' | |||||
604 | yield 'HG10UN' |
|
604 | yield 'HG10UN' | |
605 | for c in cg.getchunks(): |
|
605 | for c in cg.getchunks(): | |
606 | yield c |
|
606 | yield c | |
607 | part = bundle2.part('changegroup', data=cgchunks()) |
|
607 | part = bundle2.bundlepart('changegroup', data=cgchunks()) | |
608 | bundler.addpart(part) |
|
608 | bundler.addpart(part) | |
609 | return bundle2.unbundle20(repo.ui, util.chunkbuffer(bundler.getchunks())) |
|
609 | return bundle2.unbundle20(repo.ui, util.chunkbuffer(bundler.getchunks())) | |
610 |
|
610 |
@@ -37,8 +37,9 b' Create an extension to test bundle2 API' | |||||
37 | > def pinghandler(op, part): |
|
37 | > def pinghandler(op, part): | |
38 | > op.ui.write('received ping request (id %i)\n' % part.id) |
|
38 | > op.ui.write('received ping request (id %i)\n' % part.id) | |
39 | > if op.reply is not None: |
|
39 | > if op.reply is not None: | |
40 |
> |
|
40 | > rpart = bundle2.bundlepart('test:pong', | |
41 |
> |
|
41 | > [('in-reply-to', str(part.id))]) | |
|
42 | > op.reply.addpart(rpart) | |||
42 | > |
|
43 | > | |
43 | > @command('bundle2', |
|
44 | > @command('bundle2', | |
44 | > [('', 'param', [], 'stream level parameter'), |
|
45 | > [('', 'param', [], 'stream level parameter'), | |
@@ -70,28 +71,28 b' Create an extension to test bundle2 API' | |||||
70 | > yield 'HG10UN' |
|
71 | > yield 'HG10UN' | |
71 | > for c in cg.getchunks(): |
|
72 | > for c in cg.getchunks(): | |
72 | > yield c |
|
73 | > yield c | |
73 | > part = bundle2.part('changegroup', data=cgchunks()) |
|
74 | > part = bundle2.bundlepart('changegroup', data=cgchunks()) | |
74 | > bundler.addpart(part) |
|
75 | > bundler.addpart(part) | |
75 | > |
|
76 | > | |
76 | > if opts['parts']: |
|
77 | > if opts['parts']: | |
77 | > part = bundle2.part('test:empty') |
|
78 | > part = bundle2.bundlepart('test:empty') | |
78 | > bundler.addpart(part) |
|
79 | > bundler.addpart(part) | |
79 | > # add a second one to make sure we handle multiple parts |
|
80 | > # add a second one to make sure we handle multiple parts | |
80 | > part = bundle2.part('test:empty') |
|
81 | > part = bundle2.bundlepart('test:empty') | |
81 | > bundler.addpart(part) |
|
82 | > bundler.addpart(part) | |
82 | > part = bundle2.part('test:song', data=ELEPHANTSSONG) |
|
83 | > part = bundle2.bundlepart('test:song', data=ELEPHANTSSONG) | |
83 | > bundler.addpart(part) |
|
84 | > bundler.addpart(part) | |
84 | > part = bundle2.part('test:math', |
|
85 | > part = bundle2.bundlepart('test:math', | |
85 | > [('pi', '3.14'), ('e', '2.72')], |
|
86 | > [('pi', '3.14'), ('e', '2.72')], | |
86 | > [('cooking', 'raw')], |
|
87 | > [('cooking', 'raw')], | |
87 | > '42') |
|
88 | > '42') | |
88 | > bundler.addpart(part) |
|
89 | > bundler.addpart(part) | |
89 | > if opts['unknown']: |
|
90 | > if opts['unknown']: | |
90 | > part = bundle2.part('test:UNKNOWN', |
|
91 | > part = bundle2.bundlepart('test:UNKNOWN', | |
91 | > data='some random content') |
|
92 | > data='some random content') | |
92 | > bundler.addpart(part) |
|
93 | > bundler.addpart(part) | |
93 | > if opts['parts']: |
|
94 | > if opts['parts']: | |
94 | > part = bundle2.part('test:ping') |
|
95 | > part = bundle2.bundlepart('test:ping') | |
95 | > bundler.addpart(part) |
|
96 | > bundler.addpart(part) | |
96 | > |
|
97 | > | |
97 | > if path is None: |
|
98 | > if path is None: |
General Comments 0
You need to be logged in to leave comments.
Login now