[PATCH V2] hgweb: add branches RSS and Atom feeds

Angel Ezquerra angel.ezquerra at gmail.com
Tue Dec 4 16:50:05 CST 2012


# HG changeset patch
# User Angel Ezquerra <angel.ezquerra at gmail.com>
# Date 1354577870 -3600
# Node ID 26303ce529e72c952f7b1a7a6410cc4b273e3a8b
# Parent  9b05b31b413c55d750ca8be41330ff65fa9ed8c1
hgweb: add branches RSS and Atom feeds

There were no RSS nor Atom feeds for the branches page. Different hgweb
templates linked to different feeds on their branches page (some linked to the
tags feed, some to the log feed and some to the unexisting branches feed).

Note that in order to make the new branches Atom feed work I had to remove the
"{latestentry%feedupdated}" line which is found on all other Atom feed
templates. Actually I believe that the atom/tags.tmpl does not work either, and
it is for the same reason (i.e. the "{latestentry%feedupdated}" line makes it
fail).

diff --git a/mercurial/templates/atom/branchentry.tmpl b/mercurial/templates/atom/branchentry.tmpl
new file mode 100644
--- /dev/null
+++ b/mercurial/templates/atom/branchentry.tmpl
@@ -0,0 +1,8 @@
+ <entry>
+  <title>{branch|escape}</title>
+  <link rel="alternate" href="{urlbase}{url}rev/{node|short}"/>
+  <id>{urlbase}{url}#branch-{node}</id>
+  <updated>{date|rfc3339date}</updated>
+  <published>{date|rfc3339date}</published>
+  <content type="text"><![CDATA[{branch|strip|escape|addbreaks}]]></content>
+ </entry>
diff --git a/mercurial/templates/atom/branches.tmpl b/mercurial/templates/atom/branches.tmpl
new file mode 100644
--- /dev/null
+++ b/mercurial/templates/atom/branches.tmpl
@@ -0,0 +1,10 @@
+{header}
+ <id>{urlbase}{url}</id>
+ <link rel="self" href="{urlbase}{url}atom-tags"/>
+ <link rel="alternate" href="{urlbase}{url}tags"/>
+ <title>{repo|escape}: branches</title>
+ <summary>{repo|escape} branch history</summary>
+ <author><name>Mercurial SCM</name></author>
+
+{entries%branchentry}
+</feed>
diff --git a/mercurial/templates/atom/map b/mercurial/templates/atom/map
--- a/mercurial/templates/atom/map
+++ b/mercurial/templates/atom/map
@@ -10,4 +10,6 @@
 tagentry = tagentry.tmpl
 bookmarks = bookmarks.tmpl
 bookmarkentry = bookmarkentry.tmpl
+branches = branches.tmpl
+branchentry = branchentry.tmpl
 error = error.tmpl
diff --git a/mercurial/templates/gitweb/branches.tmpl b/mercurial/templates/gitweb/branches.tmpl
--- a/mercurial/templates/gitweb/branches.tmpl
+++ b/mercurial/templates/gitweb/branches.tmpl
@@ -1,9 +1,9 @@
 {header}
 <title>{repo|escape}: Branches</title>
 <link rel="alternate" type="application/atom+xml"
-   href="{url}atom-tags" title="Atom feed for {repo|escape}"/>
+   href="{url}atom-branches" title="Atom feed for {repo|escape}"/>
 <link rel="alternate" type="application/rss+xml"
-   href="{url}rss-tags" title="RSS feed for {repo|escape}"/>
+   href="{url}rss-branches" title="RSS feed for {repo|escape}"/>
 </head>
 <body>
 
diff --git a/mercurial/templates/monoblue/branches.tmpl b/mercurial/templates/monoblue/branches.tmpl
--- a/mercurial/templates/monoblue/branches.tmpl
+++ b/mercurial/templates/monoblue/branches.tmpl
@@ -1,7 +1,7 @@
 {header}
     <title>{repo|escape}: Branches</title>
-    <link rel="alternate" type="application/atom+xml" href="{url}atom-log" title="Atom feed for {repo|escape}"/>
-    <link rel="alternate" type="application/rss+xml" href="{url}rss-log" title="RSS feed for {repo|escape}"/>
+    <link rel="alternate" type="application/atom+xml" href="{url}atom-branches" title="Atom feed for {repo|escape}"/>
+    <link rel="alternate" type="application/rss+xml" href="{url}rss-branches" title="RSS feed for {repo|escape}"/>
 </head>
 
 <body>
diff --git a/mercurial/templates/paper/branches.tmpl b/mercurial/templates/paper/branches.tmpl
--- a/mercurial/templates/paper/branches.tmpl
+++ b/mercurial/templates/paper/branches.tmpl
@@ -1,9 +1,9 @@
 {header}
 <title>{repo|escape}: branches</title>
 <link rel="alternate" type="application/atom+xml"
-   href="{url}atom-tags" title="Atom feed for {repo|escape}: branches" />
+   href="{url}atom-branches" title="Atom feed for {repo|escape}: branches" />
 <link rel="alternate" type="application/rss+xml"
-   href="{url}rss-tags" title="RSS feed for {repo|escape}: branches" />
+   href="{url}rss-branches" title="RSS feed for {repo|escape}: branches" />
 </head>
 <body>
 
diff --git a/mercurial/templates/rss/branchentry.tmpl b/mercurial/templates/rss/branchentry.tmpl
new file mode 100644
--- /dev/null
+++ b/mercurial/templates/rss/branchentry.tmpl
@@ -0,0 +1,6 @@
+<item>
+    <title>{branch|escape}</title>
+    <link>{urlbase}{url}rev/{node|short}</link>
+    <description><![CDATA[{branch|strip|escape|addbreaks}]]></description>
+    <pubDate>{date|rfc822date}</pubDate>
+</item>
diff --git a/mercurial/templates/rss/branches.tmpl b/mercurial/templates/rss/branches.tmpl
new file mode 100644
--- /dev/null
+++ b/mercurial/templates/rss/branches.tmpl
@@ -0,0 +1,6 @@
+{header}
+    <title>{repo|escape}: branches</title>
+    <description>{repo|escape} branch history</description>
+    {entries%branchentry}
+  </channel>
+</rss>
diff --git a/mercurial/templates/rss/map b/mercurial/templates/rss/map
--- a/mercurial/templates/rss/map
+++ b/mercurial/templates/rss/map
@@ -9,4 +9,6 @@
 tagentry = tagentry.tmpl
 bookmarks = bookmarks.tmpl
 bookmarkentry = bookmarkentry.tmpl
+branches = branches.tmpl
+branchentry = branchentry.tmpl
 error = error.tmpl


More information about the Mercurial-devel mailing list