开发者

Mercurial templates: have "{branches}" return "default"?

开发者 https://www.devze.com 2023-01-11 22:04 出处:网络
What\'s the simplest way to have hg ... --template \'{branches}\' 开发者_运维问答return default instead of an empty string when the changeset being printed is part of the default branch?I\'ve not foun

What's the simplest way to have hg ... --template '{branches}' 开发者_运维问答return default instead of an empty string when the changeset being printed is part of the default branch?


I've not found an in-template way to do that. If I'm in a shellscript I do something like:

BRANCH=$(hg log --revision 0 --template '{branches}')
echo ${BRANCH:=default}

Though if you have the excellent hg prompt extension in place you could do:

hg prompt '{branch}'
0

精彩评论

暂无评论...
验证码 换一张
取 消