# HG changeset patch # User Benoit Boissinot # Date 1164229680 -3600 # Node ID 9c1737a3e2548749340dd01b5845d3c50adf32c7 # Parent e674cae8efeeeed57a91026f015036889265081e fix writebundle for bz2 bundles diff -r e674cae8efee -r 9c1737a3e254 mercurial/changegroup.py --- a/mercurial/changegroup.py Tue Nov 21 23:08:29 2006 -0200 +++ b/mercurial/changegroup.py Wed Nov 22 22:08:00 2006 +0100 @@ -48,10 +48,10 @@ return "" bundletypes = { - "": nocompress, - "HG10UN": nocompress, - "HG10": lambda: bz2.BZ2Compressor(9), - "HG10GZ": zlib.compressobj, + "": ("", nocompress), + "HG10UN": ("HG10UN", nocompress), + "HG10BZ": ("HG10", lambda: bz2.BZ2Compressor(9)), + "HG10GZ": ("HG10GZ", zlib.compressobj), } def writebundle(cg, filename, type): @@ -75,8 +75,9 @@ fh = os.fdopen(fd, "wb") cleanup = filename - fh.write(type) - z = bundletypes[type]() + header, compressor = bundletypes[type] + fh.write(header) + z = compressor() # parse the changegroup data, otherwise we will block # in case of sshrepo because we don't know the end of the stream diff -r e674cae8efee -r 9c1737a3e254 mercurial/commands.py --- a/mercurial/commands.py Tue Nov 21 23:08:29 2006 -0200 +++ b/mercurial/commands.py Wed Nov 22 22:08:00 2006 +0100 @@ -332,7 +332,7 @@ cg = repo.changegroupsubset(o, revs, 'bundle') else: cg = repo.changegroup(o, 'bundle') - changegroup.writebundle(cg, fname, "HG10") + changegroup.writebundle(cg, fname, "HG10BZ") def cat(ui, repo, file1, *pats, **opts): """output the latest or given revisions of files @@ -1324,7 +1324,7 @@ if fname or not other.local(): # create a bundle (uncompressed if other repo is not local) cg = other.changegroup(incoming, "incoming") - type = other.local() and "HG10" or "HG10UN" + type = other.local() and "HG10BZ" or "HG10UN" fname = cleanup = changegroup.writebundle(cg, fname, type) # keep written bundle? if opts["bundle"]: