Show More
@@ -10,6 +10,7 b' import os, cgi, sys' | |||||
10 | from demandload import demandload |
|
10 | from demandload import demandload | |
11 | demandload(globals(), "mdiff time re socket zlib errno ui hg ConfigParser") |
|
11 | demandload(globals(), "mdiff time re socket zlib errno ui hg ConfigParser") | |
12 | demandload(globals(), "zipfile tempfile StringIO tarfile BaseHTTPServer util") |
|
12 | demandload(globals(), "zipfile tempfile StringIO tarfile BaseHTTPServer util") | |
|
13 | demandload(globals(), "mimetypes") | |||
13 | from node import * |
|
14 | from node import * | |
14 | from i18n import gettext as _ |
|
15 | from i18n import gettext as _ | |
15 |
|
16 | |||
@@ -466,6 +467,11 b' class hgweb:' | |||||
466 | cs = cl.read(cn) |
|
467 | cs = cl.read(cn) | |
467 | mfn = cs[0] |
|
468 | mfn = cs[0] | |
468 |
|
469 | |||
|
470 | mt = mimetypes.guess_type(f)[0] | |||
|
471 | rawtext = text | |||
|
472 | if util.binary(text): | |||
|
473 | text = "(binary:%s)" % mt | |||
|
474 | ||||
469 | def lines(): |
|
475 | def lines(): | |
470 | for l, t in enumerate(text.splitlines(1)): |
|
476 | for l, t in enumerate(text.splitlines(1)): | |
471 | yield {"line": t, |
|
477 | yield {"line": t, | |
@@ -477,6 +483,8 b' class hgweb:' | |||||
477 | filenode=node, |
|
483 | filenode=node, | |
478 | path=up(f), |
|
484 | path=up(f), | |
479 | text=lines(), |
|
485 | text=lines(), | |
|
486 | raw=rawtext, | |||
|
487 | mimetype=mt, | |||
480 | rev=changerev, |
|
488 | rev=changerev, | |
481 | node=hex(cn), |
|
489 | node=hex(cn), | |
482 | manifest=hex(mfn), |
|
490 | manifest=hex(mfn), |
@@ -1,3 +1,4 b'' | |||||
1 | #header# |
|
1 | Context-type: #mimetype# | |
2 | #text%fileline# |
|
2 | Content-disposition: filename=#file# | |
3 | #footer# |
|
3 | ||
|
4 | #raw# |
@@ -10,7 +10,7 b'' | |||||
10 | <a href="?mf=#manifest|short#;path=#path#">manifest</a> |
|
10 | <a href="?mf=#manifest|short#;path=#path#">manifest</a> | |
11 | <a href="?fl=#filenode|short#;file=#file#">revisions</a> |
|
11 | <a href="?fl=#filenode|short#;file=#file#">revisions</a> | |
12 | <a href="?fa=#filenode|short#;file=#file#">annotate</a> |
|
12 | <a href="?fa=#filenode|short#;file=#file#">annotate</a> | |
13 | <a href="?f=#node|short#;file=#file#;style=raw">raw</a> |
|
13 | <a href="?f=#filenode|short#;file=#file#;style=raw">raw</a> | |
14 | </div> |
|
14 | </div> | |
15 |
|
15 | |||
16 | <h2>#file#</h2> |
|
16 | <h2>#file#</h2> |
General Comments 0
You need to be logged in to leave comments.
Login now