web: use the correct filectx in filelog
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Fri, 09 Jan 2009 17:34:06 +0100
changeset 7612 069b29656401
parent 7569 89207edf3973
child 7613 bcbe8446bf2b
child 7617 7b554c6ad390
web: use the correct filectx in filelog
mercurial/hgweb/webcommands.py
tests/test-hgweb-filelog
tests/test-hgweb-filelog.out
--- a/mercurial/hgweb/webcommands.py	Wed Jan 07 02:11:17 2009 +0100
+++ b/mercurial/hgweb/webcommands.py	Fri Jan 09 17:34:06 2009 +0100
@@ -545,23 +545,24 @@
     def entries(limit=0, **map):
         l = []
 
+        repo = web.repo
         for i in xrange(start, end):
-            ctx = fctx.filectx(i)
+            iterfctx = fctx.filectx(i)
 
             l.insert(0, {"parity": parity.next(),
                          "filerev": i,
                          "file": f,
-                         "node": hex(ctx.node()),
-                         "author": ctx.user(),
-                         "date": ctx.date(),
-                         "rename": webutil.renamelink(fctx),
-                         "parent": webutil.siblings(fctx.parents()),
-                         "child": webutil.siblings(fctx.children()),
-                         "desc": ctx.description(),
-                         "tags": webutil.nodetagsdict(web.repo, ctx.node()),
-                         "branch": webutil.nodebranchnodefault(ctx),
-                         "inbranch": webutil.nodeinbranch(web.repo, ctx),
-                         "branches": webutil.nodebranchdict(web.repo, ctx)})
+                         "node": hex(iterfctx.node()),
+                         "author": iterfctx.user(),
+                         "date": iterfctx.date(),
+                         "rename": webutil.renamelink(iterfctx),
+                         "parent": webutil.siblings(iterfctx.parents()),
+                         "child": webutil.siblings(iterfctx.children()),
+                         "desc": iterfctx.description(),
+                         "tags": webutil.nodetagsdict(repo, iterfctx.node()),
+                         "branch": webutil.nodebranchnodefault(iterfctx),
+                         "inbranch": webutil.nodeinbranch(repo, iterfctx),
+                         "branches": webutil.nodebranchdict(repo, iterfctx)})
 
         if limit > 0:
             l = l[:limit]
--- a/tests/test-hgweb-filelog	Wed Jan 07 02:11:17 2009 +0100
+++ b/tests/test-hgweb-filelog	Fri Jan 09 17:34:06 2009 +0100
@@ -16,6 +16,9 @@
 hg rm a
 hg ci -m "del2 a"
 
+hg mv b c
+hg ci -m "mv b"
+
 hg log -p
 
 hg serve -n test -p $HGPORT -d --pid-file=hg.pid -E errors.log
@@ -36,5 +39,8 @@
 echo % before addition - error
 ("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/log/0/a')
 
+echo % should show base link, use spartan because it shows it
+("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/log/tip/c?style=spartan')
+
 echo % errors
 cat errors.log
--- a/tests/test-hgweb-filelog.out	Wed Jan 07 02:11:17 2009 +0100
+++ b/tests/test-hgweb-filelog.out	Fri Jan 09 17:34:06 2009 +0100
@@ -1,8 +1,24 @@
 adding b
 adding a
 adding a
+changeset:   5:a3b6a9e4507e
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     mv b
+
+diff -r 52e848cdcd88 -r a3b6a9e4507e b
+--- a/b	Thu Jan 01 00:00:00 1970 +0000
++++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
+@@ -1,1 +0,0 @@
+-b
+diff -r 52e848cdcd88 -r a3b6a9e4507e c
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ b/c	Thu Jan 01 00:00:00 1970 +0000
+@@ -0,0 +1,1 @@
++b
+
 changeset:   4:52e848cdcd88
-tag:         tip
 user:        test
 date:        Thu Jan 01 00:00:00 1970 +0000
 summary:     del2 a
@@ -435,4 +451,73 @@
 </body>
 </html>
 
+% should show base link, use spartan because it shows it
+200 Script output follows
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<link rel="icon" href="/static/hgicon.png" type="image/png">
+<meta name="robots" content="index, nofollow" />
+<link rel="stylesheet" href="/static/style.css" type="text/css" />
+
+<title>test: c history</title>
+<link rel="alternate" type="application/atom+xml"
+   href="/atom-log/tip/c" title="Atom feed for test:c">
+<link rel="alternate" type="application/rss+xml"
+   href="/rss-log/tip/c" title="RSS feed for test:c">
+</head>
+<body>
+
+<div class="buttons">
+<a href="/log?style=spartan">changelog</a>
+<a href="/shortlog?style=spartan">shortlog</a>
+<a href="/graph?style=spartan">graph</a>
+<a href="/tags?style=spartan">tags</a>
+<a href="/file/a3b6a9e4507e/c?style=spartan">file</a>
+<a href="/annotate/a3b6a9e4507e/c?style=spartan">annotate</a>
+<a type="application/rss+xml" href="/rss-log/tip/c">rss</a>
+<a type="application/atom+xml" href="/atom-log/tip/c" title="Atom feed for test:c">atom</a>
+</div>
+
+<h2>c revision history</h2>
+
+<p>navigate: <small class="navigate"><a href="/log/a3b6a9e4507e/c?style=spartan">(0)</a> <a href="/log/tip/c?style=spartan">tip</a> </small></p>
+
+<table class="logEntry parity0">
+ <tr>
+  <th class="age">many years ago:</th>
+  <th class="firstline"><a href="/rev/a3b6a9e4507e?style=spartan">mv b</a></th>
+ </tr>
+ <tr>
+  <th class="revision">revision 0:</td>
+  <td class="node">
+   <a href="/file/a3b6a9e4507e/c?style=spartan">a3b6a9e4507e</a>
+   <a href="/diff/a3b6a9e4507e/c?style=spartan">(diff)</a>
+   <a href="/annotate/a3b6a9e4507e/c?style=spartan">(annotate)</a>
+  </td>
+ </tr>
+ <tr><th>base:</th><td><a href="/file/1e88685f5dde/b?style=spartan">b@1e88685f5dde</a></td></tr>
+ <tr>
+  <th class="author">author:</th>
+  <td class="author">&#116;&#101;&#115;&#116;</td>
+ </tr>
+ <tr>
+  <th class="date">date:</th>
+  <td class="date">Thu Jan 01 00:00:00 1970 +0000</td>
+ </tr>
+</table>
+
+
+
+
+
+<div class="logo">
+<a href="http://www.selenic.com/mercurial/">
+<img src="/static/hglogo.png" width=75 height=90 border=0 alt="mercurial"></a>
+</div>
+
+</body>
+</html>
+
 % errors