##// END OF EJS Templates
fix writebundle for bz2 bundles
Benoit Boissinot -
r3704:9c1737a3 default
parent child Browse files
Show More
@@ -48,10 +48,10 b' class nocompress(object):'
48 return ""
48 return ""
49
49
50 bundletypes = {
50 bundletypes = {
51 "": nocompress,
51 "": ("", nocompress),
52 "HG10UN": nocompress,
52 "HG10UN": ("HG10UN", nocompress),
53 "HG10": lambda: bz2.BZ2Compressor(9),
53 "HG10BZ": ("HG10", lambda: bz2.BZ2Compressor(9)),
54 "HG10GZ": zlib.compressobj,
54 "HG10GZ": ("HG10GZ", zlib.compressobj),
55 }
55 }
56
56
57 def writebundle(cg, filename, type):
57 def writebundle(cg, filename, type):
@@ -75,8 +75,9 b' def writebundle(cg, filename, type):'
75 fh = os.fdopen(fd, "wb")
75 fh = os.fdopen(fd, "wb")
76 cleanup = filename
76 cleanup = filename
77
77
78 fh.write(type)
78 header, compressor = bundletypes[type]
79 z = bundletypes[type]()
79 fh.write(header)
80 z = compressor()
80
81
81 # parse the changegroup data, otherwise we will block
82 # parse the changegroup data, otherwise we will block
82 # in case of sshrepo because we don't know the end of the stream
83 # in case of sshrepo because we don't know the end of the stream
@@ -332,7 +332,7 b' def bundle(ui, repo, fname, dest=None, *'
332 cg = repo.changegroupsubset(o, revs, 'bundle')
332 cg = repo.changegroupsubset(o, revs, 'bundle')
333 else:
333 else:
334 cg = repo.changegroup(o, 'bundle')
334 cg = repo.changegroup(o, 'bundle')
335 changegroup.writebundle(cg, fname, "HG10")
335 changegroup.writebundle(cg, fname, "HG10BZ")
336
336
337 def cat(ui, repo, file1, *pats, **opts):
337 def cat(ui, repo, file1, *pats, **opts):
338 """output the latest or given revisions of files
338 """output the latest or given revisions of files
@@ -1324,7 +1324,7 b' def incoming(ui, repo, source="default",'
1324 if fname or not other.local():
1324 if fname or not other.local():
1325 # create a bundle (uncompressed if other repo is not local)
1325 # create a bundle (uncompressed if other repo is not local)
1326 cg = other.changegroup(incoming, "incoming")
1326 cg = other.changegroup(incoming, "incoming")
1327 type = other.local() and "HG10" or "HG10UN"
1327 type = other.local() and "HG10BZ" or "HG10UN"
1328 fname = cleanup = changegroup.writebundle(cg, fname, type)
1328 fname = cleanup = changegroup.writebundle(cg, fname, type)
1329 # keep written bundle?
1329 # keep written bundle?
1330 if opts["bundle"]:
1330 if opts["bundle"]:
General Comments 0
You need to be logged in to leave comments. Login now