Use the same pre-encoded normalization as bundlespecs for the stream v2 part
requirements. As it touch the wire protocol, it needs to change before the
release.
This was spotted by Gregory Szorc.
hg-reviewers |
Use the same pre-encoded normalization as bundlespecs for the stream v2 part
requirements. As it touch the wire protocol, it needs to change before the
release.
This was spotted by Gregory Szorc.
Lint Skipped |
Unit Tests Skipped |
I queued these first two for stable because of backwards compatibility concerns for the wire protocol. As much as it pains me to say it, the rest of the series doesn't seem appropriate for stable (even though I wish we had the functionality in 4.5).
Path | Packages | |||
---|---|---|---|---|
M | mercurial/bundle2.py (2 lines) | |||
M | mercurial/exchange.py (2 lines) | |||
M | tests/test-clone-uncompressed.t (28 lines) |
Status | Author | Revision | |
---|---|---|---|
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan | ||
Closed | lothiraldan |
# they came from the --pushvar flag. | # they came from the --pushvar flag. | ||||
key = "USERVAR_" + key | key = "USERVAR_" + key | ||||
hookargs[key] = value | hookargs[key] = value | ||||
op.addhookargs(hookargs) | op.addhookargs(hookargs) | ||||
@parthandler('stream2', ('requirements', 'filecount', 'bytecount')) | @parthandler('stream2', ('requirements', 'filecount', 'bytecount')) | ||||
def handlestreamv2bundle(op, part): | def handlestreamv2bundle(op, part): | ||||
requirements = part.params['requirements'].split() | requirements = urlreq.unquote(part.params['requirements']).split(',') | ||||
filecount = int(part.params['filecount']) | filecount = int(part.params['filecount']) | ||||
bytecount = int(part.params['bytecount']) | bytecount = int(part.params['bytecount']) | ||||
repo = op.repo | repo = op.repo | ||||
if len(repo): | if len(repo): | ||||
msg = _('cannot apply stream clone to non empty repository') | msg = _('cannot apply stream clone to non empty repository') | ||||
raise error.Abort(msg) | raise error.Abort(msg) | ||||
repo.ui.debug('applying stream bundle\n') | repo.ui.debug('applying stream bundle\n') | ||||
streamclone.applybundlev2(repo, part, filecount, bytecount, | streamclone.applybundlev2(repo, part, filecount, bytecount, | ||||
requirements) | requirements) |
'advertising it; the client may be buggy')) | 'advertising it; the client may be buggy')) | ||||
# Stream clones don't compress well. And compression undermines a | # Stream clones don't compress well. And compression undermines a | ||||
# goal of stream clones, which is to be fast. Communicate the desire | # goal of stream clones, which is to be fast. Communicate the desire | ||||
# to avoid compression to consumers of the bundle. | # to avoid compression to consumers of the bundle. | ||||
bundler.prefercompressed = False | bundler.prefercompressed = False | ||||
filecount, bytecount, it = streamclone.generatev2(repo) | filecount, bytecount, it = streamclone.generatev2(repo) | ||||
requirements = ' '.join(sorted(repo.requirements)) | requirements = _formatrequirementsspec(repo.requirements) | ||||
part = bundler.newpart('stream2', data=it) | part = bundler.newpart('stream2', data=it) | ||||
part.addparam('bytecount', '%d' % bytecount, mandatory=True) | part.addparam('bytecount', '%d' % bytecount, mandatory=True) | ||||
part.addparam('filecount', '%d' % filecount, mandatory=True) | part.addparam('filecount', '%d' % filecount, mandatory=True) | ||||
part.addparam('requirements', requirements, mandatory=True) | part.addparam('requirements', requirements, mandatory=True) | ||||
@getbundle2partsgenerator('changegroup') | @getbundle2partsgenerator('changegroup') | ||||
def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None, | def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None, | ||||
b2caps=None, heads=None, common=None, **kwargs): | b2caps=None, heads=None, common=None, **kwargs): |
getbundle requests with stream=1 are uncompressed | getbundle requests with stream=1 are uncompressed | ||||
$ get-with-headers.py $LOCALIP:$HGPORT '?cmd=getbundle' content-type --bodyfile body --hgproto '0.1 0.2 comp=zlib,none' --requestheader "x-hgarg-1=bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=0&common=0000000000000000000000000000000000000000&heads=c17445101a72edac06facd130d14808dfbd5c7c2&stream=1" | $ get-with-headers.py $LOCALIP:$HGPORT '?cmd=getbundle' content-type --bodyfile body --hgproto '0.1 0.2 comp=zlib,none' --requestheader "x-hgarg-1=bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps&cg=0&common=0000000000000000000000000000000000000000&heads=c17445101a72edac06facd130d14808dfbd5c7c2&stream=1" | ||||
200 Script output follows | 200 Script output follows | ||||
content-type: application/mercurial-0.2 | content-type: application/mercurial-0.2 | ||||
$ f --size --hex --bytes 256 body | $ f --size --hex --bytes 256 body | ||||
body: size=112222 | body: size=112230 | ||||
0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......| | 0000: 04 6e 6f 6e 65 48 47 32 30 00 00 00 00 00 00 00 |.noneHG20.......| | ||||
0010: 68 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |h.STREAM2.......| | 0010: 70 07 53 54 52 45 41 4d 32 00 00 00 00 03 00 09 |p.STREAM2.......| | ||||
0020: 05 09 04 0c 2d 62 79 74 65 63 6f 75 6e 74 39 38 |....-bytecount98| | 0020: 05 09 04 0c 35 62 79 74 65 63 6f 75 6e 74 39 38 |....5bytecount98| | ||||
0030: 37 35 38 66 69 6c 65 63 6f 75 6e 74 31 30 33 30 |758filecount1030| | 0030: 37 35 38 66 69 6c 65 63 6f 75 6e 74 31 30 33 30 |758filecount1030| | ||||
0040: 72 65 71 75 69 72 65 6d 65 6e 74 73 64 6f 74 65 |requirementsdote| | 0040: 72 65 71 75 69 72 65 6d 65 6e 74 73 64 6f 74 65 |requirementsdote| | ||||
0050: 6e 63 6f 64 65 20 66 6e 63 61 63 68 65 20 67 65 |ncode fncache ge| | 0050: 6e 63 6f 64 65 25 32 43 66 6e 63 61 63 68 65 25 |ncode%2Cfncache%| | ||||
0060: 6e 65 72 61 6c 64 65 6c 74 61 20 72 65 76 6c 6f |neraldelta revlo| | 0060: 32 43 67 65 6e 65 72 61 6c 64 65 6c 74 61 25 32 |2Cgeneraldelta%2| | ||||
0070: 67 76 31 20 73 74 6f 72 65 00 00 80 00 73 08 42 |gv1 store....s.B| | 0070: 43 72 65 76 6c 6f 67 76 31 25 32 43 73 74 6f 72 |Crevlogv1%2Cstor| | ||||
0080: 64 61 74 61 2f 30 2e 69 00 03 00 01 00 00 00 00 |data/0.i........| | 0080: 65 00 00 80 00 73 08 42 64 61 74 61 2f 30 2e 69 |e....s.Bdata/0.i| | ||||
0090: 00 00 00 02 00 00 00 01 00 00 00 00 00 00 00 01 |................| | 0090: 00 03 00 01 00 00 00 00 00 00 00 02 00 00 00 01 |................| | ||||
00a0: ff ff ff ff ff ff ff ff 80 29 63 a0 49 d3 23 87 |.........)c.I.#.| | 00a0: 00 00 00 00 00 00 00 01 ff ff ff ff ff ff ff ff |................| | ||||
00b0: bf ce fe 56 67 92 67 2c 69 d1 ec 39 00 00 00 00 |...Vg.g,i..9....| | 00b0: 80 29 63 a0 49 d3 23 87 bf ce fe 56 67 92 67 2c |.)c.I.#....Vg.g,| | ||||
00c0: 00 00 00 00 00 00 00 00 75 30 73 08 42 64 61 74 |........u0s.Bdat| | 00c0: 69 d1 ec 39 00 00 00 00 00 00 00 00 00 00 00 00 |i..9............| | ||||
00d0: 61 2f 31 2e 69 00 03 00 01 00 00 00 00 00 00 00 |a/1.i...........| | 00d0: 75 30 73 08 42 64 61 74 61 2f 31 2e 69 00 03 00 |u0s.Bdata/1.i...| | ||||
00e0: 02 00 00 00 01 00 00 00 00 00 00 00 01 ff ff ff |................| | 00e0: 01 00 00 00 00 00 00 00 02 00 00 00 01 00 00 00 |................| | ||||
00f0: ff ff ff ff ff f9 76 da 1d 0d f2 25 6c de 08 db |......v....%l...| | 00f0: 00 00 00 00 01 ff ff ff ff ff ff ff ff f9 76 da |..............v.| | ||||
--uncompressed is an alias to --stream | --uncompressed is an alias to --stream | ||||
#if stream-legacy | #if stream-legacy | ||||
$ hg clone --uncompressed -U http://localhost:$HGPORT clone1-uncompressed | $ hg clone --uncompressed -U http://localhost:$HGPORT clone1-uncompressed | ||||
streaming all changes | streaming all changes | ||||
1027 files to transfer, 96.3 KB of data | 1027 files to transfer, 96.3 KB of data | ||||
transferred 96.3 KB in * seconds (*/sec) (glob) | transferred 96.3 KB in * seconds (*/sec) (glob) |