# HG changeset patch # User Benoit Boissinot # Date 1142218463 -3600 # Node ID 7ae177a70f5400288dd193f0be78467a1ddaf027 # Parent b7cc0f323a4cd98e70f45c18830484dd5a74b03d add a new bundle type: uncompressed bundle diff -r b7cc0f323a4c -r 7ae177a70f54 mercurial/commands.py --- a/mercurial/commands.py Sun Mar 12 16:21:59 2006 -0800 +++ b/mercurial/commands.py Mon Mar 13 03:54:23 2006 +0100 @@ -2492,16 +2492,20 @@ """ f = urllib.urlopen(fname) - if f.read(4) != "HG10": + header = f.read(4) + if header == "HG10": + def generator(f): + zd = bz2.BZ2Decompressor() + for chunk in f: + yield zd.decompress(chunk) + elif header == "HG11": + def generator(f): + for chunk in f: + yield chunk + else: raise util.Abort(_("%s: not a Mercurial bundle file") % fname) - - def bzgenerator(f): - zd = bz2.BZ2Decompressor() - for chunk in f: - yield zd.decompress(chunk) - - bzgen = bzgenerator(util.filechunkiter(f, 4096)) - if repo.addchangegroup(util.chunkbuffer(bzgen)): + gen = generator(util.filechunkiter(f, 4096)) + if repo.addchangegroup(util.chunkbuffer(gen)): return 1 if opts['update']: