##// 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 from node import hex, nullid, short
13 from node import hex, nullid, short
14 from i18n import _
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 import repo, localrepo, changelog, manifest, filelog, revlog
16 import repo, localrepo, changelog, manifest, filelog, revlog
17
17
18 class bundlerevlog(revlog.revlog):
18 class bundlerevlog(revlog.revlog):
@@ -173,14 +173,17 b' class bundlerepository(localrepo.localre'
173 raise util.Abort(_("%s: not a Mercurial bundle file") % bundlename)
173 raise util.Abort(_("%s: not a Mercurial bundle file") % bundlename)
174 elif not header.startswith("HG10"):
174 elif not header.startswith("HG10"):
175 raise util.Abort(_("%s: unknown bundle version") % bundlename)
175 raise util.Abort(_("%s: unknown bundle version") % bundlename)
176 elif header == "HG10BZ":
176 elif (header == "HG10BZ") or (header == "HG10GZ"):
177 fdtemp, temp = tempfile.mkstemp(prefix="hg-bundle-",
177 fdtemp, temp = tempfile.mkstemp(prefix="hg-bundle-",
178 suffix=".hg10un", dir=self.path)
178 suffix=".hg10un", dir=self.path)
179 self.tempfile = temp
179 self.tempfile = temp
180 fptemp = os.fdopen(fdtemp, 'wb')
180 fptemp = os.fdopen(fdtemp, 'wb')
181 def generator(f):
181 def generator(f):
182 zd = bz2.BZ2Decompressor()
182 if header == "HG10BZ":
183 zd.decompress("BZ")
183 zd = bz2.BZ2Decompressor()
184 zd.decompress("BZ")
185 elif header == "HG10GZ":
186 zd = zlib.decompressobj()
184 for chunk in f:
187 for chunk in f:
185 yield zd.decompress(chunk)
188 yield zd.decompress(chunk)
186 gen = generator(util.filechunkiter(self.bundlefile, 4096))
189 gen = generator(util.filechunkiter(self.bundlefile, 4096))
General Comments 0
You need to be logged in to leave comments. Login now