mercurial/hgweb.py
changeset 2119 f62195054c5b
parent 2113 633d733e7b11
child 2121 150cdd6c3c90
--- a/mercurial/hgweb.py	Sat Apr 22 09:19:27 2006 +0200
+++ b/mercurial/hgweb.py	Sun Apr 23 00:15:30 2006 +0200
@@ -776,54 +776,54 @@
         if not req.form.has_key('cmd'):
             req.form['cmd'] = [self.t.cache['default'],]
 
-        if req.form['cmd'][0] == 'changelog':
-            c = self.repo.changelog.count() - 1
-            hi = c
+        cmd = req.form['cmd'][0]
+        if cmd == 'changelog':
+            hi = self.repo.changelog.count() - 1
             if req.form.has_key('rev'):
                 hi = req.form['rev'][0]
                 try:
                     hi = self.repo.changelog.rev(self.repo.lookup(hi))
                 except hg.RepoError:
-                    req.write(self.search(hi))
+                    req.write(self.search(hi)) # XXX redirect to 404 page?
                     return
 
             req.write(self.changelog(hi))
 
-        elif req.form['cmd'][0] == 'changeset':
+        elif cmd == 'changeset':
             req.write(self.changeset(req.form['node'][0]))
 
-        elif req.form['cmd'][0] == 'manifest':
+        elif cmd == 'manifest':
             req.write(self.manifest(req.form['manifest'][0],
                                     clean(req.form['path'][0])))
 
-        elif req.form['cmd'][0] == 'tags':
+        elif cmd == 'tags':
             req.write(self.tags())
 
-        elif req.form['cmd'][0] == 'summary':
+        elif cmd == 'summary':
             req.write(self.summary())
 
-        elif req.form['cmd'][0] == 'filediff':
+        elif cmd == 'filediff':
             req.write(self.filediff(clean(req.form['file'][0]),
                                     req.form['node'][0]))
 
-        elif req.form['cmd'][0] == 'file':
+        elif cmd == 'file':
             req.write(self.filerevision(clean(req.form['file'][0]),
                                         req.form['filenode'][0]))
 
-        elif req.form['cmd'][0] == 'annotate':
+        elif cmd == 'annotate':
             req.write(self.fileannotate(clean(req.form['file'][0]),
                                         req.form['filenode'][0]))
 
-        elif req.form['cmd'][0] == 'filelog':
+        elif cmd == 'filelog':
             req.write(self.filelog(clean(req.form['file'][0]),
                                    req.form['filenode'][0]))
 
-        elif req.form['cmd'][0] == 'heads':
+        elif cmd == 'heads':
             req.httphdr("application/mercurial-0.1")
             h = self.repo.heads()
             req.write(" ".join(map(hex, h)) + "\n")
 
-        elif req.form['cmd'][0] == 'branches':
+        elif cmd == 'branches':
             req.httphdr("application/mercurial-0.1")
             nodes = []
             if req.form.has_key('nodes'):
@@ -831,7 +831,7 @@
             for b in self.repo.branches(nodes):
                 req.write(" ".join(map(hex, b)) + "\n")
 
-        elif req.form['cmd'][0] == 'between':
+        elif cmd == 'between':
             req.httphdr("application/mercurial-0.1")
             nodes = []
             if req.form.has_key('pairs'):
@@ -840,7 +840,7 @@
             for b in self.repo.between(pairs):
                 req.write(" ".join(map(hex, b)) + "\n")
 
-        elif req.form['cmd'][0] == 'changegroup':
+        elif cmd == 'changegroup':
             req.httphdr("application/mercurial-0.1")
             nodes = []
             if not self.allowpull:
@@ -859,7 +859,7 @@
 
             req.write(z.flush())
 
-        elif req.form['cmd'][0] == 'archive':
+        elif cmd == 'archive':
             changeset = self.repo.lookup(req.form['node'][0])
             type = req.form['type'][0]
             if (type in self.archives and
@@ -869,7 +869,7 @@
 
             req.write(self.t("error"))
 
-        elif req.form['cmd'][0] == 'static':
+        elif cmd == 'static':
             fname = req.form['file'][0]
             req.write(staticfile(static, fname)
                       or self.t("error", error="%r not found" % fname))