Patchwork hgweb: apply websub filter to the changeset description in rss and atom feeds

login
register
mail settings
Submitter Steven Brown
Date May 7, 2014, 6:48 a.m.
Message ID <171396ccd63139e6427e.1399445286@steve-debian.home>
Download mbox | patch
Permalink /patch/4654/
State Superseded
Commit 16352b34e32e40faab60fef8a0e533759e7a73fe
Headers show

Comments

Steven Brown - May 7, 2014, 6:48 a.m.
# HG changeset patch
# User Steven Brown <StevenGBrown@gmail.com>
# Date 1399444707 -28800
#      Wed May 07 14:38:27 2014 +0800
# Node ID 171396ccd63139e6427ec6da2400e8bda3c803c7
# Parent  0768cda8b5799dc803dc0ee27a832cd64e05f28a
hgweb: apply websub filter to the changeset description in rss and atom feeds

For example, this is useful for linking from the feed reader to a bug tracker.

This follows the existing pattern used within the hgweb templates. All usages
of the "desc" keyword are now followed by either the "firstline" filter or the
"websub" filter. When "websub" is used, it always follows the "escape" filter.
Pierre-Yves David - May 7, 2014, 8:42 p.m.
On 05/06/2014 11:48 PM, Steven Brown wrote:
> # HG changeset patch
> # User Steven Brown <StevenGBrown@gmail.com>
> # Date 1399444707 -28800
> #      Wed May 07 14:38:27 2014 +0800
> # Node ID 171396ccd63139e6427ec6da2400e8bda3c803c7
> # Parent  0768cda8b5799dc803dc0ee27a832cd64e05f28a
> hgweb: apply websub filter to the changeset description in rss and atom feeds

Test change makes sense to me. But:

1. Can we have it tested?

2. Should the documentation about websub be updated to mention that?
Steven Brown - May 14, 2014, 3:07 a.m.
On 8 May 2014 04:42, Pierre-Yves David <pierre-yves.david@ens-lyon.org>wrote:

>
>
> On 05/06/2014 11:48 PM, Steven Brown wrote:
>
>> # HG changeset patch
>> # User Steven Brown <StevenGBrown@gmail.com>
>> # Date 1399444707 -28800
>> #      Wed May 07 14:38:27 2014 +0800
>> # Node ID 171396ccd63139e6427ec6da2400e8bda3c803c7
>> # Parent  0768cda8b5799dc803dc0ee27a832cd64e05f28a
>> hgweb: apply websub filter to the changeset description in rss and atom
>> feeds
>>
>
> Test change makes sense to me. But:
>
> 1. Can we have it tested?


Yes, although I think that a unified test would have little value. Instead,
we could have a check-code rule detect whether the websub filter is applied
consistently throughout the templates. I'd be happy to send patches for
check-code once this hgweb patch has been accepted.

2. Should the documentation about websub be updated to mention that?


The hgrc documentation already mentions that websub is applied to the
revision descriptions. I think there is no need to make special mention of
the rss and atom feeds.

Thanks for the review.


> --
> Pierre-Yves David
Pierre-Yves David - May 15, 2014, 6:42 a.m.
On 05/13/2014 08:07 PM, Steven Brown wrote:
> On 8 May 2014 04:42, Pierre-Yves David <pierre-yves.david@ens-lyon.org
> <mailto:pierre-yves.david@ens-lyon.org>> wrote:
>
>
>
>     On 05/06/2014 11:48 PM, Steven Brown wrote:
>
>         # HG changeset patch
>         # User Steven Brown <StevenGBrown@gmail.com
>         <mailto:StevenGBrown@gmail.com>>
>         # Date 1399444707 -28800
>         #      Wed May 07 14:38:27 2014 +0800
>         # Node ID 171396ccd63139e6427ec6da2400e8__bda3c803c7
>         # Parent  0768cda8b5799dc803dc0ee27a832c__d64e05f28a
>         hgweb: apply websub filter to the changeset description in rss
>         and atom feeds
>
>
>     Test change makes sense to me. But:
>
>     1. Can we have it tested?
>
>
> Yes, although I think that a unified test would have little value.
> Instead, we could have a check-code rule detect whether the websub
> filter is applied consistently throughout the templates. I'd be happy to
> send patches for check-code once this hgweb patch has been accepted.

I believe that testing the rss and atom feed would be useful
(in general)

A check code rules is definitely a good idea.

>     2. Should the documentation about websub be updated to mention that?
>
>
> The hgrc documentation already mentions that websub is applied to the
> revision descriptions. I think there is no need to make special mention
> of the rss and atom feeds.

Ok. No doc update then.
Steven Brown - May 15, 2014, 11:45 a.m.
On 15 May 2014 14:42, "Pierre-Yves David" <pierre-yves.david@ens-lyon.org>
wrote:
>
>
>
> On 05/13/2014 08:07 PM, Steven Brown wrote:
>>
>> On 8 May 2014 04:42, Pierre-Yves David <pierre-yves.david@ens-lyon.org
>> <mailto:pierre-yves.david@ens-lyon.org>> wrote:
>>
>>
>>
>>     On 05/06/2014 11:48 PM, Steven Brown wrote:
>>
>>         # HG changeset patch
>>         # User Steven Brown <StevenGBrown@gmail.com
>>         <mailto:StevenGBrown@gmail.com>>
>>
>>         # Date 1399444707 -28800
>>         #      Wed May 07 14:38:27 2014 +0800
>>         # Node ID 171396ccd63139e6427ec6da2400e8__bda3c803c7
>>         # Parent  0768cda8b5799dc803dc0ee27a832c__d64e05f28a
>>
>>         hgweb: apply websub filter to the changeset description in rss
>>         and atom feeds
>>
>>
>>     Test change makes sense to me. But:
>>
>>     1. Can we have it tested?
>>
>>
>> Yes, although I think that a unified test would have little value.
>> Instead, we could have a check-code rule detect whether the websub
>> filter is applied consistently throughout the templates. I'd be happy to
>> send patches for check-code once this hgweb patch has been accepted.
>
>
> I believe that testing the rss and atom feed would be useful
> (in general)
>
> A check code rules is definitely a good idea.

OK, I'll send a new patch series soon.

>>     2. Should the documentation about websub be updated to mention that?
>>
>>
>> The hgrc documentation already mentions that websub is applied to the
>> revision descriptions. I think there is no need to make special mention
>> of the rss and atom feeds.
>
>
> Ok. No doc update then.
>
>
> --
> Pierre-Yves David

Patch

diff --git a/mercurial/templates/atom/changelogentry.tmpl b/mercurial/templates/atom/changelogentry.tmpl
--- a/mercurial/templates/atom/changelogentry.tmpl
+++ b/mercurial/templates/atom/changelogentry.tmpl
@@ -32,7 +32,7 @@ 
 	</tr>
 	<tr>
 		<th style="text-align:left;vertical-align:top;">description</th>
-		<td>{desc|strip|escape|addbreaks|nonempty}</td>
+		<td>{desc|strip|escape|websub|addbreaks|nonempty}</td>
 	</tr>
 	<tr>
 		<th style="text-align:left;vertical-align:top;">files</th>
diff --git a/mercurial/templates/rss/changelogentry.tmpl b/mercurial/templates/rss/changelogentry.tmpl
--- a/mercurial/templates/rss/changelogentry.tmpl
+++ b/mercurial/templates/rss/changelogentry.tmpl
@@ -27,7 +27,7 @@ 
 	</tr>
 	<tr>
 		<th style="text-align:left;vertical-align:top;">description</th>
-		<td>{desc|strip|escape|addbreaks|nonempty}</td>
+		<td>{desc|strip|escape|websub|addbreaks|nonempty}</td>
 	</tr>
 	<tr>
 		<th style="text-align:left;vertical-align:top;">files</th>
diff --git a/mercurial/templates/rss/filelogentry.tmpl b/mercurial/templates/rss/filelogentry.tmpl
--- a/mercurial/templates/rss/filelogentry.tmpl
+++ b/mercurial/templates/rss/filelogentry.tmpl
@@ -1,7 +1,7 @@ 
 <item>
     <title>{desc|strip|firstline|strip|escape}</title>
     <link>{urlbase}{url|urlescape}log{node|short}/{file|urlescape}</link>
-    <description><![CDATA[{desc|strip|escape|addbreaks|nonempty}]]></description>
+    <description><![CDATA[{desc|strip|escape|websub|addbreaks|nonempty}]]></description>
     <author>{author|obfuscate}</author>
     <pubDate>{date|rfc822date}</pubDate>
 </item>