hgweb: globally default to tip if no revision is specified
authorBrendan Cully <brendan@kublai.com>
Wed, 11 Oct 2006 11:30:59 -0700
changeset 3333 8ec80c1b8f0b
parent 3332 a5209a1e53d8
child 3334 534806df5b5a
hgweb: globally default to tip if no revision is specified
mercurial/hgweb/hgweb_mod.py
--- a/mercurial/hgweb/hgweb_mod.py	Wed Oct 11 09:27:57 2006 -0700
+++ b/mercurial/hgweb/hgweb_mod.py	Wed Oct 11 11:30:59 2006 -0700
@@ -772,8 +772,11 @@
     def changectx(self, req):
         if req.form.has_key('node'):
             changeid = req.form['node'][0]
+        elif req.form.has_key('manifest'):
+            changeid = req.form['manifest'][0]
         else:
-            changeid = req.form['manifest'][0]
+            changeid = self.repo.changelog.count() - 1
+
         try:
             ctx = self.repo.changectx(changeid)
         except hg.RepoError:
@@ -848,8 +851,7 @@
         self.do_changelog(req, shortlog = True)
 
     def do_changeset(self, req):
-        ctx = self.repo.changectx(req.form['node'][0])
-        req.write(self.changeset(ctx))
+        req.write(self.changeset(self.changectx(req)))
 
     def do_manifest(self, req):
         req.write(self.manifest(self.changectx(req),