Permit to hgweb to show tags and the parent changeset numbers

Goffredo Baroncelli kreijack at libero.it
Fri Jul 1 14:17:15 CDT 2005


Hi, the patch below permits to hgweb to show tags and the parent changeset numbers in
the changelog/changeset page.

Does anyone know if I should also update the changeset-raw.tmpl page ? I think yes,
but I not sure if anyone uses this page in any script which can be confused by a different
output.

Goffredo


diff -r bf9d55ed67f6 TODO
--- a/TODO Fri Jul  1 17:04:50 2005
+++ b/TODO Fri Jul  1 21:10:06 2005
@@ -30,8 +30,6 @@
 - optionally only show merges (two parents or parent != changeset-1, etc.)
 
 Web:
-- show tags in hgweb
-- show parent changeset number in hgweb
 - optionally only show merges (two parents or parent != changeset-1, etc.)
 - one hgweb with many repos (another script)
 - hgweb tip link too verbose
diff -r bf9d55ed67f6 mercurial/hgweb.py
--- a/mercurial/hgweb.py Fri Jul  1 17:04:50 2005
+++ b/mercurial/hgweb.py Fri Jul  1 21:10:06 2005
@@ -118,6 +118,7 @@
         self.path = path
         self.mtime = -1
         self.viewonly = 0
+        self.tagscache = {}
 
         self.filters = {
             "escape": cgi.escape,
@@ -154,6 +155,14 @@
     def parent(self, t1, node=nullid, rev=-1, **args):
         if node != hex(nullid):
             yield self.t(t1, node = node, rev = rev, **args)
+
+    def showtag(self, t1, node=nullid, **args):
+        if not self.tagscache:
+            for (t,n) in self.repo.tagslist():
+                self.tagscache[n]=t
+                
+        if node in self.tagscache.keys( ):
+            yield self.t(t1, tag = self.tagscache[node], **args)
 
     def diff(self, node1, node2, files):
         def filterfiles(list, files):
@@ -259,6 +268,7 @@
                                           hex(p1), cl.rev(p1)),
                     parent2 = self.parent("changelogparent",
                                           hex(p2), cl.rev(p2)),
+                    changelogtag=self.showtag("changelogtag",n),
                     p1 = hex(p1), p2 = hex(p2),
                     p1rev = cl.rev(p1), p2rev = cl.rev(p2),
                     manifest = hex(changes[0]),
@@ -326,6 +336,7 @@
                                           hex(p1), cl.rev(p1)),
                     parent2 = self.parent("changelogparent",
                                           hex(p2), cl.rev(p2)),
+                    changelogtag=self.showtag("changelogtag",n),
                     p1 = hex(p1), p2 = hex(p2),
                     p1rev = cl.rev(p1), p2rev = cl.rev(p2),
                     manifest = hex(changes[0]),
@@ -376,6 +387,7 @@
                                            hex(p1), cl.rev(p1)),
                      parent2 = self.parent("changesetparent",
                                            hex(p2), cl.rev(p2)),
+                     changesettag=self.showtag("changesettag",n),
                      p1 = hex(p1), p2 = hex(p2),
                      p1rev = cl.rev(p1), p2rev = cl.rev(p2),
                      manifest = hex(changes[0]),
diff -r bf9d55ed67f6 templates/changelogentry.tmpl
--- a/templates/changelogentry.tmpl Fri Jul  1 17:04:50 2005
+++ b/templates/changelogentry.tmpl Fri Jul  1 21:10:06 2005
@@ -8,6 +8,7 @@
  <td><a href="?cmd=changeset;node=#node#">#node|short#</a></td></tr>
 #parent1#
 #parent2#
+#changelogtag#
 <tr>
  <td align="right">author:&nbsp;</td>
  <td>#author|obfuscate#</td></tr>
diff -r bf9d55ed67f6 templates/changeset.tmpl
--- a/templates/changeset.tmpl Fri Jul  1 17:04:50 2005
+++ b/templates/changeset.tmpl Fri Jul  1 21:10:06 2005
@@ -18,6 +18,7 @@
  <td><a href="?cmd=changeset;node=#node#">#node|short#</a></td></tr>
 #parent1#
 #parent2#
+#changesettag#
 <tr>
  <td class="metatag">manifest:</td>
  <td><a href="?cmd=manifest;manifest=#manifest#;path=/">#manifest|short#</a></td></tr>
diff -r bf9d55ed67f6 templates/map
--- a/templates/map Fri Jul  1 17:04:50 2005
+++ b/templates/map Fri Jul  1 21:10:06 2005
@@ -23,10 +23,12 @@
 difflineminus = "<span class="minusline">#line|escape#</span>"
 difflineat = "<span class="atline">#line|escape#</span>"
 diffline = "#line|escape#"
-changelogparent = "<tr><td align="right">parent:&nbsp;</td><td><a href="?cmd=changeset;node=#node#">#node|short#</a></td></tr>"
-changesetparent = "<tr><td class="metatag">parent:</td><td><a href="?cmd=changeset;node=#node#">#node|short#</a></td></tr>"
+changelogparent = "<tr><td align="right">parent #rev#:&nbsp;</td><td><a href="?cmd=changeset;node=#node#">#node|short#</a></td></tr>"
+changesetparent = "<tr><td class="metatag">parent #rev#:</td><td><a href="?cmd=changeset;node=#node#">#node|short#</a></td></tr>"
 filerevparent = "<tr><td class="metatag">parent:</td><td><a href="?cmd=file;file=#file#;filenode=#node#">#node|short#</a></td></tr>"
 fileannotateparent = "<tr><td class="metatag">parent:</td><td><a href="?cmd=annotate;file=#file#;filenode=#node#">#node|short#</a></td></tr>"
 tags = tags.tmpl
 tagentry = "<div class="parity#parity#"><tt>#node#</tt> <a href="?cmd=changeset;node=#node#">#tag#</a><br /></div>"
 diffblock = "<div class="parity#parity#">#lines#</div>"
+changelogtag = "<tr><td align="right">tag:&nbsp;</td><td>#tag#</td></tr>"
+changesettag = "<tr><td class="metatag">tag:&nbsp;</td><td>#tag#</td></tr>"
\ No newline at end of file
diff -r bf9d55ed67f6 templates/searchentry.tmpl
--- a/templates/searchentry.tmpl Fri Jul  1 17:04:50 2005
+++ b/templates/searchentry.tmpl Fri Jul  1 21:10:06 2005
@@ -8,6 +8,7 @@
  <td><a href="?cmd=changeset;node=#node#">#node|short#</a></td></tr>
 #parent1#
 #parent2#
+#changelogtag#
 <tr>
  <td align="right">author:&nbsp;</td>
  <td>#author|obfuscate#</td></tr>


-- 
gpg key@ keyserver.linux.it: Goffredo Baroncelli (ghigo) <kreijack AT inwind DOT it>
Key fingerprint = CE3C 7E01 6782 30A3 5B87  87C0 BB86 505C 6B2A CFF9


More information about the Mercurial mailing list