Как сделать так, чтобы канал Mercurial (hgwebdir) rss/atom отображал название ветви
Я хотел бы настроить установку нашего сервера Mercurial, чтобы в ленте rss/atom было опубликовано имя ветви набора изменений, в дополнение к стандартным полям (заголовок, guid, описание, автор, pubDate).
2 ответа
Решение
Я наконец нашел решение в списках рассылки Mercurial.
Мне пришлось редактировать шаблоны \rss-log\changelogentry.tmpl следующим образом:
<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>
И мне пришлось добавить следующую строку в шаблоны \ rss-log \ map:
branchname = '{name}'
Места установки различаются, но в Ubuntu вы найдете соответствующий файл как /usr/share/mercurial/templates/atom/changelogentry.tmpl
,
Это выглядит как:
<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>
и вы можете добавить все, что вы найдете в hg help templates
в том числе:
branches String. The name of the branch on which the changeset was committed. Will be
empty if the branch name was default.