hgweb: show copy/rename links in file history
authorMatt Mackall <mpm@selenic.com>
Sun, 29 Jan 2006 17:10:38 +1300
changeset 1653 e8a3df8b62b3
parent 1652 f910437af806
child 1654 b7fc961507db
hgweb: show copy/rename links in file history
mercurial/hgweb.py
templates/fileannotate.tmpl
templates/filelogentry.tmpl
templates/filerevision.tmpl
templates/map
--- a/mercurial/hgweb.py	Sun Jan 29 00:31:11 2006 +0100
+++ b/mercurial/hgweb.py	Sun Jan 29 17:10:38 2006 +1300
@@ -222,6 +222,12 @@
         for s in siblings:
             yield dict(node=hex(s), rev=rev(s), **args)
 
+    def renamelink(self, fl, node):
+        r = fl.renamed(node)
+        if r:
+            return [dict(file=r[0], node=hex(r[1]))]
+        return []
+
     def showtag(self, t1, node=nullid, **args):
         for t in self.repo.nodetags(node):
              yield self.t(t1, tag=t, **args)
@@ -466,6 +472,7 @@
                              "node": hex(cn),
                              "author": cs[1],
                              "date": cs[2],
+                             "rename": self.renamelink(fl, n),
                              "parent": self.siblings(fl.parents(n),
                                                      fl.rev, file=f),
                              "child": self.siblings(fl.children(n),
@@ -514,6 +521,7 @@
                      date=cs[2],
                      parent=self.siblings(fl.parents(n), fl.rev, file=f),
                      child=self.siblings(fl.children(n), fl.rev, file=f),
+                     rename=self.renamelink(fl, n),
                      permissions=self.repo.manifest.readflags(mfn)[f])
 
     def fileannotate(self, f, node):
@@ -565,6 +573,7 @@
                      manifest=hex(mfn),
                      author=cs[1],
                      date=cs[2],
+                     rename=self.renamelink(fl, n),
                      parent=self.siblings(fl.parents(n), fl.rev, file=f),
                      child=self.siblings(fl.children(n), fl.rev, file=f),
                      permissions=self.repo.manifest.readflags(mfn)[f])
--- a/templates/fileannotate.tmpl	Sun Jan 29 00:31:11 2006 +0100
+++ b/templates/fileannotate.tmpl	Sun Jan 29 17:10:38 2006 +1300
@@ -18,6 +18,7 @@
 <tr>
  <td class="metatag">changeset #rev#:</td>
  <td><a href="?cs=#node|short#">#node|short#</a></td></tr>
+#rename%filerename#
 #parent%fileannotateparent#
 #child%fileannotatechild#
 <tr>
--- a/templates/filelogentry.tmpl	Sun Jan 29 00:31:11 2006 +0100
+++ b/templates/filelogentry.tmpl	Sun Jan 29 17:10:38 2006 +1300
@@ -8,6 +8,7 @@
 <a href="?fd=#node|short#;file=#file|urlescape#">(diff)</a>
 <a href="?fa=#filenode|short#;file=#file|urlescape#">(annotate)</a>
 </td></tr>
+#rename%filelogrename#
 <tr>
  <td align="right">author:&nbsp;</td>
  <td>#author|obfuscate#</td></tr>
--- a/templates/filerevision.tmpl	Sun Jan 29 00:31:11 2006 +0100
+++ b/templates/filerevision.tmpl	Sun Jan 29 17:10:38 2006 +1300
@@ -19,6 +19,7 @@
 <tr>
  <td class="metatag">changeset #rev#:</td>
  <td><a href="?cs=#node|short#">#node|short#</a></td></tr>
+#rename%filerename#
 #parent%filerevparent#
 #child%filerevchild#
 <tr>
--- a/templates/map	Sun Jan 29 00:31:11 2006 +0100
+++ b/templates/map	Sun Jan 29 17:10:38 2006 +1300
@@ -27,6 +27,8 @@
 changelogparent = "<tr><th class="parent">parent #rev#:</th><td class="parent"><a href="?cs=#node|short#">#node|short#</a></td></tr>"
 changesetparent = "<tr><th class="parent">parent #rev#:</th><td class="parent"><a href="?cs=#node|short#">#node|short#</a></td></tr>"
 filerevparent = "<tr><td class="metatag">parent:</td><td><a href="?f=#node|short#;file=#file|urlescape#">#node|short#</a></td></tr>"
+filerename = "<tr><td class="metatag">parent:</td><td><a href="?f=#node|short#;file=#file|urlescape#">#file|escape#@#node|short#</a></td></tr>"
+filelogrename = "<tr><td align="right">base:&nbsp;</td><td><a href="?f=#node|short#;file=#file|urlescape#">#file|escape#@#node|short#</a></td></tr>"
 fileannotateparent = "<tr><td class="metatag">parent:</td><td><a href="?fa=#filenode|short#;file=#file|urlescape#">#node|short#</a></td></tr>"
 changesetchild = "<tr><th class="child">child #rev#:</th><td class="child"><a href="?cs=#node|short#">#node|short#</a></td></tr>"
 changelogchild = "<tr><th class="child">child #rev#:</th><td class="child"><a href="?cs=#node|short#">#node|short#</a></td></tr>"