Update mercurial to 1.1.2 (#4407)
[openwrt/svn-archive/archive.git] / net / mercurial / patches / 001-no_bzip2.patch
1 diff -urN mercurial-1.1.2/mercurial/archival.py mercurial-1.1.2-nobz2/mercurial/archival.py
2 --- mercurial-1.1.2/mercurial/archival.py 2009-01-01 00:38:33.000000000 +0100
3 +++ mercurial-1.1.2-nobz2/mercurial/archival.py 2009-01-01 13:53:14.000000000 +0100
4 @@ -65,8 +65,8 @@
5 self.fileobj.write(fname + '\000')
6
7 def __init__(self, dest, prefix, mtime, kind=''):
8 - self.prefix = tidyprefix(dest, prefix, ['.tar', '.tar.bz2', '.tar.gz',
9 - '.tgz', '.tbz2'])
10 + self.prefix = tidyprefix(dest, prefix, ['.tar', '.tar.gz',
11 + '.tgz'])
12 self.mtime = mtime
13
14 def taropen(name, mode, fileobj=None):
15 @@ -179,7 +179,6 @@
16 archivers = {
17 'files': fileit,
18 'tar': tarit,
19 - 'tbz2': lambda name, prefix, mtime: tarit(name, prefix, mtime, 'bz2'),
20 'tgz': lambda name, prefix, mtime: tarit(name, prefix, mtime, 'gz'),
21 'uzip': lambda name, prefix, mtime: zipit(name, prefix, mtime, False),
22 'zip': zipit,
23 diff -urN mercurial-1.1.2/mercurial/bundlerepo.py mercurial-1.1.2-nobz2/mercurial/bundlerepo.py
24 --- mercurial-1.1.2/mercurial/bundlerepo.py 2009-01-01 00:38:33.000000000 +0100
25 +++ mercurial-1.1.2-nobz2/mercurial/bundlerepo.py 2009-01-01 13:53:59.000000000 +0100
26 @@ -12,7 +12,7 @@
27
28 from node import hex, nullid, short
29 from i18n import _
30 -import changegroup, util, os, struct, bz2, zlib, tempfile, shutil, mdiff
31 +import changegroup, util, os, struct, zlib, tempfile, shutil, mdiff
32 import repo, localrepo, changelog, manifest, filelog, revlog, context
33
34 class bundlerevlog(revlog.revlog):
35 @@ -173,16 +173,13 @@
36 raise util.Abort(_("%s: not a Mercurial bundle file") % bundlename)
37 elif not header.startswith("HG10"):
38 raise util.Abort(_("%s: unknown bundle version") % bundlename)
39 - elif (header == "HG10BZ") or (header == "HG10GZ"):
40 + elif (header == "HG10GZ"):
41 fdtemp, temp = tempfile.mkstemp(prefix="hg-bundle-",
42 suffix=".hg10un", dir=self.path)
43 self.tempfile = temp
44 fptemp = os.fdopen(fdtemp, 'wb')
45 def generator(f):
46 - if header == "HG10BZ":
47 - zd = bz2.BZ2Decompressor()
48 - zd.decompress("BZ")
49 - elif header == "HG10GZ":
50 + if header == "HG10GZ":
51 zd = zlib.decompressobj()
52 for chunk in f:
53 yield zd.decompress(chunk)
54 diff -urN mercurial-1.1.2/mercurial/changegroup.py mercurial-1.1.2-nobz2/mercurial/changegroup.py
55 --- mercurial-1.1.2/mercurial/changegroup.py 2009-01-01 00:38:33.000000000 +0100
56 +++ mercurial-1.1.2-nobz2/mercurial/changegroup.py 2009-01-01 13:52:05.000000000 +0100
57 @@ -8,7 +8,7 @@
58 """
59
60 from i18n import _
61 -import struct, os, bz2, zlib, util, tempfile
62 +import struct, os, zlib, util, tempfile
63
64 def getchunk(source):
65 """get a chunk from a changegroup"""
66 @@ -49,12 +49,11 @@
67 bundletypes = {
68 "": ("", nocompress),
69 "HG10UN": ("HG10UN", nocompress),
70 - "HG10BZ": ("HG10", lambda: bz2.BZ2Compressor()),
71 "HG10GZ": ("HG10GZ", lambda: zlib.compressobj()),
72 }
73
74 # hgweb uses this list to communicate it's preferred type
75 -bundlepriority = ['HG10GZ', 'HG10BZ', 'HG10UN']
76 +bundlepriority = ['HG10GZ', 'HG10UN']
77
78 def writebundle(cg, filename, bundletype):
79 """Write a bundle file and return its filename.
80 @@ -122,12 +121,6 @@
81 zd = zlib.decompressobj()
82 for chunk in f:
83 yield zd.decompress(chunk)
84 - elif header == 'HG10BZ':
85 - def generator(f):
86 - zd = bz2.BZ2Decompressor()
87 - zd.decompress("BZ")
88 - for chunk in util.filechunkiter(f, 4096):
89 - yield zd.decompress(chunk)
90 return util.chunkbuffer(generator(fh))
91
92 def readbundle(fh, fname):
93 diff -urN mercurial-1.1.2/mercurial/hgweb/hgwebdir_mod.py mercurial-1.1.2-nobz2/mercurial/hgweb/hgwebdir_mod.py
94 --- mercurial-1.1.2/mercurial/hgweb/hgwebdir_mod.py 2009-01-01 00:38:33.000000000 +0100
95 +++ mercurial-1.1.2-nobz2/mercurial/hgweb/hgwebdir_mod.py 2009-01-01 13:54:29.000000000 +0100
96 @@ -178,7 +178,7 @@
97
98 def archivelist(ui, nodeid, url):
99 allowed = ui.configlist("web", "allow_archive", untrusted=True)
100 - for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]:
101 + for i in [('zip', '.zip'), ('gz', '.tar.gz')]:
102 if i[0] in allowed or ui.configbool("web", "allow" + i[0],
103 untrusted=True):
104 yield {"type" : i[0], "extension": i[1],
105 diff -urN mercurial-1.1.2/mercurial/hgweb/hgweb_mod.py mercurial-1.1.2-nobz2/mercurial/hgweb/hgweb_mod.py
106 --- mercurial-1.1.2/mercurial/hgweb/hgweb_mod.py 2009-01-01 00:38:33.000000000 +0100
107 +++ mercurial-1.1.2-nobz2/mercurial/hgweb/hgweb_mod.py 2009-01-01 13:55:08.000000000 +0100
108 @@ -35,7 +35,7 @@
109 hook.redirect(True)
110 self.mtime = -1
111 self.reponame = name
112 - self.archives = 'zip', 'gz', 'bz2'
113 + self.archives = 'zip', 'gz'
114 self.stripecount = 1
115 # a repo owner may set web.templates in .hg/hgrc to get any file
116 # readable by the user running the CGI script
117 @@ -266,7 +266,6 @@
118 yield {"type" : i, "extension" : spec[2], "node" : nodeid}
119
120 archive_specs = {
121 - 'bz2': ('application/x-tar', 'tbz2', '.tar.bz2', None),
122 'gz': ('application/x-tar', 'tgz', '.tar.gz', None),
123 'zip': ('application/zip', 'zip', '.zip', None),
124 }