Show More
@@ -321,11 +321,10 b' def processbundle(repo, unbundler, trans' | |||
|
321 | 321 | if output is not None: |
|
322 | 322 | output = op.ui.popbuffer() |
|
323 | 323 | if output: |
|
324 |
o |
|
|
324 | op.reply.newpart('b2x:output', | |
|
325 | 325 |
|
|
326 | 326 |
|
|
327 | 327 |
|
|
328 | op.reply.addpart(outpart) | |
|
329 | 328 | part.read() |
|
330 | 329 | except Exception, exc: |
|
331 | 330 | if part is not None: |
@@ -409,7 +408,7 b' class bundle20(object):' | |||
|
409 | 408 | self._parts.append(part) |
|
410 | 409 | |
|
411 | 410 | def newpart(self, typeid, *args, **kwargs): |
|
412 |
"""create a new part |
|
|
411 | """create a new part and add it to the containers""" | |
|
413 | 412 | part = bundlepart(typeid, *args, **kwargs) |
|
414 | 413 | self.addpart(part) |
|
415 | 414 | return part |
@@ -214,16 +214,13 b' def _pushbundle2(pushop):' | |||
|
214 | 214 | bundler = bundle2.bundle20(pushop.ui, caps) |
|
215 | 215 | # create reply capability |
|
216 | 216 | capsblob = bundle2.encodecaps(pushop.repo.bundle2caps) |
|
217 |
bundler. |
|
|
217 | bundler.newpart('b2x:replycaps', data=capsblob) | |
|
218 | 218 | if not pushop.force: |
|
219 |
|
|
|
220 | data=iter(pushop.remoteheads)) | |
|
221 | bundler.addpart(part) | |
|
219 | bundler.newpart('B2X:CHECK:HEADS', data=iter(pushop.remoteheads)) | |
|
222 | 220 | extrainfo = _pushbundle2extraparts(pushop, bundler) |
|
223 | 221 | # add the changegroup bundle |
|
224 | 222 | cg = changegroup.getlocalbundle(pushop.repo, 'push', pushop.outgoing) |
|
225 |
cgpart = bundle |
|
|
226 | bundler.addpart(cgpart) | |
|
223 | cgpart = bundler.newpart('B2X:CHANGEGROUP', data=cg.getchunks()) | |
|
227 | 224 | stream = util.chunkbuffer(bundler.getchunks()) |
|
228 | 225 | try: |
|
229 | 226 | reply = pushop.remote.unbundle(stream, ['force'], 'push') |
@@ -670,8 +667,7 b' def getbundle(repo, source, heads=None, ' | |||
|
670 | 667 | b2caps.update(bundle2.decodecaps(blob)) |
|
671 | 668 | bundler = bundle2.bundle20(repo.ui, b2caps) |
|
672 | 669 | if cg: |
|
673 |
|
|
|
674 | bundler.addpart(part) | |
|
670 | bundler.newpart('b2x:changegroup', data=cg.getchunks()) | |
|
675 | 671 | _getbundleextrapart(bundler, repo, source, heads=heads, common=common, |
|
676 | 672 | bundlecaps=bundlecaps, **kwargs) |
|
677 | 673 | return util.chunkbuffer(bundler.getchunks()) |
@@ -805,9 +805,7 b' def unbundle(repo, proto, heads):' | |||
|
805 | 805 | os.unlink(tempname) |
|
806 | 806 | except bundle2.UnknownPartError, exc: |
|
807 | 807 | bundler = bundle2.bundle20(repo.ui) |
|
808 |
|
|
|
809 | [('parttype', str(exc))]) | |
|
810 | bundler.addpart(part) | |
|
808 | bundler.newpart('B2X:ERROR:UNKNOWNPART', [('parttype', str(exc))]) | |
|
811 | 809 | return streamres(bundler.getchunks()) |
|
812 | 810 | except util.Abort, inst: |
|
813 | 811 | # The old code we moved used sys.stderr directly. |
@@ -829,9 +827,7 b' def unbundle(repo, proto, heads):' | |||
|
829 | 827 | except error.PushRaced, exc: |
|
830 | 828 | if getattr(exc, 'duringunbundle2', False): |
|
831 | 829 | bundler = bundle2.bundle20(repo.ui) |
|
832 |
|
|
|
833 | [('message', str(exc))]) | |
|
834 | bundler.addpart(part) | |
|
830 | bundler.newpart('B2X:ERROR:PUSHRACED', [('message', str(exc))]) | |
|
835 | 831 | return streamres(bundler.getchunks()) |
|
836 | 832 | else: |
|
837 | 833 | return pusherr(str(exc)) |
@@ -47,9 +47,7 b' Create an extension to test bundle2 API' | |||
|
47 | 47 | > op.ui.write('received ping request (id %i)\n' % part.id) |
|
48 | 48 | > if op.reply is not None and 'ping-pong' in op.reply.capabilities: |
|
49 | 49 | > op.ui.write_err('replying to ping request (id %i)\n' % part.id) |
|
50 | > rpart = bundle2.bundlepart('test:pong', | |
|
51 | > [('in-reply-to', str(part.id))]) | |
|
52 | > op.reply.addpart(rpart) | |
|
50 | > op.reply.newpart('test:pong', [('in-reply-to', str(part.id))]) | |
|
53 | 51 | > |
|
54 | 52 | > @bundle2.parthandler('test:debugreply') |
|
55 | 53 | > def debugreply(op, part): |
@@ -83,11 +81,11 b' Create an extension to test bundle2 API' | |||
|
83 | 81 | > |
|
84 | 82 | > if opts['reply']: |
|
85 | 83 | > capsstring = 'ping-pong\nelephants=babar,celeste\ncity%3D%21=celeste%2Cville' |
|
86 |
> bundler. |
|
|
84 | > bundler.newpart('b2x:replycaps', data=capsstring) | |
|
87 | 85 | > |
|
88 | 86 | > if opts['pushrace']: |
|
89 | 87 | > dummynode = '01234567890123456789' |
|
90 |
> bundler. |
|
|
88 | > bundler.newpart('b2x:check:heads', data=dummynode) | |
|
91 | 89 | > |
|
92 | 90 | > revs = opts['rev'] |
|
93 | 91 | > if 'rev' in opts: |
@@ -99,31 +97,22 b' Create an extension to test bundle2 API' | |||
|
99 | 97 | > headcommon = [c.node() for c in repo.set('parents(%ld) - %ld', revs, revs)] |
|
100 | 98 | > outgoing = discovery.outgoing(repo.changelog, headcommon, headmissing) |
|
101 | 99 | > cg = changegroup.getlocalbundle(repo, 'test:bundle2', outgoing, None) |
|
102 |
> |
|
|
103 | > bundler.addpart(part) | |
|
100 | > bundler.newpart('b2x:changegroup', data=cg.getchunks()) | |
|
104 | 101 | > |
|
105 | 102 | > if opts['parts']: |
|
106 |
> |
|
|
107 | > bundler.addpart(part) | |
|
103 | > bundler.newpart('test:empty') | |
|
108 | 104 | > # add a second one to make sure we handle multiple parts |
|
109 |
> |
|
|
110 | > bundler.addpart(part) | |
|
111 | > part = bundle2.bundlepart('test:song', data=ELEPHANTSSONG) | |
|
112 |
> bundler. |
|
|
113 | > part = bundle2.bundlepart('test:debugreply') | |
|
114 | > bundler.addpart(part) | |
|
115 | > part = bundle2.bundlepart('test:math', | |
|
105 | > bundler.newpart('test:empty') | |
|
106 | > bundler.newpart('test:song', data=ELEPHANTSSONG) | |
|
107 | > bundler.newpart('test:debugreply') | |
|
108 | > bundler.newpart('test:math', | |
|
116 | 109 | > [('pi', '3.14'), ('e', '2.72')], |
|
117 | 110 | > [('cooking', 'raw')], |
|
118 | 111 | > '42') |
|
119 | > bundler.addpart(part) | |
|
120 | 112 | > if opts['unknown']: |
|
121 |
> |
|
|
122 | > data='some random content') | |
|
123 | > bundler.addpart(part) | |
|
113 | > bundler.newpart('test:UNKNOWN', data='some random content') | |
|
124 | 114 | > if opts['parts']: |
|
125 |
> |
|
|
126 | > bundler.addpart(part) | |
|
115 | > bundler.newpart('test:ping') | |
|
127 | 116 | > |
|
128 | 117 | > if path is None: |
|
129 | 118 | > file = sys.stdout |
@@ -938,14 +927,12 b' Setting up' | |||
|
938 | 927 | > reason = pushop.ui.config('failpush', 'reason', None) |
|
939 | 928 | > part = None |
|
940 | 929 | > if reason == 'abort': |
|
941 |
> |
|
|
930 | > bundler.newpart('test:abort') | |
|
942 | 931 | > if reason == 'unknown': |
|
943 |
> |
|
|
932 | > bundler.newpart('TEST:UNKNOWN') | |
|
944 | 933 | > if reason == 'race': |
|
945 | 934 | > # 20 Bytes of crap |
|
946 |
> |
|
|
947 | > if part is not None: | |
|
948 | > bundler.addpart(part) | |
|
935 | > bundler.newpart('b2x:check:heads', data='01234567890123456789') | |
|
949 | 936 | > return extradata |
|
950 | 937 | > |
|
951 | 938 | > @bundle2.parthandler("test:abort") |
General Comments 0
You need to be logged in to leave comments.
Login now