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