1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-02 10:01:11 +02:00

users/26635 (tweaked): vcs_info hg: Compute the branch name correctly when get-revision is set and check-for-changes is not

Tweak: Simplify an always-true condition.

Review-by: Manuel Jacob
This commit is contained in:
Daniel Shahaf 2021-04-07 21:48:48 +00:00
parent b68a7421bd
commit 9353b12e99
2 changed files with 10 additions and 3 deletions

View file

@ -1,3 +1,10 @@
2021-04-21 Daniel Shahaf <d.s@daniel.shahaf.name>
* users/26635 (tweaked):
Functions/VCS_Info/Backends/VCS_INFO_get_data_hg: vcs_info hg:
Compute the branch name correctly when get-revision is set and
check-for-changes is not
2021-04-20 Bart Schaefer <schaefer@zsh.org>
* 48638: NEWS: mention TYPESET_TO_UNSET

View file

@ -49,7 +49,7 @@ if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-revision ; then
# Settling for a short (but unique!) hash because getting the full
# 40-char hash in addition to all the other info we want isn't
# available in a single hg invocation
hgid_args=( id -i -n -b )
hgid_args=( id -i -n )
# Looking for changes is a tad bit slower since the dirstate cache must
# first be refreshed before being read
@ -58,12 +58,12 @@ if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-revision ; then
local HGPLAIN
HGPLAIN=1 ${vcs_comm[cmd]} ${(z)hgid_args} 2> /dev/null \
| read -r r_csetid r_lrev r_branch
| read -r r_csetid r_lrev
fi
fi
# If the user doesn't opt to invoke hg we can still get the current branch
if [[ -z ${r_branch} && -r ${branchfile} ]] ; then
if [[ -r ${branchfile} ]] ; then
r_branch=$(< ${branchfile})
fi