Show More
@@ -358,7 +358,7 b' def _processpart(op, part):' | |||
|
358 | 358 | if output is not None: |
|
359 | 359 | output = op.ui.popbuffer() |
|
360 | 360 | if output: |
|
361 |
outpart = op.reply.newpart(' |
|
|
361 | outpart = op.reply.newpart('output', data=output, | |
|
362 | 362 | mandatory=False) |
|
363 | 363 | outpart.addparam('in-reply-to', str(part.id), mandatory=False) |
|
364 | 364 | finally: |
@@ -408,7 +408,7 b' class bundle20(object):' | |||
|
408 | 408 | populate it. Then call `getchunks` to retrieve all the binary chunks of |
|
409 | 409 | data that compose the bundle2 container.""" |
|
410 | 410 | |
|
411 |
_magicstring = 'HG2 |
|
|
411 | _magicstring = 'HG20' | |
|
412 | 412 | |
|
413 | 413 | def __init__(self, ui, capabilities=()): |
|
414 | 414 | self.ui = ui |
@@ -616,7 +616,7 b' class unbundle20(unpackermixin):' | |||
|
616 | 616 | def compressed(self): |
|
617 | 617 | return False |
|
618 | 618 | |
|
619 |
formatmap = {'2 |
|
|
619 | formatmap = {'20': unbundle20} | |
|
620 | 620 | |
|
621 | 621 | class bundlepart(object): |
|
622 | 622 | """A bundle2 part contains application level payload |
@@ -734,7 +734,7 b' class bundlepart(object):' | |||
|
734 | 734 | # backup exception data for later |
|
735 | 735 | exc_info = sys.exc_info() |
|
736 | 736 | msg = 'unexpected error: %s' % exc |
|
737 |
interpart = bundlepart(' |
|
|
737 | interpart = bundlepart('error:abort', [('message', msg)], | |
|
738 | 738 | mandatory=False) |
|
739 | 739 | interpart.id = 0 |
|
740 | 740 | yield _pack(_fpayloadsize, -1) |
@@ -982,11 +982,11 b' class unbundlepart(unpackermixin):' | |||
|
982 | 982 | raise util.Abort(_('Seek failed\n')) |
|
983 | 983 | self._pos = newpos |
|
984 | 984 | |
|
985 |
capabilities = {'HG2 |
|
|
986 |
' |
|
|
987 |
' |
|
|
985 | capabilities = {'HG20': (), | |
|
986 | 'listkeys': (), | |
|
987 | 'pushkey': (), | |
|
988 | 988 | 'digests': tuple(sorted(util.DIGESTS.keys())), |
|
989 |
' |
|
|
989 | 'remote-changegroup': ('http', 'https'), | |
|
990 | 990 | } |
|
991 | 991 | |
|
992 | 992 | def getrepocaps(repo, allowpushback=False): |
@@ -995,29 +995,29 b' def getrepocaps(repo, allowpushback=Fals' | |||
|
995 | 995 | Exists to allow extensions (like evolution) to mutate the capabilities. |
|
996 | 996 | """ |
|
997 | 997 | caps = capabilities.copy() |
|
998 |
caps[' |
|
|
998 | caps['changegroup'] = tuple(sorted(changegroup.packermap.keys())) | |
|
999 | 999 | if obsolete.isenabled(repo, obsolete.exchangeopt): |
|
1000 | 1000 | supportedformat = tuple('V%i' % v for v in obsolete.formats) |
|
1001 |
caps[' |
|
|
1001 | caps['obsmarkers'] = supportedformat | |
|
1002 | 1002 | if allowpushback: |
|
1003 |
caps[' |
|
|
1003 | caps['pushback'] = () | |
|
1004 | 1004 | return caps |
|
1005 | 1005 | |
|
1006 | 1006 | def bundle2caps(remote): |
|
1007 | 1007 | """return the bundle capabilities of a peer as dict""" |
|
1008 |
raw = remote.capable('bundle2 |
|
|
1008 | raw = remote.capable('bundle2') | |
|
1009 | 1009 | if not raw and raw != '': |
|
1010 | 1010 | return {} |
|
1011 |
capsblob = urllib.unquote(remote.capable('bundle2 |
|
|
1011 | capsblob = urllib.unquote(remote.capable('bundle2')) | |
|
1012 | 1012 | return decodecaps(capsblob) |
|
1013 | 1013 | |
|
1014 | 1014 | def obsmarkersversion(caps): |
|
1015 | 1015 | """extract the list of supported obsmarkers versions from a bundle2caps dict |
|
1016 | 1016 | """ |
|
1017 |
obscaps = caps.get(' |
|
|
1017 | obscaps = caps.get('obsmarkers', ()) | |
|
1018 | 1018 | return [int(c[1:]) for c in obscaps if c.startswith('V')] |
|
1019 | 1019 | |
|
1020 |
@parthandler(' |
|
|
1020 | @parthandler('changegroup', ('version',)) | |
|
1021 | 1021 | def handlechangegroup(op, inpart): |
|
1022 | 1022 | """apply a changegroup part on the repo |
|
1023 | 1023 | |
@@ -1041,14 +1041,14 b' def handlechangegroup(op, inpart):' | |||
|
1041 | 1041 | if op.reply is not None: |
|
1042 | 1042 | # This is definitely not the final form of this |
|
1043 | 1043 | # return. But one need to start somewhere. |
|
1044 |
part = op.reply.newpart(' |
|
|
1044 | part = op.reply.newpart('reply:changegroup', mandatory=False) | |
|
1045 | 1045 | part.addparam('in-reply-to', str(inpart.id), mandatory=False) |
|
1046 | 1046 | part.addparam('return', '%i' % ret, mandatory=False) |
|
1047 | 1047 | assert not inpart.read() |
|
1048 | 1048 | |
|
1049 | 1049 | _remotechangegroupparams = tuple(['url', 'size', 'digests'] + |
|
1050 | 1050 | ['digest:%s' % k for k in util.DIGESTS.keys()]) |
|
1051 |
@parthandler(' |
|
|
1051 | @parthandler('remote-changegroup', _remotechangegroupparams) | |
|
1052 | 1052 | def handleremotechangegroup(op, inpart): |
|
1053 | 1053 | """apply a bundle10 on the repo, given an url and validation information |
|
1054 | 1054 | |
@@ -1070,7 +1070,7 b' def handleremotechangegroup(op, inpart):' | |||
|
1070 | 1070 | except KeyError: |
|
1071 | 1071 | raise util.Abort(_('remote-changegroup: missing "%s" param') % 'url') |
|
1072 | 1072 | parsed_url = util.url(raw_url) |
|
1073 |
if parsed_url.scheme not in capabilities[' |
|
|
1073 | if parsed_url.scheme not in capabilities['remote-changegroup']: | |
|
1074 | 1074 | raise util.Abort(_('remote-changegroup does not support %s urls') % |
|
1075 | 1075 | parsed_url.scheme) |
|
1076 | 1076 | |
@@ -1110,7 +1110,7 b' def handleremotechangegroup(op, inpart):' | |||
|
1110 | 1110 | if op.reply is not None: |
|
1111 | 1111 | # This is definitely not the final form of this |
|
1112 | 1112 | # return. But one need to start somewhere. |
|
1113 |
part = op.reply.newpart(' |
|
|
1113 | part = op.reply.newpart('reply:changegroup') | |
|
1114 | 1114 | part.addparam('in-reply-to', str(inpart.id), mandatory=False) |
|
1115 | 1115 | part.addparam('return', '%i' % ret, mandatory=False) |
|
1116 | 1116 | try: |
@@ -1120,13 +1120,13 b' def handleremotechangegroup(op, inpart):' | |||
|
1120 | 1120 | (util.hidepassword(raw_url), str(e))) |
|
1121 | 1121 | assert not inpart.read() |
|
1122 | 1122 | |
|
1123 |
@parthandler(' |
|
|
1123 | @parthandler('reply:changegroup', ('return', 'in-reply-to')) | |
|
1124 | 1124 | def handlereplychangegroup(op, inpart): |
|
1125 | 1125 | ret = int(inpart.params['return']) |
|
1126 | 1126 | replyto = int(inpart.params['in-reply-to']) |
|
1127 | 1127 | op.records.add('changegroup', {'return': ret}, replyto) |
|
1128 | 1128 | |
|
1129 |
@parthandler(' |
|
|
1129 | @parthandler('check:heads') | |
|
1130 | 1130 | def handlecheckheads(op, inpart): |
|
1131 | 1131 | """check that head of the repo did not change |
|
1132 | 1132 | |
@@ -1142,13 +1142,13 b' def handlecheckheads(op, inpart):' | |||
|
1142 | 1142 | raise error.PushRaced('repository changed while pushing - ' |
|
1143 | 1143 | 'please try again') |
|
1144 | 1144 | |
|
1145 |
@parthandler(' |
|
|
1145 | @parthandler('output') | |
|
1146 | 1146 | def handleoutput(op, inpart): |
|
1147 | 1147 | """forward output captured on the server to the client""" |
|
1148 | 1148 | for line in inpart.read().splitlines(): |
|
1149 | 1149 | op.ui.write(('remote: %s\n' % line)) |
|
1150 | 1150 | |
|
1151 |
@parthandler(' |
|
|
1151 | @parthandler('replycaps') | |
|
1152 | 1152 | def handlereplycaps(op, inpart): |
|
1153 | 1153 | """Notify that a reply bundle should be created |
|
1154 | 1154 | |
@@ -1157,12 +1157,12 b' def handlereplycaps(op, inpart):' | |||
|
1157 | 1157 | if op.reply is None: |
|
1158 | 1158 | op.reply = bundle20(op.ui, caps) |
|
1159 | 1159 | |
|
1160 |
@parthandler(' |
|
|
1160 | @parthandler('error:abort', ('message', 'hint')) | |
|
1161 | 1161 | def handlereplycaps(op, inpart): |
|
1162 | 1162 | """Used to transmit abort error over the wire""" |
|
1163 | 1163 | raise util.Abort(inpart.params['message'], hint=inpart.params.get('hint')) |
|
1164 | 1164 | |
|
1165 |
@parthandler(' |
|
|
1165 | @parthandler('error:unsupportedcontent', ('parttype', 'params')) | |
|
1166 | 1166 | def handlereplycaps(op, inpart): |
|
1167 | 1167 | """Used to transmit unknown content error over the wire""" |
|
1168 | 1168 | kwargs = {} |
@@ -1175,19 +1175,19 b' def handlereplycaps(op, inpart):' | |||
|
1175 | 1175 | |
|
1176 | 1176 | raise error.UnsupportedPartError(**kwargs) |
|
1177 | 1177 | |
|
1178 |
@parthandler(' |
|
|
1178 | @parthandler('error:pushraced', ('message',)) | |
|
1179 | 1179 | def handlereplycaps(op, inpart): |
|
1180 | 1180 | """Used to transmit push race error over the wire""" |
|
1181 | 1181 | raise error.ResponseError(_('push failed:'), inpart.params['message']) |
|
1182 | 1182 | |
|
1183 |
@parthandler(' |
|
|
1183 | @parthandler('listkeys', ('namespace',)) | |
|
1184 | 1184 | def handlelistkeys(op, inpart): |
|
1185 | 1185 | """retrieve pushkey namespace content stored in a bundle2""" |
|
1186 | 1186 | namespace = inpart.params['namespace'] |
|
1187 | 1187 | r = pushkey.decodekeys(inpart.read()) |
|
1188 | 1188 | op.records.add('listkeys', (namespace, r)) |
|
1189 | 1189 | |
|
1190 |
@parthandler(' |
|
|
1190 | @parthandler('pushkey', ('namespace', 'key', 'old', 'new')) | |
|
1191 | 1191 | def handlepushkey(op, inpart): |
|
1192 | 1192 | """process a pushkey request""" |
|
1193 | 1193 | dec = pushkey.decode |
@@ -1202,18 +1202,18 b' def handlepushkey(op, inpart):' | |||
|
1202 | 1202 | 'new': new} |
|
1203 | 1203 | op.records.add('pushkey', record) |
|
1204 | 1204 | if op.reply is not None: |
|
1205 |
rpart = op.reply.newpart(' |
|
|
1205 | rpart = op.reply.newpart('reply:pushkey') | |
|
1206 | 1206 | rpart.addparam('in-reply-to', str(inpart.id), mandatory=False) |
|
1207 | 1207 | rpart.addparam('return', '%i' % ret, mandatory=False) |
|
1208 | 1208 | |
|
1209 |
@parthandler(' |
|
|
1209 | @parthandler('reply:pushkey', ('return', 'in-reply-to')) | |
|
1210 | 1210 | def handlepushkeyreply(op, inpart): |
|
1211 | 1211 | """retrieve the result of a pushkey request""" |
|
1212 | 1212 | ret = int(inpart.params['return']) |
|
1213 | 1213 | partid = int(inpart.params['in-reply-to']) |
|
1214 | 1214 | op.records.add('pushkey', {'return': ret}, partid) |
|
1215 | 1215 | |
|
1216 |
@parthandler(' |
|
|
1216 | @parthandler('obsmarkers') | |
|
1217 | 1217 | def handleobsmarker(op, inpart): |
|
1218 | 1218 | """add a stream of obsmarkers to the repo""" |
|
1219 | 1219 | tr = op.gettransaction() |
@@ -1222,12 +1222,12 b' def handleobsmarker(op, inpart):' | |||
|
1222 | 1222 | op.repo.ui.status(_('%i new obsolescence markers\n') % new) |
|
1223 | 1223 | op.records.add('obsmarkers', {'new': new}) |
|
1224 | 1224 | if op.reply is not None: |
|
1225 |
rpart = op.reply.newpart(' |
|
|
1225 | rpart = op.reply.newpart('reply:obsmarkers') | |
|
1226 | 1226 | rpart.addparam('in-reply-to', str(inpart.id), mandatory=False) |
|
1227 | 1227 | rpart.addparam('new', '%i' % new, mandatory=False) |
|
1228 | 1228 | |
|
1229 | 1229 | |
|
1230 |
@parthandler(' |
|
|
1230 | @parthandler('reply:obsmarkers', ('new', 'in-reply-to')) | |
|
1231 | 1231 | def handlepushkeyreply(op, inpart): |
|
1232 | 1232 | """retrieve the result of a pushkey request""" |
|
1233 | 1233 | ret = int(inpart.params['new']) |
@@ -240,7 +240,7 b' class bundlerepository(localrepo.localre' | |||
|
240 | 240 | |
|
241 | 241 | if isinstance(self.bundle, bundle2.unbundle20): |
|
242 | 242 | cgparts = [part for part in self.bundle.iterparts() |
|
243 |
if (part.type == ' |
|
|
243 | if (part.type == 'changegroup') | |
|
244 | 244 | and (part.params.get('version', '01') |
|
245 | 245 | in changegroup.packermap)] |
|
246 | 246 |
@@ -71,7 +71,7 b' bundletypes = {' | |||
|
71 | 71 | "": ("", nocompress), # only when using unbundle on ssh and old http servers |
|
72 | 72 | # since the unification ssh accepts a header but there |
|
73 | 73 | # is no capability signaling it. |
|
74 |
"HG2 |
|
|
74 | "HG20": (), # special-cased below | |
|
75 | 75 | "HG10UN": ("HG10UN", nocompress), |
|
76 | 76 | "HG10BZ": ("HG10", lambda: bz2.BZ2Compressor()), |
|
77 | 77 | "HG10GZ": ("HG10GZ", lambda: zlib.compressobj()), |
@@ -102,10 +102,10 b' def writebundle(ui, cg, filename, bundle' | |||
|
102 | 102 | fh = os.fdopen(fd, "wb") |
|
103 | 103 | cleanup = filename |
|
104 | 104 | |
|
105 |
if bundletype == "HG2 |
|
|
105 | if bundletype == "HG20": | |
|
106 | 106 | import bundle2 |
|
107 | 107 | bundle = bundle2.bundle20(ui) |
|
108 |
part = bundle.newpart(' |
|
|
108 | part = bundle.newpart('changegroup', data=cg.getchunks()) | |
|
109 | 109 | part.addparam('version', cg.version) |
|
110 | 110 | z = nocompress() |
|
111 | 111 | chunkiter = bundle.getchunks() |
@@ -1221,7 +1221,7 b' def bundle(ui, repo, fname, dest=None, *' | |||
|
1221 | 1221 | btypes = {'none': 'HG10UN', |
|
1222 | 1222 | 'bzip2': 'HG10BZ', |
|
1223 | 1223 | 'gzip': 'HG10GZ', |
|
1224 |
'bundle2': 'HG2 |
|
|
1224 | 'bundle2': 'HG20'} | |
|
1225 | 1225 | bundletype = btypes.get(bundletype) |
|
1226 | 1226 | if bundletype not in changegroup.bundletypes: |
|
1227 | 1227 | raise util.Abort(_('unknown bundle type specified with --type')) |
@@ -1918,7 +1918,7 b' def _debugbundle2(ui, gen, **opts):' | |||
|
1918 | 1918 | ui.write(('Stream params: %s\n' % repr(gen.params))) |
|
1919 | 1919 | for part in gen.iterparts(): |
|
1920 | 1920 | ui.write('%s -- %r\n' % (part.type, repr(part.params))) |
|
1921 |
if part.type == ' |
|
|
1921 | if part.type == 'changegroup': | |
|
1922 | 1922 | version = part.params.get('version', '01') |
|
1923 | 1923 | cg = changegroup.packermap[version][1](part, 'UN') |
|
1924 | 1924 | chunkdata = cg.changelogheader() |
@@ -2211,7 +2211,7 b' def debuggetbundle(ui, repopath, bundlep' | |||
|
2211 | 2211 | btypes = {'none': 'HG10UN', |
|
2212 | 2212 | 'bzip2': 'HG10BZ', |
|
2213 | 2213 | 'gzip': 'HG10GZ', |
|
2214 |
'bundle2': 'HG2 |
|
|
2214 | 'bundle2': 'HG20'} | |
|
2215 | 2215 | bundletype = btypes.get(bundletype) |
|
2216 | 2216 | if bundletype not in changegroup.bundletypes: |
|
2217 | 2217 | raise util.Abort(_('unknown bundle type specified with --type')) |
@@ -49,7 +49,7 b' def buildobsmarkerspart(bundler, markers' | |||
|
49 | 49 | if version is None: |
|
50 | 50 | raise ValueError('bundler do not support common obsmarker format') |
|
51 | 51 | stream = obsolete.encodemarkers(markers, True, version=version) |
|
52 |
return bundler.newpart(' |
|
|
52 | return bundler.newpart('obsmarkers', data=stream) | |
|
53 | 53 | return None |
|
54 | 54 | |
|
55 | 55 | def _canusebundle2(op): |
@@ -57,7 +57,7 b' def _canusebundle2(op):' | |||
|
57 | 57 | |
|
58 | 58 | Feel free to nuke this function when we drop the experimental option""" |
|
59 | 59 | return (op.repo.ui.configbool('experimental', 'bundle2-exp', False) |
|
60 |
and op.remote.capable('bundle2 |
|
|
60 | and op.remote.capable('bundle2')) | |
|
61 | 61 | |
|
62 | 62 | |
|
63 | 63 | class pushoperation(object): |
@@ -459,10 +459,10 b' def _pushb2ctx(pushop, bundler):' | |||
|
459 | 459 | pushop.remote, |
|
460 | 460 | pushop.outgoing) |
|
461 | 461 | if not pushop.force: |
|
462 |
bundler.newpart(' |
|
|
462 | bundler.newpart('check:heads', data=iter(pushop.remoteheads)) | |
|
463 | 463 | b2caps = bundle2.bundle2caps(pushop.remote) |
|
464 | 464 | version = None |
|
465 |
cgversions = b2caps.get(' |
|
|
465 | cgversions = b2caps.get('changegroup') | |
|
466 | 466 | if not cgversions: # 3.1 and 3.2 ship with an empty value |
|
467 | 467 | cg = changegroup.getlocalchangegroupraw(pushop.repo, 'push', |
|
468 | 468 | pushop.outgoing) |
@@ -474,7 +474,7 b' def _pushb2ctx(pushop, bundler):' | |||
|
474 | 474 | cg = changegroup.getlocalchangegroupraw(pushop.repo, 'push', |
|
475 | 475 | pushop.outgoing, |
|
476 | 476 | version=version) |
|
477 |
cgpart = bundler.newpart(' |
|
|
477 | cgpart = bundler.newpart('changegroup', data=cg) | |
|
478 | 478 | if version is not None: |
|
479 | 479 | cgpart.addparam('version', version) |
|
480 | 480 | def handlereply(op): |
@@ -490,13 +490,13 b' def _pushb2phases(pushop, bundler):' | |||
|
490 | 490 | if 'phases' in pushop.stepsdone: |
|
491 | 491 | return |
|
492 | 492 | b2caps = bundle2.bundle2caps(pushop.remote) |
|
493 |
if not ' |
|
|
493 | if not 'pushkey' in b2caps: | |
|
494 | 494 | return |
|
495 | 495 | pushop.stepsdone.add('phases') |
|
496 | 496 | part2node = [] |
|
497 | 497 | enc = pushkey.encode |
|
498 | 498 | for newremotehead in pushop.outdatedphases: |
|
499 |
part = bundler.newpart(' |
|
|
499 | part = bundler.newpart('pushkey') | |
|
500 | 500 | part.addparam('namespace', enc('phases')) |
|
501 | 501 | part.addparam('key', enc(newremotehead.hex())) |
|
502 | 502 | part.addparam('old', enc(str(phases.draft))) |
@@ -533,13 +533,13 b' def _pushb2bookmarks(pushop, bundler):' | |||
|
533 | 533 | if 'bookmarks' in pushop.stepsdone: |
|
534 | 534 | return |
|
535 | 535 | b2caps = bundle2.bundle2caps(pushop.remote) |
|
536 |
if ' |
|
|
536 | if 'pushkey' not in b2caps: | |
|
537 | 537 | return |
|
538 | 538 | pushop.stepsdone.add('bookmarks') |
|
539 | 539 | part2book = [] |
|
540 | 540 | enc = pushkey.encode |
|
541 | 541 | for book, old, new in pushop.outbookmarks: |
|
542 |
part = bundler.newpart(' |
|
|
542 | part = bundler.newpart('pushkey') | |
|
543 | 543 | part.addparam('namespace', enc('bookmarks')) |
|
544 | 544 | part.addparam('key', enc(book)) |
|
545 | 545 | part.addparam('old', enc(old)) |
@@ -583,7 +583,7 b' def _pushbundle2(pushop):' | |||
|
583 | 583 | # create reply capability |
|
584 | 584 | capsblob = bundle2.encodecaps(bundle2.getrepocaps(pushop.repo, |
|
585 | 585 | allowpushback=pushback)) |
|
586 |
bundler.newpart(' |
|
|
586 | bundler.newpart('replycaps', data=capsblob) | |
|
587 | 587 | replyhandlers = [] |
|
588 | 588 | for partgenname in b2partsgenorder: |
|
589 | 589 | partgen = b2partsgenmapping[partgenname] |
@@ -975,7 +975,7 b' def _pullbundle2(pullop):' | |||
|
975 | 975 | kwargs['common'] = pullop.common |
|
976 | 976 | kwargs['heads'] = pullop.heads or pullop.rheads |
|
977 | 977 | kwargs['cg'] = pullop.fetch |
|
978 |
if ' |
|
|
978 | if 'listkeys' in remotecaps: | |
|
979 | 979 | kwargs['listkeys'] = ['phase', 'bookmarks'] |
|
980 | 980 | if not pullop.fetch: |
|
981 | 981 | pullop.repo.ui.status(_("no changes found\n")) |
@@ -1128,7 +1128,7 b' def _pullobsolete(pullop):' | |||
|
1128 | 1128 | |
|
1129 | 1129 | def caps20to10(repo): |
|
1130 | 1130 | """return a set with appropriate options to use bundle20 during getbundle""" |
|
1131 |
caps = set(['HG2 |
|
|
1131 | caps = set(['HG20']) | |
|
1132 | 1132 | capsblob = bundle2.encodecaps(bundle2.getrepocaps(repo)) |
|
1133 | 1133 | caps.add('bundle2=' + urllib.quote(capsblob)) |
|
1134 | 1134 | return caps |
@@ -1161,7 +1161,7 b' def getbundle(repo, source, heads=None, ' | |||
|
1161 | 1161 | **kwargs): |
|
1162 | 1162 | """return a full bundle (with potentially multiple kind of parts) |
|
1163 | 1163 | |
|
1164 |
Could be a bundle HG10 or a bundle HG2 |
|
|
1164 | Could be a bundle HG10 or a bundle HG20 depending on bundlecaps | |
|
1165 | 1165 | passed. For now, the bundle can contain only changegroup, but this will |
|
1166 | 1166 | changes when more part type will be available for bundle2. |
|
1167 | 1167 | |
@@ -1212,7 +1212,7 b' def _getbundlechangegrouppart(bundler, r' | |||
|
1212 | 1212 | if kwargs.get('cg', True): |
|
1213 | 1213 | # build changegroup bundle here. |
|
1214 | 1214 | version = None |
|
1215 |
cgversions = b2caps.get(' |
|
|
1215 | cgversions = b2caps.get('changegroup') | |
|
1216 | 1216 | if not cgversions: # 3.1 and 3.2 ship with an empty value |
|
1217 | 1217 | cg = changegroup.getchangegroupraw(repo, source, heads=heads, |
|
1218 | 1218 | common=common, |
@@ -1228,7 +1228,7 b' def _getbundlechangegrouppart(bundler, r' | |||
|
1228 | 1228 | version=version) |
|
1229 | 1229 | |
|
1230 | 1230 | if cg: |
|
1231 |
part = bundler.newpart(' |
|
|
1231 | part = bundler.newpart('changegroup', data=cg) | |
|
1232 | 1232 | if version is not None: |
|
1233 | 1233 | part.addparam('version', version) |
|
1234 | 1234 | |
@@ -1238,7 +1238,7 b' def _getbundlelistkeysparts(bundler, rep' | |||
|
1238 | 1238 | """add parts containing listkeys namespaces to the requested bundle""" |
|
1239 | 1239 | listkeys = kwargs.get('listkeys', ()) |
|
1240 | 1240 | for namespace in listkeys: |
|
1241 |
part = bundler.newpart(' |
|
|
1241 | part = bundler.newpart('listkeys') | |
|
1242 | 1242 | part.addparam('namespace', namespace) |
|
1243 | 1243 | keys = repo.listkeys(namespace).items() |
|
1244 | 1244 | part.data = pushkey.encodekeys(keys) |
@@ -1288,7 +1288,7 b' def unbundle(repo, cg, heads, source, ur' | |||
|
1288 | 1288 | tr = repo.transaction('unbundle') |
|
1289 | 1289 | tr.hookargs['source'] = source |
|
1290 | 1290 | tr.hookargs['url'] = url |
|
1291 |
tr.hookargs['bundle2 |
|
|
1291 | tr.hookargs['bundle2'] = '1' | |
|
1292 | 1292 | r = bundle2.processbundle(repo, cg, lambda: tr).reply |
|
1293 | 1293 | p = lambda: tr.writepending() and repo.root or "" |
|
1294 | 1294 | repo.hook('b2x-pretransactionclose', throw=True, pending=p, |
@@ -110,7 +110,7 b' class localpeer(peer.peerrepository):' | |||
|
110 | 110 | **kwargs): |
|
111 | 111 | cg = exchange.getbundle(self._repo, source, heads=heads, |
|
112 | 112 | common=common, bundlecaps=bundlecaps, **kwargs) |
|
113 |
if bundlecaps is not None and 'HG2 |
|
|
113 | if bundlecaps is not None and 'HG20' in bundlecaps: | |
|
114 | 114 | # When requesting a bundle2, getbundle returns a stream to make the |
|
115 | 115 | # wire level function happier. We need to build a proper object |
|
116 | 116 | # from it in local peer. |
@@ -317,7 +317,7 b' class localrepository(object):' | |||
|
317 | 317 | if self.ui.configbool('experimental', 'bundle2-exp', False): |
|
318 | 318 | caps = set(caps) |
|
319 | 319 | capsblob = bundle2.encodecaps(bundle2.getrepocaps(self)) |
|
320 |
caps.add('bundle2 |
|
|
320 | caps.add('bundle2=' + urllib.quote(capsblob)) | |
|
321 | 321 | return caps |
|
322 | 322 | |
|
323 | 323 | def _applyrequirements(self, requirements): |
@@ -42,7 +42,7 b' def _bundle(repo, bases, heads, node, su' | |||
|
42 | 42 | name = "%s/%s-%s-%s.hg" % (backupdir, short(node), totalhash[:8], suffix) |
|
43 | 43 | |
|
44 | 44 | if usebundle2: |
|
45 |
bundletype = "HG2 |
|
|
45 | bundletype = "HG20" | |
|
46 | 46 | elif compress: |
|
47 | 47 | bundletype = "HG10BZ" |
|
48 | 48 | else: |
@@ -617,7 +617,7 b' def _capabilities(repo, proto):' | |||
|
617 | 617 | caps.append('streamreqs=%s' % ','.join(requiredformats)) |
|
618 | 618 | if repo.ui.configbool('experimental', 'bundle2-exp', False): |
|
619 | 619 | capsblob = bundle2.encodecaps(bundle2.getrepocaps(repo)) |
|
620 |
caps.append('bundle2 |
|
|
620 | caps.append('bundle2=' + urllib.quote(capsblob)) | |
|
621 | 621 | caps.append('unbundle=%s' % ','.join(changegroupmod.bundlepriority)) |
|
622 | 622 | caps.append('httpheader=1024') |
|
623 | 623 | return caps |
@@ -843,7 +843,7 b' def unbundle(repo, proto, heads):' | |||
|
843 | 843 | os.unlink(tempname) |
|
844 | 844 | except error.BundleValueError, exc: |
|
845 | 845 | bundler = bundle2.bundle20(repo.ui) |
|
846 |
errpart = bundler.newpart(' |
|
|
846 | errpart = bundler.newpart('error:unsupportedcontent') | |
|
847 | 847 | if exc.parttype is not None: |
|
848 | 848 | errpart.addparam('parttype', exc.parttype) |
|
849 | 849 | if exc.params: |
@@ -860,7 +860,7 b' def unbundle(repo, proto, heads):' | |||
|
860 | 860 | advargs = [] |
|
861 | 861 | if inst.hint is not None: |
|
862 | 862 | advargs.append(('hint', inst.hint)) |
|
863 |
bundler.addpart(bundle2.bundlepart(' |
|
|
863 | bundler.addpart(bundle2.bundlepart('error:abort', | |
|
864 | 864 | manargs, advargs)) |
|
865 | 865 | return streamres(bundler.getchunks()) |
|
866 | 866 | else: |
@@ -869,7 +869,7 b' def unbundle(repo, proto, heads):' | |||
|
869 | 869 | except error.PushRaced, exc: |
|
870 | 870 | if getattr(exc, 'duringunbundle2', False): |
|
871 | 871 | bundler = bundle2.bundle20(repo.ui) |
|
872 |
bundler.newpart(' |
|
|
872 | bundler.newpart('error:pushraced', [('message', str(exc))]) | |
|
873 | 873 | return streamres(bundler.getchunks()) |
|
874 | 874 | else: |
|
875 | 875 | return pusherr(str(exc)) |
@@ -220,7 +220,7 b' push' | |||
|
220 | 220 | lock: free |
|
221 | 221 | wlock: free |
|
222 | 222 | postclose-tip:eea13746799a public book_eea1 |
|
223 |
txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2 |
|
|
223 | txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_NEW_OBSMARKERS=1 HG_NODE=eea13746799a9e0bfd88f29d3c2e9dc9389f524f HG_PHASES_MOVED=1 HG_SOURCE=push HG_TXNNAME=unbundle HG_URL=push | |
|
224 | 224 | remote: adding changesets |
|
225 | 225 | remote: adding manifests |
|
226 | 226 | remote: adding file changes |
@@ -310,7 +310,7 b' push over ssh' | |||
|
310 | 310 | remote: lock: free |
|
311 | 311 | remote: wlock: free |
|
312 | 312 | remote: postclose-tip:5fddd98957c8 draft book_5fdd |
|
313 |
remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2 |
|
|
313 | remote: txnclose hook: HG_BOOKMARK_MOVED=1 HG_BUNDLE2=1 HG_NEW_OBSMARKERS=1 HG_NODE=5fddd98957c8a54a4d436dfe1da9d87f21a1b97b HG_SOURCE=serve HG_TXNNAME=unbundle HG_URL=remote:ssh:127.0.0.1 | |
|
314 | 314 | pre-close-tip:02de42196ebe draft book_02de |
|
315 | 315 | postclose-tip:02de42196ebe draft book_02de |
|
316 | 316 | txnclose hook: HG_SOURCE=push-response HG_TXNNAME=push-response |
@@ -426,7 +426,7 b' Setting up' | |||
|
426 | 426 | > bundler.newpart('test:unknown') |
|
427 | 427 | > if reason == 'race': |
|
428 | 428 | > # 20 Bytes of crap |
|
429 |
> bundler.newpart(' |
|
|
429 | > bundler.newpart('check:heads', data='01234567890123456789') | |
|
430 | 430 | > |
|
431 | 431 | > @bundle2.parthandler("test:abort") |
|
432 | 432 | > def handleabort(op, part): |
@@ -92,11 +92,11 b' Create an extension to test bundle2 API' | |||
|
92 | 92 | > |
|
93 | 93 | > if opts['reply']: |
|
94 | 94 | > capsstring = 'ping-pong\nelephants=babar,celeste\ncity%3D%21=celeste%2Cville' |
|
95 |
> bundler.newpart(' |
|
|
95 | > bundler.newpart('replycaps', data=capsstring) | |
|
96 | 96 | > |
|
97 | 97 | > if opts['pushrace']: |
|
98 | 98 | > # also serve to test the assignement of data outside of init |
|
99 |
> part = bundler.newpart(' |
|
|
99 | > part = bundler.newpart('check:heads') | |
|
100 | 100 | > part.data = '01234567890123456789' |
|
101 | 101 | > |
|
102 | 102 | > revs = opts['rev'] |
@@ -109,7 +109,7 b' Create an extension to test bundle2 API' | |||
|
109 | 109 | > headcommon = [c.node() for c in repo.set('parents(%ld) - %ld', revs, revs)] |
|
110 | 110 | > outgoing = discovery.outgoing(repo.changelog, headcommon, headmissing) |
|
111 | 111 | > cg = changegroup.getlocalchangegroup(repo, 'test:bundle2', outgoing, None) |
|
112 |
> bundler.newpart(' |
|
|
112 | > bundler.newpart('changegroup', data=cg.getchunks(), | |
|
113 | 113 | > mandatory=False) |
|
114 | 114 | > |
|
115 | 115 | > if opts['parts']: |
@@ -136,7 +136,7 b' Create an extension to test bundle2 API' | |||
|
136 | 136 | > def genraise(): |
|
137 | 137 | > yield 'first line\n' |
|
138 | 138 | > raise RuntimeError('Someone set up us the bomb!') |
|
139 |
> bundler.newpart(' |
|
|
139 | > bundler.newpart('output', data=genraise(), mandatory=False) | |
|
140 | 140 | > |
|
141 | 141 | > if path is None: |
|
142 | 142 | > file = sys.stdout |
@@ -237,7 +237,7 b' Empty bundle' | |||
|
237 | 237 | Test bundling |
|
238 | 238 | |
|
239 | 239 | $ hg bundle2 |
|
240 |
HG2 |
|
|
240 | HG20\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc) | |
|
241 | 241 | |
|
242 | 242 | Test unbundling |
|
243 | 243 | |
@@ -267,7 +267,7 b' Simplest possible parameters form' | |||
|
267 | 267 | Test generation simple option |
|
268 | 268 | |
|
269 | 269 | $ hg bundle2 --param 'caution' |
|
270 |
HG2 |
|
|
270 | HG20\x00\x00\x00\x07caution\x00\x00\x00\x00 (no-eol) (esc) | |
|
271 | 271 | |
|
272 | 272 | Test unbundling |
|
273 | 273 | |
@@ -279,7 +279,7 b' Test unbundling' | |||
|
279 | 279 | Test generation multiple option |
|
280 | 280 | |
|
281 | 281 | $ hg bundle2 --param 'caution' --param 'meal' |
|
282 |
HG2 |
|
|
282 | HG20\x00\x00\x00\x0ccaution meal\x00\x00\x00\x00 (no-eol) (esc) | |
|
283 | 283 | |
|
284 | 284 | Test unbundling |
|
285 | 285 | |
@@ -295,7 +295,7 b' advisory parameters, with value' | |||
|
295 | 295 | Test generation |
|
296 | 296 | |
|
297 | 297 | $ hg bundle2 --param 'caution' --param 'meal=vegan' --param 'elephants' |
|
298 |
HG2 |
|
|
298 | HG20\x00\x00\x00\x1ccaution meal=vegan elephants\x00\x00\x00\x00 (no-eol) (esc) | |
|
299 | 299 | |
|
300 | 300 | Test unbundling |
|
301 | 301 | |
@@ -313,7 +313,7 b' parameter with special char in value' | |||
|
313 | 313 | Test generation |
|
314 | 314 | |
|
315 | 315 | $ hg bundle2 --param 'e|! 7/=babar%#==tutu' --param simple |
|
316 |
HG2 |
|
|
316 | HG20\x00\x00\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00\x00\x00 (no-eol) (esc) | |
|
317 | 317 | |
|
318 | 318 | Test unbundling |
|
319 | 319 | |
@@ -337,7 +337,7 b' Test debug output' | |||
|
337 | 337 | bundling debug |
|
338 | 338 | |
|
339 | 339 | $ hg bundle2 --debug --param 'e|! 7/=babar%#==tutu' --param simple ../out.hg2 |
|
340 |
start emission of HG2 |
|
|
340 | start emission of HG20 stream | |
|
341 | 341 | bundle parameter: e%7C%21%207/=babar%25%23%3D%3Dtutu simple |
|
342 | 342 | start of parts |
|
343 | 343 | end of bundle |
@@ -345,12 +345,12 b' bundling debug' | |||
|
345 | 345 | file content is ok |
|
346 | 346 | |
|
347 | 347 | $ cat ../out.hg2 |
|
348 |
HG2 |
|
|
348 | HG20\x00\x00\x00)e%7C%21%207/=babar%25%23%3D%3Dtutu simple\x00\x00\x00\x00 (no-eol) (esc) | |
|
349 | 349 | |
|
350 | 350 | unbundling debug |
|
351 | 351 | |
|
352 | 352 | $ hg statbundle2 --debug < ../out.hg2 |
|
353 |
start processing of HG2 |
|
|
353 | start processing of HG20 stream | |
|
354 | 354 | reading bundle2 stream parameters |
|
355 | 355 | ignoring unknown parameter 'e|! 7/' |
|
356 | 356 | ignoring unknown parameter 'simple' |
@@ -384,7 +384,7 b' Test part' | |||
|
384 | 384 | ================= |
|
385 | 385 | |
|
386 | 386 | $ hg bundle2 --parts ../parts.hg2 --debug |
|
387 |
start emission of HG2 |
|
|
387 | start emission of HG20 stream | |
|
388 | 388 | bundle parameter: |
|
389 | 389 | start of parts |
|
390 | 390 | bundle part: "test:empty" |
@@ -397,7 +397,7 b' Test part' | |||
|
397 | 397 | end of bundle |
|
398 | 398 | |
|
399 | 399 | $ cat ../parts.hg2 |
|
400 |
HG2 |
|
|
400 | HG20\x00\x00\x00\x00\x00\x00\x00\x11 (esc) | |
|
401 | 401 | test:empty\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x11 (esc) |
|
402 | 402 | test:empty\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10 test:song\x00\x00\x00\x02\x00\x00\x00\x00\x00\xb2Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko (esc) |
|
403 | 403 | Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
@@ -437,7 +437,7 b' Test part' | |||
|
437 | 437 | parts count: 7 |
|
438 | 438 | |
|
439 | 439 | $ hg statbundle2 --debug < ../parts.hg2 |
|
440 |
start processing of HG2 |
|
|
440 | start processing of HG20 stream | |
|
441 | 441 | reading bundle2 stream parameters |
|
442 | 442 | options count: 0 |
|
443 | 443 | start extraction of bundle2 parts |
@@ -516,7 +516,7 b' Test actual unbundling of test part' | |||
|
516 | 516 | Process the bundle |
|
517 | 517 | |
|
518 | 518 | $ hg unbundle2 --debug < ../parts.hg2 |
|
519 |
start processing of HG2 |
|
|
519 | start processing of HG20 stream | |
|
520 | 520 | reading bundle2 stream parameters |
|
521 | 521 | start extraction of bundle2 parts |
|
522 | 522 | part header size: 17 |
@@ -610,21 +610,18 b' unbundle with a reply' | |||
|
610 | 610 | The reply is a bundle |
|
611 | 611 | |
|
612 | 612 | $ cat ../reply.hg2 |
|
613 | HG2Y\x00\x00\x00\x00\x00\x00\x00\x1f (esc) | |
|
614 | b2x:output\x00\x00\x00\x00\x00\x01\x0b\x01in-reply-to3\x00\x00\x00\xd9The choir starts singing: (esc) | |
|
613 | HG20\x00\x00\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x00\x00\x01\x0b\x01in-reply-to3\x00\x00\x00\xd9The choir starts singing: (esc) | |
|
615 | 614 | Patali Dirapata, Cromda Cromda Ripalo, Pata Pata, Ko Ko Ko |
|
616 | 615 | Bokoro Dipoulito, Rondi Rondi Pepino, Pata Pata, Ko Ko Ko |
|
617 | 616 | Emana Karassoli, Loucra Loucra Ponponto, Pata Pata, Ko Ko Ko. |
|
618 | \x00\x00\x00\x00\x00\x00\x00\x1f (esc) | |
|
619 | b2x:output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to4\x00\x00\x00\xc9debugreply: capabilities: (esc) | |
|
617 | \x00\x00\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to4\x00\x00\x00\xc9debugreply: capabilities: (esc) | |
|
620 | 618 | debugreply: 'city=!' |
|
621 | 619 | debugreply: 'celeste,ville' |
|
622 | 620 | debugreply: 'elephants' |
|
623 | 621 | debugreply: 'babar' |
|
624 | 622 | debugreply: 'celeste' |
|
625 | 623 | debugreply: 'ping-pong' |
|
626 |
\x00\x00\x00\x00\x00\x00\x00\x1e test:pong\x00\x00\x00\x02\x01\x00\x0b\x01in-reply-to7\x00\x00\x00\x00\x00\x00\x00\x1 |
|
|
627 | b2x:output\x00\x00\x00\x03\x00\x01\x0b\x01in-reply-to7\x00\x00\x00=received ping request (id 7) (esc) | |
|
624 | \x00\x00\x00\x00\x00\x00\x00\x1e test:pong\x00\x00\x00\x02\x01\x00\x0b\x01in-reply-to7\x00\x00\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x03\x00\x01\x0b\x01in-reply-to7\x00\x00\x00=received ping request (id 7) (esc) | |
|
628 | 625 | replying to ping request (id 7) |
|
629 | 626 | \x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc) |
|
630 | 627 | |
@@ -632,11 +629,11 b' The reply is valid' | |||
|
632 | 629 | |
|
633 | 630 | $ hg statbundle2 < ../reply.hg2 |
|
634 | 631 | options count: 0 |
|
635 |
|
|
|
632 | :output: | |
|
636 | 633 | mandatory: 0 |
|
637 | 634 | advisory: 1 |
|
638 | 635 | payload: 217 bytes |
|
639 |
|
|
|
636 | :output: | |
|
640 | 637 | mandatory: 0 |
|
641 | 638 | advisory: 1 |
|
642 | 639 | payload: 201 bytes |
@@ -644,7 +641,7 b' The reply is valid' | |||
|
644 | 641 | mandatory: 1 |
|
645 | 642 | advisory: 0 |
|
646 | 643 | payload: 0 bytes |
|
647 |
|
|
|
644 | :output: | |
|
648 | 645 | mandatory: 0 |
|
649 | 646 | advisory: 1 |
|
650 | 647 | payload: 61 bytes |
@@ -714,10 +711,10 b' Support for changegroup' | |||
|
714 | 711 | 9520eea781bcca16c1e15acc0ba14335a0e8e5ba |
|
715 | 712 | eea13746799a9e0bfd88f29d3c2e9dc9389f524f |
|
716 | 713 | 02de42196ebee42ef284b6780a87cdc96e8eaab6 |
|
717 |
start emission of HG2 |
|
|
714 | start emission of HG20 stream | |
|
718 | 715 | bundle parameter: |
|
719 | 716 | start of parts |
|
720 |
bundle part: " |
|
|
717 | bundle part: "changegroup" | |
|
721 | 718 | bundling: 1/4 changesets (25.00%) |
|
722 | 719 | bundling: 2/4 changesets (50.00%) |
|
723 | 720 | bundling: 3/4 changesets (75.00%) |
@@ -732,7 +729,7 b' Support for changegroup' | |||
|
732 | 729 | end of bundle |
|
733 | 730 | |
|
734 | 731 | $ cat ../rev.hg2 |
|
735 |
HG2 |
|
|
732 | HG20\x00\x00\x00\x00\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) | |
|
736 | 733 | \x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x02D (esc) |
|
737 | 734 | \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) |
|
738 | 735 | \x00\x00\x00f\x00\x00\x00h\x00\x00\x00\x02E (esc) |
@@ -757,7 +754,7 b' Support for changegroup' | |||
|
757 | 754 | |
|
758 | 755 | $ hg debugbundle ../rev.hg2 |
|
759 | 756 | Stream params: {} |
|
760 |
|
|
|
757 | changegroup -- '{}' | |
|
761 | 758 | 32af7686d403cf45b5d95f2d70cebea587ac806a |
|
762 | 759 | 9520eea781bcca16c1e15acc0ba14335a0e8e5ba |
|
763 | 760 | eea13746799a9e0bfd88f29d3c2e9dc9389f524f |
@@ -776,8 +773,7 b' with reply' | |||
|
776 | 773 | addchangegroup return: 1 |
|
777 | 774 | |
|
778 | 775 | $ cat ../rev-reply.hg2 |
|
779 | HG2Y\x00\x00\x00\x00\x00\x00\x003\x15b2x:reply:changegroup\x00\x00\x00\x00\x00\x02\x0b\x01\x06\x01in-reply-to1return1\x00\x00\x00\x00\x00\x00\x00\x1f (esc) | |
|
780 | b2x:output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to1\x00\x00\x00dadding changesets (esc) | |
|
776 | HG20\x00\x00\x00\x00\x00\x00\x00/\x11reply:changegroup\x00\x00\x00\x00\x00\x02\x0b\x01\x06\x01in-reply-to1return1\x00\x00\x00\x00\x00\x00\x00\x1b\x06output\x00\x00\x00\x01\x00\x01\x0b\x01in-reply-to1\x00\x00\x00dadding changesets (esc) | |
|
781 | 777 | adding manifests |
|
782 | 778 | adding file changes |
|
783 | 779 | added 0 changesets with 0 changes to 3 files |
@@ -793,8 +789,8 b' Check handling of exception during gener' | |||
|
793 | 789 | Should still be a valid bundle |
|
794 | 790 | |
|
795 | 791 | $ cat ../genfailed.hg2 |
|
796 |
HG2 |
|
|
797 |
|
|
|
792 | HG20\x00\x00\x00\x00\x00\x00\x00\r (no-eol) (esc) | |
|
793 | \x06output\x00\x00\x00\x00\x00\x00\xff\xff\xff\xff\x00\x00\x00H\x0berror:abort\x00\x00\x00\x00\x01\x00\x07-messageunexpected error: Someone set up us the bomb!\x00\x00\x00\x00\x00\x00\x00\x00 (no-eol) (esc) | |
|
798 | 794 | |
|
799 | 795 | And its handling on the other size raise a clean exception |
|
800 | 796 |
@@ -14,13 +14,13 b' Create an extension to test bundle2 with' | |||
|
14 | 14 | > intermediates = [repo[r].p1().node() for r in heads] |
|
15 | 15 | > cg = changegroup.getchangegroup(repo, source, heads=intermediates, |
|
16 | 16 | > common=common, bundlecaps=bundlecaps) |
|
17 |
> bundler.newpart(' |
|
|
18 |
> bundler.newpart(' |
|
|
17 | > bundler.newpart('output', data='changegroup1') | |
|
18 | > bundler.newpart('changegroup', data=cg.getchunks()) | |
|
19 | 19 | > cg = changegroup.getchangegroup(repo, source, heads=heads, |
|
20 | 20 | > common=common + intermediates, |
|
21 | 21 | > bundlecaps=bundlecaps) |
|
22 |
> bundler.newpart(' |
|
|
23 |
> bundler.newpart(' |
|
|
22 | > bundler.newpart('output', data='changegroup2') | |
|
23 | > bundler.newpart('changegroup', data=cg.getchunks()) | |
|
24 | 24 | > |
|
25 | 25 | > def _pull(repo, *args, **kwargs): |
|
26 | 26 | > pullop = _orig_pull(repo, *args, **kwargs) |
@@ -6,21 +6,21 b'' | |||
|
6 | 6 | > from mercurial import bundle2, pushkey, exchange, util |
|
7 | 7 | > def _newhandlechangegroup(op, inpart): |
|
8 | 8 | > """This function wraps the changegroup part handler for getbundle. |
|
9 |
> It issues an additional |
|
|
9 | > It issues an additional pushkey part to send a new | |
|
10 | 10 | > bookmark back to the client""" |
|
11 | 11 | > result = bundle2.handlechangegroup(op, inpart) |
|
12 |
> if ' |
|
|
12 | > if 'pushback' in op.reply.capabilities: | |
|
13 | 13 | > params = {'namespace': 'bookmarks', |
|
14 | 14 | > 'key': 'new-server-mark', |
|
15 | 15 | > 'old': '', |
|
16 | 16 | > 'new': 'tip'} |
|
17 | 17 | > encodedparams = [(k, pushkey.encode(v)) for (k,v) in params.items()] |
|
18 |
> op.reply.newpart(' |
|
|
18 | > op.reply.newpart('pushkey', mandatoryparams=encodedparams) | |
|
19 | 19 | > else: |
|
20 |
> op.reply.newpart(' |
|
|
20 | > op.reply.newpart('output', data='pushback not enabled') | |
|
21 | 21 | > return result |
|
22 | 22 | > _newhandlechangegroup.params = bundle2.handlechangegroup.params |
|
23 |
> bundle2.parthandlermapping[' |
|
|
23 | > bundle2.parthandlermapping['changegroup'] = _newhandlechangegroup | |
|
24 | 24 | > EOF |
|
25 | 25 | |
|
26 | 26 | $ cat >> $HGRCPATH <<EOF |
@@ -35,7 +35,7 b' Create an extension to test bundle2 remo' | |||
|
35 | 35 | > def newpart(name, data=''): |
|
36 | 36 | > """wrapper around bundler.newpart adding an extra part making the |
|
37 | 37 | > client output information about each processed part""" |
|
38 |
> bundler.newpart(' |
|
|
38 | > bundler.newpart('output', data=name) | |
|
39 | 39 | > part = bundler.newpart(name, data=data) |
|
40 | 40 | > return part |
|
41 | 41 | > |
@@ -50,13 +50,13 b' Create an extension to test bundle2 remo' | |||
|
50 | 50 | > bundledata = open(file, 'rb').read() |
|
51 | 51 | > digest = util.digester.preferred(b2caps['digests']) |
|
52 | 52 | > d = util.digester([digest], bundledata) |
|
53 |
> part = newpart(' |
|
|
53 | > part = newpart('remote-changegroup') | |
|
54 | 54 | > part.addparam('url', url) |
|
55 | 55 | > part.addparam('size', str(len(bundledata))) |
|
56 | 56 | > part.addparam('digests', digest) |
|
57 | 57 | > part.addparam('digest:%s' % digest, d[digest]) |
|
58 | 58 | > elif verb == 'raw-remote-changegroup': |
|
59 |
> part = newpart(' |
|
|
59 | > part = newpart('remote-changegroup') | |
|
60 | 60 | > for k, v in eval(args).items(): |
|
61 | 61 | > part.addparam(k, str(v)) |
|
62 | 62 | > elif verb == 'changegroup': |
@@ -65,7 +65,7 b' Create an extension to test bundle2 remo' | |||
|
65 | 65 | > heads = [repo.lookup(r) for r in repo.revs(heads)] |
|
66 | 66 | > cg = changegroup.getchangegroup(repo, 'changegroup', |
|
67 | 67 | > heads=heads, common=common) |
|
68 |
> newpart(' |
|
|
68 | > newpart('changegroup', cg.getchunks()) | |
|
69 | 69 | > else: |
|
70 | 70 | > raise Exception('unknown verb') |
|
71 | 71 | > |
@@ -137,7 +137,7 b' Test a pull with an remote-changegroup' | |||
|
137 | 137 | $ hg pull -R clone ssh://user@dummy/repo |
|
138 | 138 | pulling from ssh://user@dummy/repo |
|
139 | 139 | searching for changes |
|
140 |
remote: |
|
|
140 | remote: remote-changegroup | |
|
141 | 141 | adding changesets |
|
142 | 142 | adding manifests |
|
143 | 143 | adding file changes |
@@ -180,12 +180,12 b' Test a pull with an remote-changegroup a' | |||
|
180 | 180 | $ hg pull -R clone ssh://user@dummy/repo |
|
181 | 181 | pulling from ssh://user@dummy/repo |
|
182 | 182 | searching for changes |
|
183 |
remote: |
|
|
183 | remote: remote-changegroup | |
|
184 | 184 | adding changesets |
|
185 | 185 | adding manifests |
|
186 | 186 | adding file changes |
|
187 | 187 | added 2 changesets with 2 changes to 2 files (+1 heads) |
|
188 |
remote: |
|
|
188 | remote: changegroup | |
|
189 | 189 | adding changesets |
|
190 | 190 | adding manifests |
|
191 | 191 | adding file changes |
@@ -228,12 +228,12 b' Test a pull with a changegroup followed ' | |||
|
228 | 228 | $ hg pull -R clone ssh://user@dummy/repo |
|
229 | 229 | pulling from ssh://user@dummy/repo |
|
230 | 230 | searching for changes |
|
231 |
remote: |
|
|
231 | remote: changegroup | |
|
232 | 232 | adding changesets |
|
233 | 233 | adding manifests |
|
234 | 234 | adding file changes |
|
235 | 235 | added 2 changesets with 2 changes to 2 files (+1 heads) |
|
236 |
remote: |
|
|
236 | remote: remote-changegroup | |
|
237 | 237 | adding changesets |
|
238 | 238 | adding manifests |
|
239 | 239 | adding file changes |
@@ -279,17 +279,17 b' Test a pull with two remote-changegroups' | |||
|
279 | 279 | $ hg pull -R clone ssh://user@dummy/repo |
|
280 | 280 | pulling from ssh://user@dummy/repo |
|
281 | 281 | searching for changes |
|
282 |
remote: |
|
|
282 | remote: remote-changegroup | |
|
283 | 283 | adding changesets |
|
284 | 284 | adding manifests |
|
285 | 285 | adding file changes |
|
286 | 286 | added 2 changesets with 2 changes to 2 files (+1 heads) |
|
287 |
remote: |
|
|
287 | remote: remote-changegroup | |
|
288 | 288 | adding changesets |
|
289 | 289 | adding manifests |
|
290 | 290 | adding file changes |
|
291 | 291 | added 2 changesets with 1 changes to 1 files |
|
292 |
remote: |
|
|
292 | remote: changegroup | |
|
293 | 293 | adding changesets |
|
294 | 294 | adding manifests |
|
295 | 295 | adding file changes |
@@ -324,7 +324,7 b' Hash digest tests' | |||
|
324 | 324 | > EOF |
|
325 | 325 | $ hg clone ssh://user@dummy/repo clone |
|
326 | 326 | requesting all changes |
|
327 |
remote: |
|
|
327 | remote: remote-changegroup | |
|
328 | 328 | adding changesets |
|
329 | 329 | adding manifests |
|
330 | 330 | adding file changes |
@@ -338,7 +338,7 b' Hash digest tests' | |||
|
338 | 338 | > EOF |
|
339 | 339 | $ hg clone ssh://user@dummy/repo clone |
|
340 | 340 | requesting all changes |
|
341 |
remote: |
|
|
341 | remote: remote-changegroup | |
|
342 | 342 | adding changesets |
|
343 | 343 | adding manifests |
|
344 | 344 | adding file changes |
@@ -354,7 +354,7 b' Hash digest mismatch throws an error' | |||
|
354 | 354 | > EOF |
|
355 | 355 |
$ |
|
356 | 356 | requesting all changes |
|
357 |
remote: |
|
|
357 | remote: remote-changegroup | |
|
358 | 358 | adding changesets |
|
359 | 359 | adding manifests |
|
360 | 360 | adding file changes |
@@ -372,7 +372,7 b' Multiple hash digests can be given' | |||
|
372 | 372 | > EOF |
|
373 | 373 | $ hg clone ssh://user@dummy/repo clone |
|
374 | 374 | requesting all changes |
|
375 |
remote: |
|
|
375 | remote: remote-changegroup | |
|
376 | 376 | adding changesets |
|
377 | 377 | adding manifests |
|
378 | 378 | adding file changes |
@@ -388,7 +388,7 b' If either of the multiple hash digests m' | |||
|
388 | 388 | > EOF |
|
389 | 389 |
$ |
|
390 | 390 | requesting all changes |
|
391 |
remote: |
|
|
391 | remote: remote-changegroup | |
|
392 | 392 | adding changesets |
|
393 | 393 | adding manifests |
|
394 | 394 | adding file changes |
@@ -404,7 +404,7 b' If either of the multiple hash digests m' | |||
|
404 | 404 | > EOF |
|
405 | 405 | $ hg clone ssh://user@dummy/repo clone |
|
406 | 406 | requesting all changes |
|
407 |
remote: |
|
|
407 | remote: remote-changegroup | |
|
408 | 408 | adding changesets |
|
409 | 409 | adding manifests |
|
410 | 410 | adding file changes |
@@ -433,12 +433,12 b' Corruption tests' | |||
|
433 | 433 | $ hg pull -R clone ssh://user@dummy/repo |
|
434 | 434 | pulling from ssh://user@dummy/repo |
|
435 | 435 | searching for changes |
|
436 |
remote: |
|
|
436 | remote: remote-changegroup | |
|
437 | 437 | adding changesets |
|
438 | 438 | adding manifests |
|
439 | 439 | adding file changes |
|
440 | 440 | added 2 changesets with 2 changes to 2 files (+1 heads) |
|
441 |
remote: |
|
|
441 | remote: remote-changegroup | |
|
442 | 442 | adding changesets |
|
443 | 443 | adding manifests |
|
444 | 444 | adding file changes |
@@ -467,7 +467,7 b' No params' | |||
|
467 | 467 | $ hg pull -R clone ssh://user@dummy/repo |
|
468 | 468 | pulling from ssh://user@dummy/repo |
|
469 | 469 | searching for changes |
|
470 |
remote: |
|
|
470 | remote: remote-changegroup | |
|
471 | 471 | abort: remote-changegroup: missing "url" param |
|
472 | 472 | [255] |
|
473 | 473 | |
@@ -479,7 +479,7 b' Missing size' | |||
|
479 | 479 | $ hg pull -R clone ssh://user@dummy/repo |
|
480 | 480 | pulling from ssh://user@dummy/repo |
|
481 | 481 | searching for changes |
|
482 |
remote: |
|
|
482 | remote: remote-changegroup | |
|
483 | 483 | abort: remote-changegroup: missing "size" param |
|
484 | 484 | [255] |
|
485 | 485 | |
@@ -491,7 +491,7 b' Invalid size' | |||
|
491 | 491 | $ hg pull -R clone ssh://user@dummy/repo |
|
492 | 492 | pulling from ssh://user@dummy/repo |
|
493 | 493 | searching for changes |
|
494 |
remote: |
|
|
494 | remote: remote-changegroup | |
|
495 | 495 | abort: remote-changegroup: invalid value for param "size" |
|
496 | 496 | [255] |
|
497 | 497 | |
@@ -503,7 +503,7 b' Size mismatch' | |||
|
503 | 503 | $ hg pull -R clone ssh://user@dummy/repo |
|
504 | 504 | pulling from ssh://user@dummy/repo |
|
505 | 505 | searching for changes |
|
506 |
remote: |
|
|
506 | remote: remote-changegroup | |
|
507 | 507 | adding changesets |
|
508 | 508 | adding manifests |
|
509 | 509 | adding file changes |
@@ -522,8 +522,8 b' Unknown digest' | |||
|
522 | 522 | $ hg pull -R clone ssh://user@dummy/repo |
|
523 | 523 | pulling from ssh://user@dummy/repo |
|
524 | 524 | searching for changes |
|
525 |
remote: |
|
|
526 |
abort: missing support for |
|
|
525 | remote: remote-changegroup | |
|
526 | abort: missing support for remote-changegroup - digest:foo | |
|
527 | 527 | [255] |
|
528 | 528 | |
|
529 | 529 | Missing digest |
@@ -534,7 +534,7 b' Missing digest' | |||
|
534 | 534 | $ hg pull -R clone ssh://user@dummy/repo |
|
535 | 535 | pulling from ssh://user@dummy/repo |
|
536 | 536 | searching for changes |
|
537 |
remote: |
|
|
537 | remote: remote-changegroup | |
|
538 | 538 | abort: remote-changegroup: missing "digest:sha1" param |
|
539 | 539 | [255] |
|
540 | 540 | |
@@ -546,7 +546,7 b' Not an HTTP url' | |||
|
546 | 546 | $ hg pull -R clone ssh://user@dummy/repo |
|
547 | 547 | pulling from ssh://user@dummy/repo |
|
548 | 548 | searching for changes |
|
549 |
remote: |
|
|
549 | remote: remote-changegroup | |
|
550 | 550 | abort: remote-changegroup does not support ssh urls |
|
551 | 551 | [255] |
|
552 | 552 | |
@@ -561,14 +561,14 b' Not a bundle' | |||
|
561 | 561 | $ hg pull -R clone ssh://user@dummy/repo |
|
562 | 562 | pulling from ssh://user@dummy/repo |
|
563 | 563 | searching for changes |
|
564 |
remote: |
|
|
564 | remote: remote-changegroup | |
|
565 | 565 | abort: http://localhost:$HGPORT/notbundle.hg: not a Mercurial bundle |
|
566 | 566 | [255] |
|
567 | 567 | |
|
568 | 568 | Not a bundle 1.0 |
|
569 | 569 | |
|
570 | 570 | $ cat > notbundle10.hg << EOF |
|
571 |
> HG2 |
|
|
571 | > HG20 | |
|
572 | 572 | > EOF |
|
573 | 573 | $ cat > repo/.hg/bundle2maker << EOF |
|
574 | 574 | > remote-changegroup http://localhost:$HGPORT/notbundle10.hg notbundle10.hg |
@@ -576,7 +576,7 b' Not a bundle 1.0' | |||
|
576 | 576 | $ hg pull -R clone ssh://user@dummy/repo |
|
577 | 577 | pulling from ssh://user@dummy/repo |
|
578 | 578 | searching for changes |
|
579 |
remote: |
|
|
579 | remote: remote-changegroup | |
|
580 | 580 | abort: http://localhost:$HGPORT/notbundle10.hg: not a bundle version 1.0 |
|
581 | 581 | [255] |
|
582 | 582 |
@@ -170,7 +170,7 b' Get branch and merge:' | |||
|
170 | 170 | $ hg debuggetbundle repo bundle -t bundle2 |
|
171 | 171 | $ hg debugbundle bundle |
|
172 | 172 | Stream params: {} |
|
173 |
|
|
|
173 | changegroup -- "{'version': '01'}" | |
|
174 | 174 | 7704483d56b2a7b5db54dcee7c62378ac629b348 |
|
175 | 175 | 29a4d1f17bd3f0779ca0525bebb1cfb51067c738 |
|
176 | 176 | 713346a995c363120712aed1aee7e04afd867638 |
@@ -218,7 +218,7 b'' | |||
|
218 | 218 | |
|
219 | 219 | $ hg debugbundle .hg/strip-backup/* |
|
220 | 220 | Stream params: {} |
|
221 |
|
|
|
221 | changegroup -- "{'version': '02'}" | |
|
222 | 222 | 264128213d290d868c54642d13aeaa3675551a78 |
|
223 | 223 | $ hg incoming .hg/strip-backup/* |
|
224 | 224 | comparing with .hg/strip-backup/264128213d29-0b39d6bf-backup.hg |
@@ -244,7 +244,7 b'' | |||
|
244 | 244 | |
|
245 | 245 | $ hg debugbundle .hg/strip-backup/* |
|
246 | 246 | Stream params: {} |
|
247 |
|
|
|
247 | changegroup -- "{'version': '02'}" | |
|
248 | 248 | 264128213d290d868c54642d13aeaa3675551a78 |
|
249 | 249 | $ hg pull .hg/strip-backup/* |
|
250 | 250 | pulling from .hg/strip-backup/264128213d29-0b39d6bf-backup.hg |
General Comments 0
You need to be logged in to leave comments.
Login now