comparison tests/test-bundle2.t @ 21005:3d38ebb586fe

bundle2: rename part to bundlepart We are going to introduce an `unbundlepart` dedicated to reading bundle. So we need to rename the one used to create bundle. Even if dedicated to creation, this is still used for unbundling until we get the new class.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 11 Apr 2014 07:36:14 -0700
parents c93bb6a08fa1
children 8de8187e6f48
comparison
equal deleted inserted replaced
21004:27ab4b8d2503 21005:3d38ebb586fe
35 > 35 >
36 > @bundle2.parthandler('test:ping') 36 > @bundle2.parthandler('test:ping')
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 > op.reply.addpart(bundle2.part('test:pong', 40 > rpart = bundle2.bundlepart('test:pong',
41 > [('in-reply-to', str(part.id))])) 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'),
45 > ('', 'unknown', False, 'include an unknown mandatory part in the bundle'), 46 > ('', 'unknown', False, 'include an unknown mandatory part in the bundle'),
46 > ('', 'parts', False, 'include some arbitrary parts to the bundle'), 47 > ('', 'parts', False, 'include some arbitrary parts to the bundle'),
68 > cg = changegroup.getlocalbundle(repo, 'test:bundle2', outgoing, None) 69 > cg = changegroup.getlocalbundle(repo, 'test:bundle2', outgoing, None)
69 > def cgchunks(cg=cg): 70 > def cgchunks(cg=cg):
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:
98 > file = sys.stdout 99 > file = sys.stdout
99 > else: 100 > else: