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}'
精彩评论