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