hgweb: minor improvements for new web style
authorMatt Mackall <mpm@selenic.com>
Mon, 31 Mar 2008 21:49:33 -0500
changeset 6434 62e0bb41e682
parent 6433 ec5d77eb3431
child 6435 050e9da0df78
hgweb: minor improvements for new web style - make renamelink take a context - pass current node to shortlog page rather than tip - pass user/desc/date/rename to filediff - improve template error reporting for foo%bar
mercurial/hgweb/webcommands.py
mercurial/hgweb/webutil.py
mercurial/templater.py
--- a/mercurial/hgweb/webcommands.py	Mon Mar 31 21:49:32 2008 -0500
+++ b/mercurial/hgweb/webcommands.py	Mon Mar 31 21:49:33 2008 -0500
@@ -85,7 +85,7 @@
                 branch=webutil.nodebranchnodefault(fctx),
                 parent=webutil.siblings(fctx.parents()),
                 child=webutil.siblings(fctx.children()),
-                rename=webutil.renamelink(fl, n),
+                rename=webutil.renamelink(fctx),
                 permissions=fctx.manifest().flags(f))
 
 def file(web, req, tmpl):
@@ -215,7 +215,7 @@
 
     return tmpl(shortlog and 'shortlog' or 'changelog',
                 changenav=changenav,
-                node=hex(cl.tip()),
+                node=hex(ctx.node()),
                 rev=pos, changesets=count,
                 entries=lambda **x: changelist(limit=0,**x),
                 latestentry=lambda **x: changelist(limit=1,**x),
@@ -435,6 +435,10 @@
                 file=path,
                 node=hex(n),
                 rev=fctx.rev(),
+                date=fctx.date(),
+                desc=fctx.description(),
+                author=fctx.user(),
+                rename=self.renamelink(fctx),
                 branch=webutil.nodebranchnodefault(fctx),
                 parent=webutil.siblings(parents),
                 child=webutil.siblings(fctx.children()),
@@ -484,7 +488,7 @@
                 author=fctx.user(),
                 date=fctx.date(),
                 desc=fctx.description(),
-                rename=webutil.renamelink(fl, n),
+                rename=webutil.renamelink(fctx),
                 branch=webutil.nodebranchnodefault(fctx),
                 parent=webutil.siblings(fctx.parents()),
                 child=webutil.siblings(fctx.children()),
@@ -515,7 +519,7 @@
                          "node": hex(ctx.node()),
                          "author": ctx.user(),
                          "date": ctx.date(),
-                         "rename": webutil.renamelink(fl, n),
+                         "rename": webutil.renamelink(fctx),
                          "parent": webutil.siblings(fctx.parents()),
                          "child": webutil.siblings(fctx.children()),
                          "desc": ctx.description()})
--- a/mercurial/hgweb/webutil.py	Mon Mar 31 21:49:32 2008 -0500
+++ b/mercurial/hgweb/webutil.py	Mon Mar 31 21:49:33 2008 -0500
@@ -70,8 +70,8 @@
         d.update(args)
         yield d
 
-def renamelink(fl, node):
-    r = fl.renamed(node)
+def renamelink(fctx):
+    r = fctx.renamed(node)
     if r:
         return [dict(file=r[0], node=hex(r[1]))]
     return []
--- a/mercurial/templater.py	Mon Mar 31 21:49:32 2008 -0500
+++ b/mercurial/templater.py	Mon Mar 31 21:49:33 2008 -0500
@@ -114,7 +114,7 @@
                 v = v(**map)
             if format:
                 if not hasattr(v, '__iter__'):
-                    raise SyntaxError(_("Error expanding '%s%s'")
+                    raise SyntaxError(_("Error expanding '%s%%%s'")
                                       % (key, format))
                 lm = map.copy()
                 for i in v: