[PATCH] hgwebdir: do not show RSS and Atom links for plain directories

Angel Ezquerra angel.ezquerra at gmail.com
Wed Jul 25 17:16:58 CDT 2012


# HG changeset patch
# User Angel Ezquerra <angel.ezquerra at gmail.com>
# Date 1343254355 -7200
# Branch stable
# Node ID dd7906475a607fc720b5716ef9b685e62f921693
# Parent  bf5bb38bcc7c28f7a355fdfff323aba2018cbb17
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.

diff --git a/mercurial/hgweb/hgwebdir_mod.py b/mercurial/hgweb/hgwebdir_mod.py
--- a/mercurial/hgweb/hgwebdir_mod.py
+++ b/mercurial/hgweb/hgwebdir_mod.py
@@ -302,7 +302,8 @@
                                description_sort="",
                                lastchange=d,
                                lastchange_sort=d[1]-d[0],
-                               archives=[])
+                               archives=[],
+                               rss_visibility="hidden")
 
                     seendirs.add(name)
                     yield row
@@ -349,7 +350,8 @@
                            description_sort=description.upper() or "unknown",
                            lastchange=d,
                            lastchange_sort=d[1]-d[0],
-                           archives=archivelist(u, "tip", url))
+                           archives=archivelist(u, "tip", url),
+                           rss_visibility="visible")
 
                 seenrepos.add(name)
                 yield row
diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/map
--- a/mercurial/templates/gitweb/map
+++ b/mercurial/templates/gitweb/map
@@ -304,7 +304,7 @@
     <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><div class="rss_logo" style="visibility:{rss_visibility}"><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
diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/monoblue/map
--- a/mercurial/templates/monoblue/map
+++ b/mercurial/templates/monoblue/map
@@ -257,7 +257,7 @@
     <td class="age">{lastchange|rfc822date}</td>
     <td class="indexlinks">{archives%indexarchiveentry}</td>
     <td>
-      <div class="rss_logo">
+      <div class="rss_logo" style="visibility:{rss_visibility}">
         <a href="{url}rss-log">RSS</a>
         <a href="{url}atom-log">Atom</a>
       </div>


More information about the Mercurial-devel mailing list