d43accadec295e1f09e3b9fba4d3c94dc075105f
[openwrt/svn-archive/archive.git] / net / mercurial / patches / 001-no_bzip2.patch
1 --- a/mercurial/archival.py
2 +++ b/mercurial/archival.py
3 @@ -37,7 +37,6 @@ def tidyprefix(dest, kind, prefix):
4
5 exts = {
6 'tar': ['.tar'],
7 - 'tbz2': ['.tbz2', '.tar.bz2'],
8 'tgz': ['.tgz', '.tar.gz'],
9 'zip': ['.zip'],
10 }
11 @@ -51,7 +50,7 @@ def guesskind(dest):
12
13 class tarit(object):
14 '''write archive to tar file or stream. can write uncompressed,
15 - or compress with gzip or bzip2.'''
16 + or compress with gzip.'''
17
18 class GzipFileWithTime(gzip.GzipFile):
19
20 @@ -205,7 +204,6 @@ class fileit(object):
21 archivers = {
22 'files': fileit,
23 'tar': tarit,
24 - 'tbz2': lambda name, mtime: tarit(name, mtime, 'bz2'),
25 'tgz': lambda name, mtime: tarit(name, mtime, 'gz'),
26 'uzip': lambda name, mtime: zipit(name, mtime, False),
27 'zip': zipit,
28 --- a/mercurial/bundlerepo.py
29 +++ b/mercurial/bundlerepo.py
30 @@ -307,7 +307,7 @@ def getremotechanges(ui, repo, other, re
31 cg = other.changegroup(incoming, "incoming")
32 else:
33 cg = other.changegroupsubset(incoming, revs, 'incoming')
34 - bundletype = other.local() and "HG10BZ" or "HG10UN"
35 + bundletype = other.local() and "HG10GZ" or "HG10UN"
36 fname = bundle = changegroup.writebundle(cg, bundlename, bundletype)
37 # keep written bundle?
38 if bundlename:
39 --- a/mercurial/changegroup.py
40 +++ b/mercurial/changegroup.py
41 @@ -7,7 +7,7 @@
42
43 from i18n import _
44 import util
45 -import struct, os, bz2, zlib, tempfile
46 +import struct, os, zlib, tempfile
47
48 def readexactly(stream, n):
49 '''read n bytes from stream.read and abort if less was available'''
50 @@ -45,7 +45,6 @@ class nocompress(object):
51 bundletypes = {
52 "": ("", nocompress),
53 "HG10UN": ("HG10UN", nocompress),
54 - "HG10BZ": ("HG10", lambda: bz2.BZ2Compressor()),
55 "HG10GZ": ("HG10GZ", lambda: zlib.compressobj()),
56 }
57
58 @@ -59,14 +58,13 @@ def collector(cl, mmfs, files):
59 return collect
60
61 # hgweb uses this list to communicate its preferred type
62 -bundlepriority = ['HG10GZ', 'HG10BZ', 'HG10UN']
63 +bundlepriority = ['HG10GZ', 'HG10UN']
64
65 def writebundle(cg, filename, bundletype):
66 """Write a bundle file and return its filename.
67
68 Existing files will not be overwritten.
69 If no filename is specified, a temporary file is created.
70 - bz2 compression can be turned off.
71 The bundle file will be deleted in case of errors.
72 """
73
74 @@ -124,12 +122,6 @@ def decompressor(fh, alg):
75 zd = zlib.decompressobj()
76 for chunk in f:
77 yield zd.decompress(chunk)
78 - elif alg == 'BZ':
79 - def generator(f):
80 - zd = bz2.BZ2Decompressor()
81 - zd.decompress("BZ")
82 - for chunk in util.filechunkiter(f, 4096):
83 - yield zd.decompress(chunk)
84 else:
85 raise util.Abort("unknown bundle compression '%s'" % alg)
86 return util.chunkbuffer(generator(fh))
87 --- a/mercurial/hgweb/hgwebdir_mod.py
88 +++ b/mercurial/hgweb/hgwebdir_mod.py
89 @@ -204,7 +204,7 @@ class hgwebdir(object):
90 def archivelist(ui, nodeid, url):
91 allowed = ui.configlist("web", "allow_archive", untrusted=True)
92 archives = []
93 - for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]:
94 + for i in [('zip', '.zip'), ('gz', '.tar.gz')]:
95 if i[0] in allowed or ui.configbool("web", "allow" + i[0],
96 untrusted=True):
97 archives.append({"type" : i[0], "extension": i[1],
98 --- a/mercurial/hgweb/hgweb_mod.py
99 +++ b/mercurial/hgweb/hgweb_mod.py
100 @@ -40,7 +40,7 @@ class hgweb(object):
101 self.mtime = -1
102 self.size = -1
103 self.reponame = name
104 - self.archives = 'zip', 'gz', 'bz2'
105 + self.archives = 'zip', 'gz'
106 self.stripecount = 1
107 # a repo owner may set web.templates in .hg/hgrc to get any file
108 # readable by the user running the CGI script
109 @@ -284,7 +284,6 @@ class hgweb(object):
110 yield {"type" : i, "extension" : spec[2], "node" : nodeid}
111
112 archive_specs = {
113 - 'bz2': ('application/x-bzip2', 'tbz2', '.tar.bz2', None),
114 'gz': ('application/x-gzip', 'tgz', '.tar.gz', None),
115 'zip': ('application/zip', 'zip', '.zip', None),
116 }
117 --- a/mercurial/repair.py
118 +++ b/mercurial/repair.py
119 @@ -19,7 +19,7 @@ def _bundle(repo, bases, heads, node, su
120 os.mkdir(backupdir)
121 name = os.path.join(backupdir, "%s-%s.hg" % (short(node), suffix))
122 if compress:
123 - bundletype = "HG10BZ"
124 + bundletype = "HG10GZ"
125 else:
126 bundletype = "HG10UN"
127 return changegroup.writebundle(cg, name, bundletype)
128 --- a/mercurial/commands.py
129 +++ b/mercurial/commands.py
130 @@ -162,7 +162,6 @@ def archive(ui, repo, dest, **opts):
131
132 :``files``: a directory full of files (default)
133 :``tar``: tar archive, uncompressed
134 - :``tbz2``: tar archive, compressed using bzip2
135 :``tgz``: tar archive, compressed using gzip
136 :``uzip``: zip archive, uncompressed
137 :``zip``: zip archive, compressed using deflate
138 @@ -644,8 +643,8 @@ def bundle(ui, repo, fname, dest=None, *
139 -a/--all (or --base null).
140
141 You can change compression method with the -t/--type option.
142 - The available compression methods are: none, bzip2, and
143 - gzip (by default, bundles are compressed using bzip2).
144 + The available compression methods are: none, and
145 + gzip (by default, bundles are compressed using gzip).
146
147 The bundle file can then be transferred using conventional means
148 and applied to another repository with the unbundle or pull
149 @@ -712,8 +711,8 @@ def bundle(ui, repo, fname, dest=None, *
150 else:
151 cg = repo.changegroup(o, 'bundle')
152
153 - bundletype = opts.get('type', 'bzip2').lower()
154 - btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'}
155 + bundletype = opts.get('type', 'gzip').lower()
156 + btypes = {'none': 'HG10UN', 'gzip': 'HG10GZ'}
157 bundletype = btypes.get(bundletype)
158 if bundletype not in changegroup.bundletypes:
159 raise util.Abort(_('unknown bundle type specified with --type'))
160 @@ -4316,7 +4315,7 @@ table = {
161 _('a base changeset assumed to be available at the destination'),
162 _('REV')),
163 ('a', 'all', None, _('bundle all changesets in the repository')),
164 - ('t', 'type', 'bzip2',
165 + ('t', 'type', 'gzip',
166 _('bundle compression type to use'), _('TYPE')),
167 ] + remoteopts,
168 _('[-f] [-t TYPE] [-a] [-r REV]... [--base REV]... FILE [DEST]')),
169 --- a/setup.py
170 +++ b/setup.py
171 @@ -36,12 +36,6 @@ except:
172 raise SystemExit(
173 "Couldn't import standard zlib (incomplete Python install).")
174
175 -try:
176 - import bz2
177 -except:
178 - raise SystemExit(
179 - "Couldn't import standard bz2 (incomplete Python install).")
180 -
181 import os, subprocess, time
182 import shutil
183 import tempfile