Hg (Mercurial SCM) and Notify - How to get project name and edit email subject?

北慕城南 提交于 2019-12-11 16:16:10

问题


I'm using Hg(1.6.4) with Notify extension and I am trying to override the changeset template with project name on email subject. I read the "hg template help" and I not found a specific tag to get the project name.

The {webroot} and {root} tags got all path and I wanted PROJECT name only, i.e:

/home/USER/repo/PROJECT/rev

Is it possible to extract only PROJECT name? Is there any tag or template to parser and to get the project name?


回答1:


Uncomment the strip variable in hgrc file

#If you want to use a shorter repo-name, you can strip off components at the beginning.
#For example to strip off /usr/local/hg/repos from /usr/local/hg/repos/code use
strip = 3

And use a template like this to edit the email subject:

template = Subject: {webroot|strip}\n
 details:     {webroot}/rev/{node|short}
 branches:    {branches}
 changeset:   {rev}:{node|short}
 user:        {author}
 date:        {date|date}
 description: {desc}\n


来源:https://stackoverflow.com/questions/17387529/hg-mercurial-scm-and-notify-how-to-get-project-name-and-edit-email-subject

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!