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

login
register
mail settings
Submitter Angel Ezquerra
Date Dec. 4, 2012, 10:50 p.m.
Message ID <26303ce529e72c952f7b.1354661405@Lucia-PC>
Download mbox | patch
Permalink /patch/19/
State Superseded
Commit add2f9ddcfb5e7b462a562b98453f3ffbeefd149
Headers show

Comments

Angel Ezquerra - Dec. 4, 2012, 10:50 p.m.
# 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).
Angel Ezquerra - Dec. 4, 2012, 10:54 p.m.
On Tue, Dec 4, 2012 at 11:50 PM, Angel Ezquerra
<angel.ezquerra at gmail.com> wrote:
> # 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).

The previous version did not include the new atom and rss branch and
branchentries templates.
Also this version has a working atom feed (as well as the already
working rss feed).

The one remaining issue is that in order to make the branches atom
feed work I had to remove the "{latestentry%feedupdated}" line, which
I don't know is correct. The same problem happens with the atom tags
feed, which also does not work (for me) unless you remove that line
from atom/branch.tmpl.

Comments welcome,

Angel

Patch

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