Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/commands.py @ 1940:7ae177a70f54
add a new bundle type: uncompressed bundle
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Mon, 13 Mar 2006 03:54:23 +0100 |
parents | b7cc0f323a4c |
children | 8198c60f7914 |
comparison
equal
deleted
inserted
replaced
1920:b7cc0f323a4c | 1940:7ae177a70f54 |
---|---|
2490 Apply a compressed changegroup file generated by the bundle | 2490 Apply a compressed changegroup file generated by the bundle |
2491 command. | 2491 command. |
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']: |
2508 return update(ui, repo) | 2512 return update(ui, repo) |
2509 else: | 2513 else: |