##// END OF EJS Templates
add a new bundle type: uncompressed bundle
Benoit Boissinot -
r1940:7ae177a7 default
parent child Browse files
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 raise util.Abort(_("%s: not a Mercurial bundle file") % fname)
2496 if header == "HG10":
2497
2497 def generator(f):
2498 def bzgenerator(f):
2499 zd = bz2.BZ2Decompressor()
2498 zd = bz2.BZ2Decompressor()
2500 for chunk in f:
2499 for chunk in f:
2501 yield zd.decompress(chunk)
2500 yield zd.decompress(chunk)
2502
2501 elif header == "HG11":
2503 bzgen = bzgenerator(util.filechunkiter(f, 4096))
2502 def generator(f):
2504 if repo.addchangegroup(util.chunkbuffer(bzgen)):
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 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