##// END OF EJS Templates
add support for HG10GZ bundles to bundlerepo.bundlerevlog()
Benoit Allard -
r6569:c15bfe9c default
parent child Browse files
Show More
@@ -12,7 +12,7 b' of the GNU General Public License, incor'
12 12
13 13 from node import hex, nullid, short
14 14 from i18n import _
15 import changegroup, util, os, struct, bz2, tempfile, shutil, mdiff
15 import changegroup, util, os, struct, bz2, zlib, tempfile, shutil, mdiff
16 16 import repo, localrepo, changelog, manifest, filelog, revlog
17 17
18 18 class bundlerevlog(revlog.revlog):
@@ -173,14 +173,17 b' class bundlerepository(localrepo.localre'
173 173 raise util.Abort(_("%s: not a Mercurial bundle file") % bundlename)
174 174 elif not header.startswith("HG10"):
175 175 raise util.Abort(_("%s: unknown bundle version") % bundlename)
176 elif header == "HG10BZ":
176 elif (header == "HG10BZ") or (header == "HG10GZ"):
177 177 fdtemp, temp = tempfile.mkstemp(prefix="hg-bundle-",
178 178 suffix=".hg10un", dir=self.path)
179 179 self.tempfile = temp
180 180 fptemp = os.fdopen(fdtemp, 'wb')
181 181 def generator(f):
182 zd = bz2.BZ2Decompressor()
183 zd.decompress("BZ")
182 if header == "HG10BZ":
183 zd = bz2.BZ2Decompressor()
184 zd.decompress("BZ")
185 elif header == "HG10GZ":
186 zd = zlib.decompressobj()
184 187 for chunk in f:
185 188 yield zd.decompress(chunk)
186 189 gen = generator(util.filechunkiter(self.bundlefile, 4096))
General Comments 0
You need to be logged in to leave comments. Login now