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

StackOverflow https://stackoverflow.com/questions/17387529

  •  02-06-2022
  •  | 
  •  

Domanda

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?

È stato utile?

Soluzione

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
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top