hgwebdir: do not show RSS and Atom links for plain directories
authorAngel Ezquerra <angel.ezquerra@gmail.com>
Tue, 27 Nov 2012 22:24:02 +0100
changeset 18046 40374059d227
parent 18045 add2f9ddcfb5
child 18047 9196638b08ce
hgwebdir: do not show RSS and Atom links for plain directories Up until now the templates that show RSS and Atom feeds on the "repository lists" (i.e. gitweb and monoblue) showed them for all entries, including regular folders. Clicking on those "folder RSS" links would result in an error page being shown. This patch hides those links for regular folders.
mercurial/hgweb/hgwebdir_mod.py
mercurial/templates/gitweb/map
mercurial/templates/monoblue/map
--- a/mercurial/hgweb/hgwebdir_mod.py	Tue Dec 04 00:37:50 2012 +0100
+++ b/mercurial/hgweb/hgwebdir_mod.py	Tue Nov 27 22:24:02 2012 +0100
@@ -304,7 +304,8 @@
                                description_sort="",
                                lastchange=d,
                                lastchange_sort=d[1]-d[0],
-                               archives=[])
+                               archives=[],
+                               isdirectory=True)
 
                     seendirs.add(name)
                     yield row
--- a/mercurial/templates/gitweb/map	Tue Dec 04 00:37:50 2012 +0100
+++ b/mercurial/templates/gitweb/map	Tue Nov 27 22:24:02 2012 +0100
@@ -294,7 +294,12 @@
     <td>{contact|obfuscate}</td>
     <td class="age">{lastchange|rfc822date}</td>
     <td class="indexlinks">{archives%indexarchiveentry}</td>
-    <td><div class="rss_logo"><a href="{url}rss-log">RSS</a> <a href="{url}atom-log">Atom</a></div></td>
+    <td>{if(isdirectory, '',
+            '<div class="rss_logo">
+                <a href="{url}rss-log">RSS</a> <a href="{url}atom-log">Atom</a>
+            </div>'
+            )}
+    </td>
   </tr>\n'
 indexarchiveentry = ' <a href="{url}archive/{node|short}{extension}">{type|escape}</a> '
 index = index.tmpl
--- a/mercurial/templates/monoblue/map	Tue Dec 04 00:37:50 2012 +0100
+++ b/mercurial/templates/monoblue/map	Tue Nov 27 22:24:02 2012 +0100
@@ -247,10 +247,11 @@
     <td class="age">{lastchange|rfc822date}</td>
     <td class="indexlinks">{archives%indexarchiveentry}</td>
     <td>
-      <div class="rss_logo">
-        <a href="{url}rss-log">RSS</a>
-        <a href="{url}atom-log">Atom</a>
-      </div>
+        {if(isdirectory, '',
+            '<div class="rss_logo">
+                <a href="{url}rss-log">RSS</a> <a href="{url}atom-log">Atom</a>
+            </div>'
+            )}
     </td>
   </tr>\n'
 indexarchiveentry = '<a href="{url}archive/{node|short}{extension}">{type|escape}</a> '