hgweb: cleaner if conditions in changelog() function
authorAlexander Plavin <alexander@plav.in>
Fri, 19 Jul 2013 02:08:19 +0400
changeset 19534 983bb4069004
parent 19533 9a020b354d93
child 19535 df2155ebf502
hgweb: cleaner if conditions in changelog() function This removes unneeded extra nesting level and extra variable, which makes the code easier to understand.
mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py	Mon Jul 15 01:10:22 2013 +0400
+++ b/mercurial/hgweb/webcommands.py	Fri Jul 19 02:08:19 2013 +0400
@@ -193,16 +193,14 @@
     query = ''
     if 'node' in req.form:
         ctx = webutil.changectx(web.repo, req)
-    else:
-        if 'rev' in req.form:
-            query = req.form['rev'][0]
-            hi = query
-        else:
-            hi = 'tip'
+    elif 'rev' in req.form:
+        query = req.form['rev'][0]
         try:
-            ctx = web.repo[hi]
+            ctx = web.repo[query]
         except (error.RepoError, error.LookupError):
             return _search(web, req, tmpl) # XXX redirect to 404 page?
+    else:
+        ctx = web.repo['tip']
 
     def changelist(latestonly, **map):
         revs = []