comparison mercurial/hgweb/webcommands.py @ 17289:f2d6b4f8e78c stable

hgweb: avoid traceback when file or node parameters are missing Previously, browsing to http://serv/diff would generate an internal server error due to the file and node parameters being missing. The same error also occurred for filelog, comparison and annotate.
author Ross Lagerwall <rosslagerwall@gmail.com>
date Mon, 30 Jul 2012 11:02:10 +0200
parents c0068b058fcd
children 5c64ce6168da
comparison
equal deleted inserted replaced
17288:fa223eecc6d7 17289:f2d6b4f8e78c
584 584
585 diff = filediff 585 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
592 parsecontext = lambda v: v == 'full' and -1 or int(v) 594 parsecontext = lambda v: v == 'full' and -1 or int(v)
593 if 'context' in req.form: 595 if 'context' in req.form: