4

The RSS feeds are a very good way to keep people updated about the latest changes in a repo. Unfortunately, the default RSS feeds include only the commit message in the body.

This similar question has information on how to customize the feed, but unfortunately there is no mention of adding a diff. Is it at all possible? How can I do it?

Community
  • 1
  • 1
static_rtti
  • 53,760
  • 47
  • 136
  • 192
  • 1
    `filediff.tmpl`, the template which displays the diff in hgweb, uses `{diff}`. Have you tried it? – Helgi May 29 '12 at 12:43
  • @Helgi : I've just tried it, unfortunately that property is empty when generating atom or RSS feeds :-( – static_rtti May 29 '12 at 15:48

1 Answers1

2

As it turns out, not only the {diff} is not passed to the changelogentry.tmpl for RSS, but the RSS template set itself is lacking some templates needed to display diffs.

I've done a quick-and-dirty patch adding raw diffs to the Mercurial RSS template set. The patch is based on the version 2.2.1 of Mercurial. It modifies the Mercurial source (webcommands.py) in addition to the RSS template set, so you'll end up using a patched version of Mercurial itself, not only the templates.

The patch can be found on the so-10796514 branch in my copy of the Hg repo on Bitbucket. Feel free to use it.

Here's how the modified changelog looks like on my machine:

Screenshot of the RSS changelog with diffs, in Safari

I guess it can be improved from this point on.

Helgi
  • 5,428
  • 1
  • 31
  • 48
  • Thanks a lot! I'll test on Monday. Is there any chance you could get this integrated upstream? Even though it's a small patch, there's a significant chance it could be useful to other people. – static_rtti Jun 01 '12 at 18:48
  • 1
    @static_rtti: I'm not sure, to be honest. I don't really know if the effects of diff formatting on every RSS request are acceptable. I guess this can be done with an option to enable or disable this behavior. Anyway, before trying to suggest this upstream I'd like to get the feedback from the real usage of the patch. I'm looking forward to the results of your Monday tests. – Helgi Jun 01 '12 at 19:07
  • 1
    Works like a charm, thanks a lot! It would be great if it were integrated upstream, but I do understand that some people wouldn't want it. At least an option would be nice anyways, because some people can't afford to patch their production mercurial servers :) Thanks again! – static_rtti Jun 04 '12 at 13:13
  • 1
    @static_rtti: You're welcome. :) I'm going to ask in mercurial-devel about this patch, and write here about the results. – Helgi Jun 04 '12 at 13:21
  • Any news regarding integration of this change in the main branch? – static_rtti Aug 03 '12 at 13:42