I would like to configure our Mercurial server installation so the rss/atom feed will publish the branch name of the changeset, in additio开发者_如何学Pythonn to the standard fields (title, guid, description, author, pubDate).
Installation locations differ, but on ubuntu you'll find the relevant file as /usr/share/mercurial/templates/atom/changelogentry.tmpl
.
It starts out looking like:
<entry>
<title>{desc|strip|firstline|strip|escape|nonempty}</title>
<id>{urlbase}{url}#changeset-{node}</id>
<link href="{urlbase}{url}rev/{node|short}"/>
<author>
<name>{author|person|escape}</name>
<email>{author|email|obfuscate}</email>
</author>
<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>
</content>
</entry>
and you can add anything you find in hg help templates
including:
branches String. The name of the branch on which the changeset was committed. Will be
empty if the branch name was default.
I finally found a solution on the Mercurial mailing lists.
I had to edit templates\rss-log\changelogentry.tmpl like this:
<item>
<title>{desc|strip|firstline|strip|escape}</title>
<guid isPermaLink="true">{urlbase}{url}rev/{node|short}</guid>
<description>
<![CDATA[<i>{inbranch%branchname}{branches%branchname}</i>
<p>{desc|strip|escape|addbreaks|nonempty}]]>
</description>
<files>{file_mods}</files>
<author>{author|obfuscate}</author>
<pubDate>{date|rfc822date}</pubDate>
</item>
And I had to add the following line to templates\rss-log\map:
branchname = '{name}'
精彩评论