Show More
@@ -2492,16 +2492,20 b' def unbundle(ui, repo, fname, **opts):' | |||
|
2492 | 2492 | """ |
|
2493 | 2493 | f = urllib.urlopen(fname) |
|
2494 | 2494 | |
|
2495 | if f.read(4) != "HG10": | |
|
2496 | raise util.Abort(_("%s: not a Mercurial bundle file") % fname) | |
|
2497 | ||
|
2498 | def bzgenerator(f): | |
|
2495 | header = f.read(4) | |
|
2496 | if header == "HG10": | |
|
2497 | def generator(f): | |
|
2499 | 2498 | zd = bz2.BZ2Decompressor() |
|
2500 | 2499 | for chunk in f: |
|
2501 | 2500 | yield zd.decompress(chunk) |
|
2502 | ||
|
2503 | bzgen = bzgenerator(util.filechunkiter(f, 4096)) | |
|
2504 | if repo.addchangegroup(util.chunkbuffer(bzgen)): | |
|
2501 | elif header == "HG11": | |
|
2502 | def generator(f): | |
|
2503 | for chunk in f: | |
|
2504 | yield chunk | |
|
2505 | else: | |
|
2506 | raise util.Abort(_("%s: not a Mercurial bundle file") % fname) | |
|
2507 | gen = generator(util.filechunkiter(f, 4096)) | |
|
2508 | if repo.addchangegroup(util.chunkbuffer(gen)): | |
|
2505 | 2509 | return 1 |
|
2506 | 2510 | |
|
2507 | 2511 | if opts['update']: |
General Comments 0
You need to be logged in to leave comments.
Login now