[package] update mercurial to 1.6.2
[openwrt/svn-archive/archive.git] / net / mercurial / patches / 001-no_bzip2.patch
1 diff -urN mercurial-1.6.2/mercurial/archival.py mercurial-1.6.2-nobz2/mercurial/archival.py
2 --- mercurial-1.6.2/mercurial/archival.py 2009-01-01 00:38:33.000000000 +0100
3 +++ mercurial-1.6.2-nobz2/mercurial/archival.py 2009-01-01 13:53:14.000000000 +0100
4 @@ -67,8 +67,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 @@ -182,7 +182,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.6.2/mercurial/bundlerepo.py mercurial-1.6.2-nobz2/mercurial/bundlerepo.py
24 --- mercurial-1.6.2/mercurial/bundlerepo.py 2009-01-01 00:38:33.000000000 +0100
25 +++ mercurial-1.6.2-nobz2/mercurial/bundlerepo.py 2009-01-01 13:53:59.000000000 +0100
26 @@ -13,7 +13,7 @@
27
28 from node import nullid
29 from i18n import _
30 -import os, struct, bz2, zlib, tempfile, shutil
31 +import os, struct, zlib, tempfile, shutil
32 import changegroup, util, mdiff
33 import localrepo, changelog, manifest, filelog, revlog, error
34
35 @@ -177,16 +177,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.6.2/mercurial/changegroup.py mercurial-1.6.2-nobz2/mercurial/changegroup.py
55 --- mercurial-1.6.2/mercurial/changegroup.py 2009-01-01 00:38:33.000000000 +0100
56 +++ mercurial-1.6.2-nobz2/mercurial/changegroup.py 2009-01-01 13:52:05.000000000 +0100
57 @@ -8,5 +8,5 @@
58 from i18n import _
59 import util
60 -import struct, os, bz2, zlib, tempfile
61 +import struct, os, zlib, tempfile
62
63 def getchunk(source):
64 @@ -52,7 +52,6 @@
65 bundletypes = {
66 "": ("", nocompress),
67 "HG10UN": ("HG10UN", nocompress),
68 - "HG10BZ": ("HG10", lambda: bz2.BZ2Compressor()),
69 "HG10GZ": ("HG10GZ", lambda: zlib.compressobj()),
70 }
71
72 @@ -69,4 +68,4 @@
73 # hgweb uses this list to communicate its preferred type
74 -bundlepriority = ['HG10GZ', 'HG10BZ', 'HG10UN']
75 +bundlepriority = ['HG10GZ', 'HG10UN']
76
77 def writebundle(cg, filename, bundletype):
78 @@ -135,12 +134,6 @@
79 zd = zlib.decompressobj()
80 for chunk in f:
81 yield zd.decompress(chunk)
82 - elif header == 'HG10BZ':
83 - def generator(f):
84 - zd = bz2.BZ2Decompressor()
85 - zd.decompress("BZ")
86 - for chunk in util.filechunkiter(f, 4096):
87 - yield zd.decompress(chunk)
88 return util.chunkbuffer(generator(fh))
89
90 def readbundle(fh, fname):
91 diff -urN mercurial-1.6.2/mercurial/hgweb/hgwebdir_mod.py mercurial-1.6.2-nobz2/mercurial/hgweb/hgwebdir_mod.py
92 --- mercurial-1.6.2/mercurial/hgweb/hgwebdir_mod.py 2009-01-01 00:38:33.000000000 +0100
93 +++ mercurial-1.6.2-nobz2/mercurial/hgweb/hgwebdir_mod.py 2009-01-01 13:54:29.000000000 +0100
94 @@ -191,7 +191,7 @@
95
96 def archivelist(ui, nodeid, url):
97 allowed = ui.configlist("web", "allow_archive", untrusted=True)
98 - for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]:
99 + for i in [('zip', '.zip'), ('gz', '.tar.gz')]:
100 if i[0] in allowed or ui.configbool("web", "allow" + i[0],
101 untrusted=True):
102 yield {"type" : i[0], "extension": i[1],
103 diff -urN mercurial-1.6.2/mercurial/hgweb/hgweb_mod.py mercurial-1.6.2-nobz2/mercurial/hgweb/hgweb_mod.py
104 --- mercurial-1.6.2/mercurial/hgweb/hgweb_mod.py 2009-01-01 00:38:33.000000000 +0100
105 +++ mercurial-1.6.2-nobz2/mercurial/hgweb/hgweb_mod.py 2009-01-01 13:55:08.000000000 +0100
106 @@ -38,7 +38,7 @@
107 hook.redirect(True)
108 self.mtime = -1
109 self.reponame = name
110 - self.archives = 'zip', 'gz', 'bz2'
111 + self.archives = 'zip', 'gz'
112 self.stripecount = 1
113 # a repo owner may set web.templates in .hg/hgrc to get any file
114 # readable by the user running the CGI script
115 @@ -281,7 +281,6 @@
116 yield {"type" : i, "extension" : spec[2], "node" : nodeid}
117
118 archive_specs = {
119 - 'bz2': ('application/x-tar', 'tbz2', '.tar.bz2', None),
120 'gz': ('application/x-tar', 'tgz', '.tar.gz', None),
121 'zip': ('application/zip', 'zip', '.zip', None),
122 }
123 diff -urN mercurial-1.6.2/mercurial/repair.py mercurial-1.6.2-nobz2/mercurial/repair.py
124 --- mercurial-1.6.2/mercurial/repair.py 2009-01-01 00:38:33.000000000 +0100
125 +++ mercurial-1.6.2-nobz2/mercurial/repair.py 2009-01-01 13:55:08.000000000 +0100
126 @@ -20,4 +20,4 @@
127 name = os.path.join(backupdir, "%s-%s.hg" % (short(node), suffix))
128 - return changegroup.writebundle(cg, name, "HG10BZ")
129 + return changegroup.writebundle(cg, name, "HG10GZ")
130
131 def _collectfiles(repo, striprev):
132 diff -urN mercurial-1.6.2/mercurial/commands.py mercurial-1.6.2-nobz2/mercurial/commands.py
133 --- mercurial-1.6.2/mercurial/commands.py 2009-01-01 00:38:33.000000000 +0100
134 +++ mercurial-1.6.2-nobz2/mercurial/commands.py 2009-01-01 13:55:08.000000000 +0100
135 @@ -200,7 +200,6 @@
136 def guess_type():
137 exttypes = {
138 'tar': ['.tar'],
139 - 'tbz2': ['.tbz2', '.tar.bz2'],
140 'tgz': ['.tgz', '.tar.gz'],
141 'zip': ['.zip'],
142 }
143 @@ -613,8 +612,8 @@
144 else:
145 cg = repo.changegroup(o, 'bundle')
146
147 - bundletype = opts.get('type', 'bzip2').lower()
148 - btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'}
149 + bundletype = opts.get('type', 'gzip').lower()
150 + btypes = {'none': 'HG10UN', 'gzip': 'HG10GZ'}
151 bundletype = btypes.get(bundletype)
152 if bundletype not in changegroup.bundletypes:
153 raise util.Abort(_('unknown bundle type specified with --type'))
154 @@ -2365,7 +2364,7 @@
155 cg = other.changegroup(incoming, "incoming")
156 else:
157 cg = other.changegroupsubset(incoming, revs, 'incoming')
158 - bundletype = other.local() and "HG10BZ" or "HG10UN"
159 + bundletype = other.local() and "HG10GZ" or "HG10UN"
160 fname = cleanup = changegroup.writebundle(cg, fname, bundletype)
161 # keep written bundle?
162 if opts["bundle"]:
163 @@ -4043,7 +4042,7 @@
164 _('a base changeset assumed to be available at the destination'),
165 _('REV')),
166 ('a', 'all', None, _('bundle all changesets in the repository')),
167 - ('t', 'type', 'bzip2',
168 + ('t', 'type', 'gzip',
169 _('bundle compression type to use'), _('TYPE')),
170 ] + remoteopts,
171 _('[-f] [-t TYPE] [-a] [-r REV]... [--base REV]... FILE [DEST]')),
172 diff -urN mercurial-1.6.2/setup.py mercurial-1.6.2-nobz2/setup.py
173 --- mercurial-1.6.2/setup.py 2009-01-01 00:38:33.000000000 +0100
174 +++ mercurial-1.6.2-nobz2/setup.py 2009-01-01 13:55:08.000000000 +0100
175 @@ -27,9 +27,3 @@
176 "Couldn't import standard zlib (incomplete Python install).")
177 -
178 -try:
179 - import bz2
180 -except:
181 - raise SystemExit(
182 - "Couldn't import standard bz2 (incomplete Python install).")
183
184 import os, subprocess, time