Add mercurial (#3947)
[openwrt/svn-archive/archive.git] / net / mercurial / patches / 001-no_bzip2.patch
1 diff -rc mercurial-1.0.orig/mercurial/archival.py mercurial-1.0/mercurial/archival.py
2 *** mercurial-1.0.orig/mercurial/archival.py 2008-03-25 00:05:20.000000000 +0100
3 --- mercurial-1.0/mercurial/archival.py 2008-04-13 02:22:47.000000000 +0200
4 ***************
5 *** 64,71 ****
6 self.fileobj.write(fname + '\000')
7
8 def __init__(self, dest, prefix, mtime, kind=''):
9 ! self.prefix = tidyprefix(dest, prefix, ['.tar', '.tar.bz2', '.tar.gz',
10 ! '.tgz', '.tbz2'])
11 self.mtime = mtime
12
13 def taropen(name, mode, fileobj=None):
14 --- 64,71 ----
15 self.fileobj.write(fname + '\000')
16
17 def __init__(self, dest, prefix, mtime, kind=''):
18 ! self.prefix = tidyprefix(dest, prefix, ['.tar', '.tar.gz',
19 ! '.tgz'])
20 self.mtime = mtime
21
22 def taropen(name, mode, fileobj=None):
23 ***************
24 *** 178,184 ****
25 archivers = {
26 'files': fileit,
27 'tar': tarit,
28 - 'tbz2': lambda name, prefix, mtime: tarit(name, prefix, mtime, 'bz2'),
29 'tgz': lambda name, prefix, mtime: tarit(name, prefix, mtime, 'gz'),
30 'uzip': lambda name, prefix, mtime: zipit(name, prefix, mtime, False),
31 'zip': zipit,
32 --- 178,183 ----
33 diff -rc mercurial-1.0.orig/mercurial/bundlerepo.py mercurial-1.0/mercurial/bundlerepo.py
34 *** mercurial-1.0.orig/mercurial/bundlerepo.py 2008-03-25 00:05:20.000000000 +0100
35 --- mercurial-1.0/mercurial/bundlerepo.py 2008-04-13 02:23:54.000000000 +0200
36 ***************
37 *** 12,18 ****
38
39 from node import hex, nullid, short
40 from i18n import _
41 ! import changegroup, util, os, struct, bz2, tempfile, shutil, mdiff
42 import repo, localrepo, changelog, manifest, filelog, revlog
43
44 class bundlerevlog(revlog.revlog):
45 --- 12,18 ----
46
47 from node import hex, nullid, short
48 from i18n import _
49 ! import changegroup, util, os, struct, tempfile, shutil, mdiff
50 import repo, localrepo, changelog, manifest, filelog, revlog
51
52 class bundlerevlog(revlog.revlog):
53 ***************
54 *** 173,201 ****
55 raise util.Abort(_("%s: not a Mercurial bundle file") % bundlename)
56 elif not header.startswith("HG10"):
57 raise util.Abort(_("%s: unknown bundle version") % bundlename)
58 - elif header == "HG10BZ":
59 - fdtemp, temp = tempfile.mkstemp(prefix="hg-bundle-",
60 - suffix=".hg10un", dir=self.path)
61 - self.tempfile = temp
62 - fptemp = os.fdopen(fdtemp, 'wb')
63 - def generator(f):
64 - zd = bz2.BZ2Decompressor()
65 - zd.decompress("BZ")
66 - for chunk in f:
67 - yield zd.decompress(chunk)
68 - gen = generator(util.filechunkiter(self.bundlefile, 4096))
69 -
70 - try:
71 - fptemp.write("HG10UN")
72 - for chunk in gen:
73 - fptemp.write(chunk)
74 - finally:
75 - fptemp.close()
76 - self.bundlefile.close()
77 -
78 - self.bundlefile = open(self.tempfile, "rb")
79 - # seek right after the header
80 - self.bundlefile.seek(6)
81 elif header == "HG10UN":
82 # nothing to do
83 pass
84 --- 173,178 ----
85 diff -rc mercurial-1.0.orig/mercurial/changegroup.py mercurial-1.0/mercurial/changegroup.py
86 *** mercurial-1.0.orig/mercurial/changegroup.py 2008-03-25 00:05:20.000000000 +0100
87 --- mercurial-1.0/mercurial/changegroup.py 2008-04-13 02:24:40.000000000 +0200
88 ***************
89 *** 8,14 ****
90 """
91
92 from i18n import _
93 ! import struct, os, bz2, zlib, util, tempfile
94
95 def getchunk(source):
96 """get a chunk from a changegroup"""
97 --- 8,14 ----
98 """
99
100 from i18n import _
101 ! import struct, os, zlib, util, tempfile
102
103 def getchunk(source):
104 """get a chunk from a changegroup"""
105 ***************
106 *** 49,60 ****
107 bundletypes = {
108 "": ("", nocompress),
109 "HG10UN": ("HG10UN", nocompress),
110 - "HG10BZ": ("HG10", lambda: bz2.BZ2Compressor()),
111 "HG10GZ": ("HG10GZ", lambda: zlib.compressobj()),
112 }
113
114 # hgweb uses this list to communicate it's preferred type
115 ! bundlepriority = ['HG10GZ', 'HG10BZ', 'HG10UN']
116
117 def writebundle(cg, filename, bundletype):
118 """Write a bundle file and return its filename.
119 --- 49,59 ----
120 bundletypes = {
121 "": ("", nocompress),
122 "HG10UN": ("HG10UN", nocompress),
123 "HG10GZ": ("HG10GZ", lambda: zlib.compressobj()),
124 }
125
126 # hgweb uses this list to communicate it's preferred type
127 ! bundlepriority = ['HG10GZ', 'HG10UN']
128
129 def writebundle(cg, filename, bundletype):
130 """Write a bundle file and return its filename.
131 ***************
132 *** 122,133 ****
133 zd = zlib.decompressobj()
134 for chunk in f:
135 yield zd.decompress(chunk)
136 - elif header == 'HG10BZ':
137 - def generator(f):
138 - zd = bz2.BZ2Decompressor()
139 - zd.decompress("BZ")
140 - for chunk in util.filechunkiter(f, 4096):
141 - yield zd.decompress(chunk)
142 return util.chunkbuffer(generator(fh))
143
144 def readbundle(fh, fname):
145 --- 121,126 ----
146 diff -rc mercurial-1.0.orig/mercurial/commands.py mercurial-1.0/mercurial/commands.py
147 *** mercurial-1.0.orig/mercurial/commands.py 2008-03-25 00:05:20.000000000 +0100
148 --- mercurial-1.0/mercurial/commands.py 2008-04-13 02:24:54.000000000 +0200
149 ***************
150 *** 139,145 ****
151
152 "files" (default): a directory full of files
153 "tar": tar archive, uncompressed
154 - "tbz2": tar archive, compressed using bzip2
155 "tgz": tar archive, compressed using gzip
156 "uzip": zip archive, uncompressed
157 "zip": zip archive, compressed using deflate
158 --- 139,144 ----
159 diff -rc mercurial-1.0.orig/mercurial/hgweb/hgwebdir_mod.py mercurial-1.0/mercurial/hgweb/hgwebdir_mod.py
160 *** mercurial-1.0.orig/mercurial/hgweb/hgwebdir_mod.py 2008-03-25 00:05:20.000000000 +0100
161 --- mercurial-1.0/mercurial/hgweb/hgwebdir_mod.py 2008-04-13 02:25:33.000000000 +0200
162 ***************
163 *** 152,158 ****
164
165 def archivelist(ui, nodeid, url):
166 allowed = ui.configlist("web", "allow_archive", untrusted=True)
167 ! for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]:
168 if i[0] in allowed or ui.configbool("web", "allow" + i[0],
169 untrusted=True):
170 yield {"type" : i[0], "extension": i[1],
171 --- 152,158 ----
172
173 def archivelist(ui, nodeid, url):
174 allowed = ui.configlist("web", "allow_archive", untrusted=True)
175 ! for i in [('zip', '.zip'), ('gz', '.tar.gz')]:
176 if i[0] in allowed or ui.configbool("web", "allow" + i[0],
177 untrusted=True):
178 yield {"type" : i[0], "extension": i[1],
179 diff -rc mercurial-1.0.orig/mercurial/hgweb/hgweb_mod.py mercurial-1.0/mercurial/hgweb/hgweb_mod.py
180 *** mercurial-1.0.orig/mercurial/hgweb/hgweb_mod.py 2008-03-25 00:05:20.000000000 +0100
181 --- mercurial-1.0/mercurial/hgweb/hgweb_mod.py 2008-04-13 02:25:49.000000000 +0200
182 ***************
183 *** 91,97 ****
184 hook.redirect(True)
185 self.mtime = -1
186 self.reponame = name
187 ! self.archives = 'zip', 'gz', 'bz2'
188 self.stripecount = 1
189 self._capabilities = None
190 # a repo owner may set web.templates in .hg/hgrc to get any file
191 --- 91,97 ----
192 hook.redirect(True)
193 self.mtime = -1
194 self.reponame = name
195 ! self.archives = 'zip', 'gz'
196 self.stripecount = 1
197 self._capabilities = None
198 # a repo owner may set web.templates in .hg/hgrc to get any file
199 ***************
200 *** 915,921 ****
201 diff=diff)
202
203 archive_specs = {
204 - 'bz2': ('application/x-tar', 'tbz2', '.tar.bz2', None),
205 'gz': ('application/x-tar', 'tgz', '.tar.gz', None),
206 'zip': ('application/zip', 'zip', '.zip', None),
207 }
208 --- 915,920 ----