changeset 6853:2ff0829bdae5

hgweb: do not use unassigned variables in exception handling
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Fri, 01 Aug 2008 12:33:10 +0200
parents 6ec941b6003d
children 9d11faecb0f1
files mercurial/hgweb/webcommands.py
diffstat 1 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Wed Jul 30 22:26:41 2008 +0200
+++ b/mercurial/hgweb/webcommands.py	Fri Aug 01 12:33:10 2008 +0200
@@ -53,16 +53,15 @@
 
 def file(web, req, tmpl):
     path = web.cleanpath(req.form.get('file', [''])[0])
-    if path:
+    if not path:
+        return web.manifest(tmpl, web.changectx(req), path)
+    try:
+        return web.filerevision(tmpl, web.filectx(req))
+    except revlog.LookupError, inst:
         try:
-            return web.filerevision(tmpl, web.filectx(req))
-        except revlog.LookupError, inst:
-            pass
-
-    try:
-        return web.manifest(tmpl, web.changectx(req), path)
-    except ErrorResponse:
-        raise inst
+            return web.manifest(tmpl, web.changectx(req), path)
+        except ErrorResponse:
+            raise inst
 
 def changelog(web, req, tmpl, shortlog = False):
     if 'node' in req.form: