Show More
@@ -158,6 +158,7 b' class hgweb:' | |||||
158 | self.mtime = -1 |
|
158 | self.mtime = -1 | |
159 | self.reponame = name or self.repo.ui.config("web", "name", |
|
159 | self.reponame = name or self.repo.ui.config("web", "name", | |
160 | self.repo.root) |
|
160 | self.repo.root) | |
|
161 | self.supportedtarballs = 'zip', 'gz', 'bz2' | |||
161 |
|
162 | |||
162 | def refresh(self): |
|
163 | def refresh(self): | |
163 | s = os.stat(os.path.join(self.repo.root, ".hg", "00changelog.i")) |
|
164 | s = os.stat(os.path.join(self.repo.root, ".hg", "00changelog.i")) | |
@@ -167,9 +168,10 b' class hgweb:' | |||||
167 | self.maxchanges = self.repo.ui.config("web", "maxchanges", 10) |
|
168 | self.maxchanges = self.repo.ui.config("web", "maxchanges", 10) | |
168 | self.maxfiles = self.repo.ui.config("web", "maxchanges", 10) |
|
169 | self.maxfiles = self.repo.ui.config("web", "maxchanges", 10) | |
169 | self.allowpull = self.repo.ui.configbool("web", "allowpull", True) |
|
170 | self.allowpull = self.repo.ui.configbool("web", "allowpull", True) | |
170 | self.allowzip = self.repo.ui.configbool("web", "zip", True) |
|
171 | self.allowedtarballs = [] | |
171 | self.allowgz = self.repo.ui.configbool("web", "gz", True) |
|
172 | for i in self.supportedtarballs: | |
172 |
|
|
173 | if self.repo.ui.configbool("web", i, True): | |
|
174 | self.allowedtarballs.append(i) | |||
173 |
|
175 | |||
174 | def date(self, cs): |
|
176 | def date(self, cs): | |
175 | return time.asctime(time.gmtime(float(cs[2].split(' ')[0]))) |
|
177 | return time.asctime(time.gmtime(float(cs[2].split(' ')[0]))) | |
@@ -197,16 +199,6 b' class hgweb:' | |||||
197 | for t in self.repo.nodetags(node): |
|
199 | for t in self.repo.nodetags(node): | |
198 | yield self.t(t1, tag=t, **args) |
|
200 | yield self.t(t1, tag=t, **args) | |
199 |
|
201 | |||
200 | def tarballbuttons(self, m): |
|
|||
201 | s = '' |
|
|||
202 | if self.allowzip: |
|
|||
203 | s += '<a href="?cmd=tarball;manifest=%s;type=zip">zip</a>\n' % m |
|
|||
204 | if self.allowgz: |
|
|||
205 | s += '<a href="?cmd=tarball;manifest=%s;type=gz">gz</a>\n' % m |
|
|||
206 | if self.allowbz2: |
|
|||
207 | s += '<a href="?cmd=tarball;manifest=%s;type=bz2">bz2</a>\n' % m |
|
|||
208 | return s |
|
|||
209 |
|
||||
210 | def diff(self, node1, node2, files): |
|
202 | def diff(self, node1, node2, files): | |
211 | def filterfiles(list, files): |
|
203 | def filterfiles(list, files): | |
212 | l = [x for x in list if x in files] |
|
204 | l = [x for x in list if x in files] | |
@@ -403,6 +395,11 b' class hgweb:' | |||||
403 | def diff(**map): |
|
395 | def diff(**map): | |
404 | yield self.diff(p1, n, None) |
|
396 | yield self.diff(p1, n, None) | |
405 |
|
397 | |||
|
398 | def tarballs(): | |||
|
399 | for i in self.allowedtarballs: | |||
|
400 | yield {"type" : i, | |||
|
401 | "manifest" : hex(changes[0])} | |||
|
402 | ||||
406 | yield self.t('changeset', |
|
403 | yield self.t('changeset', | |
407 | diff=diff, |
|
404 | diff=diff, | |
408 | rev=cl.rev(n), |
|
405 | rev=cl.rev(n), | |
@@ -415,7 +412,7 b' class hgweb:' | |||||
415 | desc=changes[4], |
|
412 | desc=changes[4], | |
416 | date=t, |
|
413 | date=t, | |
417 | files=files, |
|
414 | files=files, | |
418 |
tarballb |
|
415 | tarballbs = tarballs()) | |
419 |
|
416 | |||
420 | def filelog(self, f, filenode): |
|
417 | def filelog(self, f, filenode): | |
421 | cl = self.repo.changelog |
|
418 | cl = self.repo.changelog | |
@@ -643,7 +640,8 b' class hgweb:' | |||||
643 | cl.parents(n), cl.rev), |
|
640 | cl.parents(n), cl.rev), | |
644 | diff=diff) |
|
641 | diff=diff) | |
645 |
|
642 | |||
646 |
def |
|
643 | def tarball(self, mnode, type): | |
|
644 | if type == 'zip': | |||
647 | import zipfile |
|
645 | import zipfile | |
648 |
|
646 | |||
649 | tmp = tempfile.mkstemp()[1] |
|
647 | tmp = tempfile.mkstemp()[1] | |
@@ -665,7 +663,7 b' class hgweb:' | |||||
665 | f.close() |
|
663 | f.close() | |
666 | os.unlink(tmp) |
|
664 | os.unlink(tmp) | |
667 |
|
665 | |||
668 | def tararchive(self, mnode, type): |
|
666 | else: | |
669 | import StringIO |
|
667 | import StringIO | |
670 | import time |
|
668 | import time | |
671 | import tarfile |
|
669 | import tarfile | |
@@ -815,13 +813,11 b' class hgweb:' | |||||
815 | elif args['cmd'][0] == 'tarball': |
|
813 | elif args['cmd'][0] == 'tarball': | |
816 | manifest = args['manifest'][0] |
|
814 | manifest = args['manifest'][0] | |
817 | type = args['type'][0] |
|
815 | type = args['type'][0] | |
818 | if type == 'zip' and self.allowzip: |
|
816 | for i in self.supportedtarballs: | |
819 | self.ziparchive(manifest) |
|
817 | if type == i and i in self.allowedtarballs: | |
820 | elif type == 'gz' and self.allowgz: |
|
818 | self.tarball(manifest, type) | |
821 | self.tararchive(manifest, 'gz') |
|
819 | return | |
822 | elif type == 'bz2' and self.allowbz2: |
|
820 | ||
823 | self.tararchive(manifest, 'bz2') |
|
|||
824 | else: |
|
|||
825 |
|
|
821 | write(self.t("error")) | |
826 |
|
822 | |||
827 | else: |
|
823 | else: |
@@ -8,7 +8,7 b'' | |||||
8 | <a href="?cmd=tags">tags</a> |
|
8 | <a href="?cmd=tags">tags</a> | |
9 | <a href="?cmd=manifest;manifest=#manifest#;path=/">manifest</a> |
|
9 | <a href="?cmd=manifest;manifest=#manifest#;path=/">manifest</a> | |
10 | <a href="?cmd=changeset;node=#node#;style=raw">raw</a> |
|
10 | <a href="?cmd=changeset;node=#node#;style=raw">raw</a> | |
11 | #tarballbuttons# |
|
11 | #tarballs%tarballentry# | |
12 | </div> |
|
12 | </div> | |
13 |
|
13 | |||
14 | <h2>changeset: #desc|escape|firstline#</h2> |
|
14 | <h2>changeset: #desc|escape|firstline#</h2> |
@@ -37,3 +37,4 b' filediffparent = "<tr><th class="parent"' | |||||
37 | filelogparent = "<tr><td align="right">parent #rev#: </td><td><a href="?cmd=file;file=#file#;filenode=#node#">#node|short#</a></td></tr>" |
|
37 | filelogparent = "<tr><td align="right">parent #rev#: </td><td><a href="?cmd=file;file=#file#;filenode=#node#">#node|short#</a></td></tr>" | |
38 | indexentry = "<tr class="parity#parity#"><td><a href="#url#">#name#</a></td><td>#shortdesc#</td><td>#author# <i>#email|obfuscate#</i></td><td>#lastupdate|age# ago</td></tr>" |
|
38 | indexentry = "<tr class="parity#parity#"><td><a href="#url#">#name#</a></td><td>#shortdesc#</td><td>#author# <i>#email|obfuscate#</i></td><td>#lastupdate|age# ago</td></tr>" | |
39 | index = index.tmpl |
|
39 | index = index.tmpl | |
|
40 | archiveentry = "<a href="?cmd=archive;node=#node#;type=#type#">#type#</a> " No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now