Show More
@@ -71,6 +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 | "HG2Y": (), # special-cased below | |
|
74 | 75 | "HG10UN": ("HG10UN", nocompress), |
|
75 | 76 | "HG10BZ": ("HG10", lambda: bz2.BZ2Compressor()), |
|
76 | 77 | "HG10GZ": ("HG10GZ", lambda: zlib.compressobj()), |
@@ -101,9 +102,20 b' def writebundle(ui, cg, filename, bundle' | |||
|
101 | 102 | fh = os.fdopen(fd, "wb") |
|
102 | 103 | cleanup = filename |
|
103 | 104 | |
|
104 | header, compressor = bundletypes[bundletype] | |
|
105 | fh.write(header) | |
|
106 | z = compressor() | |
|
105 | if bundletype == "HG2Y": | |
|
106 | import bundle2 | |
|
107 | bundle = bundle2.bundle20(ui) | |
|
108 | part = bundle.newpart('b2x:changegroup', data=cg.getchunks()) | |
|
109 | part.addparam('version', cg.version) | |
|
110 | z = nocompress() | |
|
111 | chunkiter = bundle.getchunks() | |
|
112 | else: | |
|
113 | if cg.version != '01': | |
|
114 | raise util.Abort(_('Bundle1 only supports v1 changegroups\n')) | |
|
115 | header, compressor = bundletypes[bundletype] | |
|
116 | fh.write(header) | |
|
117 | z = compressor() | |
|
118 | chunkiter = cg.getchunks() | |
|
107 | 119 | |
|
108 | 120 | # parse the changegroup data, otherwise we will block |
|
109 | 121 | # in case of sshrepo because we don't know the end of the stream |
@@ -111,7 +123,7 b' def writebundle(ui, cg, filename, bundle' | |||
|
111 | 123 | # an empty chunkgroup is the end of the changegroup |
|
112 | 124 | # a changegroup has at least 2 chunkgroups (changelog and manifest). |
|
113 | 125 | # after that, an empty chunkgroup is the end of the changegroup |
|
114 |
for chunk in c |
|
|
126 | for chunk in chunkiter: | |
|
115 | 127 | fh.write(z.compress(chunk)) |
|
116 | 128 | fh.write(z.flush()) |
|
117 | 129 | cleanup = None |
@@ -146,6 +158,7 b' def decompressor(fh, alg):' | |||
|
146 | 158 | class cg1unpacker(object): |
|
147 | 159 | deltaheader = _CHANGEGROUPV1_DELTA_HEADER |
|
148 | 160 | deltaheadersize = struct.calcsize(deltaheader) |
|
161 | version = '01' | |
|
149 | 162 | def __init__(self, fh, alg): |
|
150 | 163 | self._stream = decompressor(fh, alg) |
|
151 | 164 | self._type = alg |
@@ -238,6 +251,7 b' class cg1unpacker(object):' | |||
|
238 | 251 | class cg2unpacker(cg1unpacker): |
|
239 | 252 | deltaheader = _CHANGEGROUPV2_DELTA_HEADER |
|
240 | 253 | deltaheadersize = struct.calcsize(deltaheader) |
|
254 | version = '02' | |
|
241 | 255 | |
|
242 | 256 | def _deltaheader(self, headertuple, prevnode): |
|
243 | 257 | node, p1, p2, deltabase, cs = headertuple |
@@ -257,6 +271,7 b' class headerlessfixup(object):' | |||
|
257 | 271 | |
|
258 | 272 | class cg1packer(object): |
|
259 | 273 | deltaheader = _CHANGEGROUPV1_DELTA_HEADER |
|
274 | version = '01' | |
|
260 | 275 | def __init__(self, repo, bundlecaps=None): |
|
261 | 276 | """Given a source repo, construct a bundler. |
|
262 | 277 | |
@@ -484,7 +499,7 b' class cg1packer(object):' | |||
|
484 | 499 | return struct.pack(self.deltaheader, node, p1n, p2n, linknode) |
|
485 | 500 | |
|
486 | 501 | class cg2packer(cg1packer): |
|
487 | ||
|
502 | version = '02' | |
|
488 | 503 | deltaheader = _CHANGEGROUPV2_DELTA_HEADER |
|
489 | 504 | |
|
490 | 505 | def group(self, nodelist, revlog, lookup, units=None, reorder=None): |
@@ -1181,7 +1181,10 b' def bundle(ui, repo, fname, dest=None, *' | |||
|
1181 | 1181 | revs = scmutil.revrange(repo, opts['rev']) |
|
1182 | 1182 | |
|
1183 | 1183 | bundletype = opts.get('type', 'bzip2').lower() |
|
1184 |
btypes = {'none': 'HG10UN', |
|
|
1184 | btypes = {'none': 'HG10UN', | |
|
1185 | 'bzip2': 'HG10BZ', | |
|
1186 | 'gzip': 'HG10GZ', | |
|
1187 | 'bundle2': 'HG2Y'} | |
|
1185 | 1188 | bundletype = btypes.get(bundletype) |
|
1186 | 1189 | if bundletype not in changegroup.bundletypes: |
|
1187 | 1190 | raise util.Abort(_('unknown bundle type specified with --type')) |
@@ -2161,7 +2164,10 b' def debuggetbundle(ui, repopath, bundlep' | |||
|
2161 | 2164 | bundle = repo.getbundle('debug', **args) |
|
2162 | 2165 | |
|
2163 | 2166 | bundletype = opts.get('type', 'bzip2').lower() |
|
2164 |
btypes = {'none': 'HG10UN', |
|
|
2167 | btypes = {'none': 'HG10UN', | |
|
2168 | 'bzip2': 'HG10BZ', | |
|
2169 | 'gzip': 'HG10GZ', | |
|
2170 | 'bundle2': 'HG2Y'} | |
|
2165 | 2171 | bundletype = btypes.get(bundletype) |
|
2166 | 2172 | if bundletype not in changegroup.bundletypes: |
|
2167 | 2173 | raise util.Abort(_('unknown bundle type specified with --type')) |
@@ -165,7 +165,30 b' Get branch and merge:' | |||
|
165 | 165 | 8365676dbab05860ce0d9110f2af51368b961bbd |
|
166 | 166 | 0b2f73f04880d9cb6a5cd8a757f0db0ad01e32c3 |
|
167 | 167 | |
|
168 | = Test bundle2 = | |
|
168 | 169 | |
|
170 | $ hg debuggetbundle repo bundle -t bundle2 | |
|
171 | $ hg debugbundle bundle | |
|
172 | Stream params: {} | |
|
173 | b2x:changegroup -- "{'version': '01'}" | |
|
174 | 7704483d56b2a7b5db54dcee7c62378ac629b348 | |
|
175 | 29a4d1f17bd3f0779ca0525bebb1cfb51067c738 | |
|
176 | 713346a995c363120712aed1aee7e04afd867638 | |
|
177 | d5f6e1ea452285324836a49d7d3c2a63cfed1d31 | |
|
178 | ff42371d57168345fdf1a3aac66a51f6a45d41d2 | |
|
179 | bac16991d12ff45f9dc43c52da1946dfadb83e80 | |
|
180 | 6621d79f61b23ec74cf4b69464343d9e0980ec8b | |
|
181 | 8931463777131cd73923e560b760061f2aa8a4bc | |
|
182 | f34414c64173e0ecb61b25dc55e116dbbcc89bee | |
|
183 | 928b5f94cdb278bb536eba552de348a4e92ef24d | |
|
184 | 700b7e19db54103633c4bf4a6a6b6d55f4d50c03 | |
|
185 | 63476832d8ec6558cf9bbe3cbe0c757e5cf18043 | |
|
186 | 13c0170174366b441dc68e8e33757232fa744458 | |
|
187 | 5686dbbd9fc46cb806599c878d02fe1cb56b83d3 | |
|
188 | 8365676dbab05860ce0d9110f2af51368b961bbd | |
|
189 | 0b2f73f04880d9cb6a5cd8a757f0db0ad01e32c3 | |
|
190 | 4801a72e5d88cb515b0c7e40fae34180f3f837f2 | |
|
191 | 10c14a2cc935e1d8c31f9e98587dcf27fb08a6da | |
|
169 | 192 | = Test via HTTP = |
|
170 | 193 | |
|
171 | 194 | Get everything: |
General Comments 0
You need to be logged in to leave comments.
Login now