##// END OF EJS Templates
hgweb: avoid traceback when file or node parameters are missing...
Ross Lagerwall -
r17289:f2d6b4f8 stable
parent child Browse files
Show More
@@ -586,6 +586,8 diff = filediff
586
586
587 def comparison(web, req, tmpl):
587 def comparison(web, req, tmpl):
588 ctx = webutil.changectx(web.repo, req)
588 ctx = webutil.changectx(web.repo, req)
589 if 'file' not in req.form:
590 raise ErrorResponse(HTTP_NOT_FOUND, 'file not given')
589 path = webutil.cleanpath(web.repo, req.form['file'][0])
591 path = webutil.cleanpath(web.repo, req.form['file'][0])
590 rename = path in ctx and webutil.renamelink(ctx[path]) or []
592 rename = path in ctx and webutil.renamelink(ctx[path]) or []
591
593
@@ -10,6 +10,8 import os, mimetypes, copy
10 from mercurial import match, patch, scmutil, error, ui, util
10 from mercurial import match, patch, scmutil, error, ui, util
11 from mercurial.i18n import _
11 from mercurial.i18n import _
12 from mercurial.node import hex, nullid
12 from mercurial.node import hex, nullid
13 from common import ErrorResponse
14 from common import HTTP_NOT_FOUND
13 import difflib
15 import difflib
14
16
15 def up(p):
17 def up(p):
@@ -154,11 +156,15 def changectx(repo, req):
154 return ctx
156 return ctx
155
157
156 def filectx(repo, req):
158 def filectx(repo, req):
159 if 'file' not in req.form:
160 raise ErrorResponse(HTTP_NOT_FOUND, 'file not given')
157 path = cleanpath(repo, req.form['file'][0])
161 path = cleanpath(repo, req.form['file'][0])
158 if 'node' in req.form:
162 if 'node' in req.form:
159 changeid = req.form['node'][0]
163 changeid = req.form['node'][0]
164 elif 'filenode' in req.form:
165 changeid = req.form['filenode'][0]
160 else:
166 else:
161 changeid = req.form['filenode'][0]
167 raise ErrorResponse(HTTP_NOT_FOUND, 'node or filenode not given')
162 try:
168 try:
163 fctx = repo[changeid][path]
169 fctx = repo[changeid][path]
164 except error.RepoError:
170 except error.RepoError:
General Comments 0
You need to be logged in to leave comments. Login now