Patchwork hgweb: adding branch, tags, bookmarks, and file list to atom feed entries

login
register
mail settings
Submitter Jensen, Aaron
Date April 2, 2014, 6:24 p.m.
Message ID <19C008641EA0254BA2D9501B558E4A583B56F655@EXMBX01L-CRP-04.webmdhealth.net>
Download mbox | patch
Permalink /patch/4199/
State Deferred
Headers show

Comments

Jensen, Aaron - April 2, 2014, 6:24 p.m.
# HG changeset patch
# User Aaron Jensen <ajensen@webmd.net>
# Date 1396462874 25200
# Node ID fb60bf22603300dad05867dc27e67171fbaface8
# Parent  9e9e3a4e9261d31318f0f177538636370c50fe57
hgweb: adding branch, tags, bookmarks, and file list to atom feed entries
Matt Mackall - April 11, 2014, 10:23 p.m.
On Wed, 2014-04-02 at 18:24 +0000, Jensen, Aaron wrote:
> # HG changeset patch
> # User Aaron Jensen <ajensen@webmd.net>
> # Date 1396462874 25200
> # Node ID fb60bf22603300dad05867dc27e67171fbaface8
> # Parent  9e9e3a4e9261d31318f0f177538636370c50fe57
> hgweb: adding branch, tags, bookmarks, and file list to atom feed entries

This seems pretty reasonable.

One big question: how sure can we be that no one relies on the old
format?

Also, it seems the omission of author is pretty glaring. I know it's
part of the Atom schema already, but I think lots of reader agents
neglect it.
Jensen, Aaron - April 15, 2014, 5:24 p.m.
> One big question: how sure can we be that no one relies on the old format?

In reality, we can't. Since the content section of atom is xhtml, it would be parseable by XML readers (for RSS, the content is HTML wrapped in a CDATA section, but there is nothing stopping someone from cracking it open and parsing it out), so there is a chance someone somewhere is grabbing feed XML, parsing it, and doing something with it. 

In practice, practice, though, I doubt anyone is doing this. The only useful information published in either RSS/Atom feeds was author and description. I don't think this was enough information to make it worth anyone's time to parse out. There are much better ways (hg log) of getting history from a repository. I wouldn't consider the output from an RSS/Atom feed an API that people can/should code against.


> Also, it seems the omission of author is pretty glaring. I know it's part of the Atom schema already, but I think lots of reader 
> agents neglect it.

I use Feedbin as my Atom/RSS reader, and it seems to correctly display author information. Our repositories are internal, so developers that subscribe have to use an internal Atom/RSS reader, which is always Outlook.  It, too, shows author information from the feed. So, there's a sample of two from a pool of infinity.

Of course, adding it into the content wouldn't be hard at all. Should I make that change a submit an updated patch?
Matt Mackall - April 15, 2014, 9:56 p.m.
On Tue, 2014-04-15 at 17:24 +0000, Jensen, Aaron wrote:
> > One big question: how sure can we be that no one relies on the old format?
> 
> In reality, we can't. Since the content section of atom is xhtml, it would be parseable by XML readers (for RSS, the content is HTML wrapped in a CDATA section, but there is nothing stopping someone from cracking it open and parsing it out), so there is a chance someone somewhere is grabbing feed XML, parsing it, and doing something with it. 
> 
> In practice, practice, though, I doubt anyone is doing this. The only useful information published in either RSS/Atom feeds was author and description. I don't think this was enough information to make it worth anyone's time to parse out. There are much better ways (hg log) of getting history from a repository. I wouldn't consider the output from an RSS/Atom feed an API that people can/should code against.
> 
> 
> > Also, it seems the omission of author is pretty glaring. I know it's part of the Atom schema already, but I think lots of reader 
> > agents neglect it.
> 
> I use Feedbin as my Atom/RSS reader, and it seems to correctly display author information. Our repositories are internal, so developers that subscribe have to use an internal Atom/RSS reader, which is always Outlook.  It, too, shows author information from the feed. So, there's a sample of two from a pool of infinity.
> 
> Of course, adding it into the content wouldn't be hard at all. Should I make that change a submit an updated patch?

Please do.

Patch

diff -r 9e9e3a4e9261 -r fb60bf226033 mercurial/templates/atom/changelogentry.tmpl
--- a/mercurial/templates/atom/changelogentry.tmpl	Thu Mar 20 01:24:45 2014 -0700
+++ b/mercurial/templates/atom/changelogentry.tmpl	Wed Apr 02 11:21:14 2014 -0700
@@ -1,5 +1,5 @@ 
  <entry>
-  <title>{desc|strip|firstline|strip|escape|nonempty}</title>
+  <title>{branches%"{if(name, '[{name|escape}] ')}"}{desc|strip|firstline|strip|escape|nonempty}</title>
   <id>{urlbase}{url|urlescape}#changeset-{node}</id>
   <link href="{urlbase}{url|urlescape}rev/{node|short}"/>
   <author>
@@ -9,8 +9,31 @@ 
   <updated>{date|rfc3339date}</updated>
   <published>{date|rfc3339date}</published>
   <content type="xhtml">
-   <div xmlns="http://www.w3.org/1999/xhtml">
-    <pre xml:space="preserve">{desc|escape|nonempty}</pre>
-   </div>
+	<table xmlns="http://www.w3.org/1999/xhtml">
+	<tr>
+		<th style="text-align:left;">changeset</th>
+		<td>{node|short}</td>
+	</tr>
+	<tr>
+		<th style="text-align:left;">branch</th>
+		<td>{branches%"{name|escape}"}</td>
+	</tr>
+	<tr>
+		<th style="text-align:left;">bookmark</th>
+		<td>{bookmarks%"{name|escape}"}</td>
+	</tr>
+	<tr>
+		<th style="text-align:left;">tag</th>
+		<td>{tags%"{name|escape}"}</td>
+	</tr>
+	<tr>
+		<th style="text-align:left;vertical-align:top;">description</th>
+		<td>{desc|strip|escape|addbreaks|nonempty}</td>
+	</tr>
+	<tr>
+		<th style="text-align:left;vertical-align:top;">files</th>
+		<td>{files}</td>
+	</tr>
+	</table>
   </content>
  </entry>
diff -r 9e9e3a4e9261 -r fb60bf226033 mercurial/templates/atom/map
--- a/mercurial/templates/atom/map	Thu Mar 20 01:24:45 2014 -0700
+++ b/mercurial/templates/atom/map	Wed Apr 02 11:21:14 2014 -0700
@@ -13,3 +13,7 @@ 
 branches = branches.tmpl
 branchentry = branchentry.tmpl
 error = error.tmpl
+filedifflink = '{file|escape}<br />'
+fileellipses = '{file|escape}<br />'
+filenodelink = '{file|escape}<br />'
+filenolink = '{file|escape}<br />'