Show More
@@ -169,20 +169,23 b' class hgweb(object):' | |||||
169 |
|
169 | |||
170 | req.write(content) |
|
170 | req.write(content) | |
171 | del tmpl |
|
171 | del tmpl | |
172 |
return |
|
172 | return [] | |
173 |
|
173 | |||
174 | except revlog.LookupError, err: |
|
174 | except revlog.LookupError, err: | |
175 | req.respond(HTTP_NOT_FOUND, ctype) |
|
175 | req.respond(HTTP_NOT_FOUND, ctype) | |
176 | msg = str(err) |
|
176 | msg = str(err) | |
177 | if 'manifest' not in msg: |
|
177 | if 'manifest' not in msg: | |
178 | msg = 'revision not found: %s' % err.name |
|
178 | msg = 'revision not found: %s' % err.name | |
179 |
re |
|
179 | req.write(tmpl('error', error=msg)) | |
|
180 | return [] | |||
180 | except (RepoError, revlog.RevlogError), inst: |
|
181 | except (RepoError, revlog.RevlogError), inst: | |
181 | req.respond(HTTP_SERVER_ERROR, ctype) |
|
182 | req.respond(HTTP_SERVER_ERROR, ctype) | |
182 |
re |
|
183 | req.write(tmpl('error', error=str(inst))) | |
|
184 | return [] | |||
183 | except ErrorResponse, inst: |
|
185 | except ErrorResponse, inst: | |
184 | req.respond(inst.code, ctype) |
|
186 | req.respond(inst.code, ctype) | |
185 |
re |
|
187 | req.write(tmpl('error', error=inst.message)) | |
|
188 | return [] | |||
186 |
|
189 | |||
187 | def templater(self, req): |
|
190 | def templater(self, req): | |
188 |
|
191 |
@@ -89,12 +89,14 b' class hgwebdir(object):' | |||||
89 | fname = virtual[7:] |
|
89 | fname = virtual[7:] | |
90 | else: |
|
90 | else: | |
91 | fname = req.form['static'][0] |
|
91 | fname = req.form['static'][0] | |
92 |
re |
|
92 | req.write(staticfile(static, fname, req)) | |
|
93 | return [] | |||
93 |
|
94 | |||
94 | # top-level index |
|
95 | # top-level index | |
95 | elif not virtual: |
|
96 | elif not virtual: | |
96 | req.respond(HTTP_OK, ctype) |
|
97 | req.respond(HTTP_OK, ctype) | |
97 |
re |
|
98 | req.write(self.makeindex(req, tmpl)) | |
|
99 | return [] | |||
98 |
|
100 | |||
99 | # nested indexes and hgwebs |
|
101 | # nested indexes and hgwebs | |
100 |
|
102 | |||
@@ -116,7 +118,8 b' class hgwebdir(object):' | |||||
116 | subdir = virtual + '/' |
|
118 | subdir = virtual + '/' | |
117 | if [r for r in repos if r.startswith(subdir)]: |
|
119 | if [r for r in repos if r.startswith(subdir)]: | |
118 | req.respond(HTTP_OK, ctype) |
|
120 | req.respond(HTTP_OK, ctype) | |
119 |
re |
|
121 | req.write(self.makeindex(req, tmpl, subdir)) | |
|
122 | return [] | |||
120 |
|
123 | |||
121 | up = virtual.rfind('/') |
|
124 | up = virtual.rfind('/') | |
122 | if up < 0: |
|
125 | if up < 0: | |
@@ -125,11 +128,13 b' class hgwebdir(object):' | |||||
125 |
|
128 | |||
126 | # prefixes not found |
|
129 | # prefixes not found | |
127 | req.respond(HTTP_NOT_FOUND, ctype) |
|
130 | req.respond(HTTP_NOT_FOUND, ctype) | |
128 |
re |
|
131 | req.write(tmpl("notfound", repo=virtual)) | |
|
132 | return [] | |||
129 |
|
133 | |||
130 | except ErrorResponse, err: |
|
134 | except ErrorResponse, err: | |
131 | req.respond(err.code, ctype) |
|
135 | req.respond(err.code, ctype) | |
132 |
re |
|
136 | req.write(tmpl('error', error=err.message or '')) | |
|
137 | return [] | |||
133 | finally: |
|
138 | finally: | |
134 | tmpl = None |
|
139 | tmpl = None | |
135 |
|
140 |
@@ -43,17 +43,15 b' env = {' | |||||
43 |
|
43 | |||
44 | output = StringIO() |
|
44 | output = StringIO() | |
45 | env['QUERY_STRING'] = 'style=atom' |
|
45 | env['QUERY_STRING'] = 'style=atom' | |
46 |
|
|
46 | hgweb('.', name = 'repo')(env, startrsp) | |
47 |
|
|
47 | print output.getvalue() | |
48 | sys.stdout.write(''.join(content)) |
|
|||
49 | print '---- ERRORS' |
|
48 | print '---- ERRORS' | |
50 | print errors.getvalue() |
|
49 | print errors.getvalue() | |
51 |
|
50 | |||
52 | output = StringIO() |
|
51 | output = StringIO() | |
53 | env['QUERY_STRING'] = 'style=raw' |
|
52 | env['QUERY_STRING'] = 'style=raw' | |
54 |
|
|
53 | hgwebdir({'repo': '.'})(env, startrsp) | |
55 |
|
|
54 | print output.getvalue() | |
56 | sys.stdout.write(''.join(content)) |
|
|||
57 | print '---- ERRORS' |
|
55 | print '---- ERRORS' | |
58 | print errors.getvalue() |
|
56 | print errors.getvalue() | |
59 | EOF |
|
57 | EOF |
@@ -35,6 +35,7 b' 200 Script output follows' | |||||
35 | </entry> |
|
35 | </entry> | |
36 |
|
36 | |||
37 | </feed> |
|
37 | </feed> | |
|
38 | ||||
38 | ---- ERRORS |
|
39 | ---- ERRORS | |
39 |
|
40 | |||
40 | ---- HEADERS |
|
41 | ---- HEADERS | |
@@ -44,5 +45,6 b' 200 Script output follows' | |||||
44 |
|
45 | |||
45 | repo/ |
|
46 | repo/ | |
46 |
|
47 | |||
|
48 | ||||
47 | ---- ERRORS |
|
49 | ---- ERRORS | |
48 |
|
50 |
@@ -44,36 +44,32 b' env = {' | |||||
44 | output = StringIO() |
|
44 | output = StringIO() | |
45 | env['PATH_INFO'] = '/' |
|
45 | env['PATH_INFO'] = '/' | |
46 | env['QUERY_STRING'] = 'style=atom' |
|
46 | env['QUERY_STRING'] = 'style=atom' | |
47 |
|
|
47 | hgweb('.', name = 'repo')(env, startrsp) | |
48 |
|
|
48 | print output.getvalue() | |
49 | sys.stdout.write(''.join(content)) |
|
|||
50 | print '---- ERRORS' |
|
49 | print '---- ERRORS' | |
51 | print errors.getvalue() |
|
50 | print errors.getvalue() | |
52 |
|
51 | |||
53 | output = StringIO() |
|
52 | output = StringIO() | |
54 | env['PATH_INFO'] = '/file/tip/' |
|
53 | env['PATH_INFO'] = '/file/tip/' | |
55 | env['QUERY_STRING'] = 'style=raw' |
|
54 | env['QUERY_STRING'] = 'style=raw' | |
56 |
|
|
55 | hgweb('.', name = 'repo')(env, startrsp) | |
57 |
|
|
56 | print output.getvalue() | |
58 | sys.stdout.write(''.join(content)) |
|
|||
59 | print '---- ERRORS' |
|
57 | print '---- ERRORS' | |
60 | print errors.getvalue() |
|
58 | print errors.getvalue() | |
61 |
|
59 | |||
62 | output = StringIO() |
|
60 | output = StringIO() | |
63 | env['PATH_INFO'] = '/' |
|
61 | env['PATH_INFO'] = '/' | |
64 | env['QUERY_STRING'] = 'style=raw' |
|
62 | env['QUERY_STRING'] = 'style=raw' | |
65 |
|
|
63 | hgwebdir({'repo': '.'})(env, startrsp) | |
66 |
|
|
64 | print output.getvalue() | |
67 | sys.stdout.write(''.join(content)) |
|
|||
68 | print '---- ERRORS' |
|
65 | print '---- ERRORS' | |
69 | print errors.getvalue() |
|
66 | print errors.getvalue() | |
70 |
|
67 | |||
71 | output = StringIO() |
|
68 | output = StringIO() | |
72 | env['PATH_INFO'] = '/repo/file/tip/' |
|
69 | env['PATH_INFO'] = '/repo/file/tip/' | |
73 | env['QUERY_STRING'] = 'style=raw' |
|
70 | env['QUERY_STRING'] = 'style=raw' | |
74 |
|
|
71 | hgwebdir({'repo': '.'})(env, startrsp) | |
75 |
|
|
72 | print output.getvalue() | |
76 | sys.stdout.write(''.join(content)) |
|
|||
77 | print '---- ERRORS' |
|
73 | print '---- ERRORS' | |
78 | print errors.getvalue() |
|
74 | print errors.getvalue() | |
79 | EOF |
|
75 | EOF |
@@ -35,6 +35,7 b' 200 Script output follows' | |||||
35 | </entry> |
|
35 | </entry> | |
36 |
|
36 | |||
37 | </feed> |
|
37 | </feed> | |
|
38 | ||||
38 | ---- ERRORS |
|
39 | ---- ERRORS | |
39 |
|
40 | |||
40 | ---- HEADERS |
|
41 | ---- HEADERS | |
@@ -45,6 +46,7 b' 200 Script output follows' | |||||
45 | -rw-r--r-- 4 bar |
|
46 | -rw-r--r-- 4 bar | |
46 |
|
47 | |||
47 |
|
48 | |||
|
49 | ||||
48 | ---- ERRORS |
|
50 | ---- ERRORS | |
49 |
|
51 | |||
50 | ---- HEADERS |
|
52 | ---- HEADERS | |
@@ -54,6 +56,7 b' 200 Script output follows' | |||||
54 |
|
56 | |||
55 | /repo/ |
|
57 | /repo/ | |
56 |
|
58 | |||
|
59 | ||||
57 | ---- ERRORS |
|
60 | ---- ERRORS | |
58 |
|
61 | |||
59 | ---- HEADERS |
|
62 | ---- HEADERS | |
@@ -64,5 +67,6 b' 200 Script output follows' | |||||
64 | -rw-r--r-- 4 bar |
|
67 | -rw-r--r-- 4 bar | |
65 |
|
68 | |||
66 |
|
69 | |||
|
70 | ||||
67 | ---- ERRORS |
|
71 | ---- ERRORS | |
68 |
|
72 |
General Comments 0
You need to be logged in to leave comments.
Login now