* [PATCH] vcs_info hg: Compute the branch name correctly when get-revision is set and check-for-changes is not
@ 2021-04-07 21:48 Daniel Shahaf
2021-04-07 22:02 ` Duke Normandin
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2021-04-07 21:48 UTC (permalink / raw)
To: zsh-users
---
In the following, lines 10, 12, 14 state different branch names:
1 % hg init
2 % echo foo > foo
3 % hg add foo
4 % hg commit -m add
5 %
6 % autoload vcs_info
7 % precmd() { vcs_info; print -ParC1 -- $vcs_info_msg_0_ }
8 (hg)-[default]-
9 % hg branch newbranch > /dev/null
10 (hg)-[newbranch]-
11 % zstyle \* get-revision yes
12 (hg)-[default:326db25708c0:0]-
13 % zstyle \* check-for-changes yes
14 (hg)-[newbranch:326db25708c0:0]-
Seen with mercurial 4.8.2-1+deb10u1 and 5.6.1-2 (Debian stable and
unstable, respectively).
When get-revision is set, VCS_INFO_get_data_hg runs one of the following
commands, depending on whether check-for-changes is also set:
% hg id -inb
326db25708c0 0 newbranch
% hg id -inbr.
326db25708c0 0 default
The following patch seems to work. The branch name is then retrieved
from .hg/branch (which in workers/46016 was implied to be safe to use).
Reviews would be welcome.
Cheers,
Daniel
diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
index f7e9d6f45..c3ee409d3 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg
@@ -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,7 +58,7 @@ 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] vcs_info hg: Compute the branch name correctly when get-revision is set and check-for-changes is not
2021-04-07 21:48 [PATCH] vcs_info hg: Compute the branch name correctly when get-revision is set and check-for-changes is not Daniel Shahaf
@ 2021-04-07 22:02 ` Duke Normandin
2021-04-07 22:19 ` Daniel Shahaf
0 siblings, 1 reply; 4+ messages in thread
From: Duke Normandin @ 2021-04-07 22:02 UTC (permalink / raw)
To: zsh-users
On Wed, 7 Apr 2021 21:48:48 +0000
Daniel Shahaf <d.s@daniel.shahaf.name> wrote:
[snip the good stuff]
noob to zsh AND on a refresher tour of Linux! Please remind me what I'm to do with the patch you so kindly contributed. TIA ..
--
Duke Normandin <dukeofpurl@gmx.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] vcs_info hg: Compute the branch name correctly when get-revision is set and check-for-changes is not
2021-04-07 22:02 ` Duke Normandin
@ 2021-04-07 22:19 ` Daniel Shahaf
2021-04-07 22:32 ` Duke Normandin
0 siblings, 1 reply; 4+ messages in thread
From: Daniel Shahaf @ 2021-04-07 22:19 UTC (permalink / raw)
To: Duke Normandin, zsh-users
Duke Normandin wrote on Wed, 07 Apr 2021 22:02 +00:00:
> noob to zsh AND on a refresher tour of Linux! Please remind me what I'm
> to do with the patch you so kindly contributed. TIA ..
Review it if you're familiar with hg, otherwise, just ignore the thread.
Most patches go to -workers@, not to -users@.
Cheers,
Daniel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] vcs_info hg: Compute the branch name correctly when get-revision is set and check-for-changes is not
2021-04-07 22:19 ` Daniel Shahaf
@ 2021-04-07 22:32 ` Duke Normandin
0 siblings, 0 replies; 4+ messages in thread
From: Duke Normandin @ 2021-04-07 22:32 UTC (permalink / raw)
To: zsh-users
On Wed, 07 Apr 2021 22:19:44 +0000
"Daniel Shahaf" <d.s@daniel.shahaf.name> wrote:
> Duke Normandin wrote on Wed, 07 Apr 2021 22:02 +00:00:
> > noob to zsh AND on a refresher tour of Linux! Please remind me what
> > I'm to do with the patch you so kindly contributed. TIA ..
>
> Review it if you're familiar with hg, otherwise, just ignore the
> thread.
>
> Most patches go to -workers@, not to -users@.
10-4 thx
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-04-07 22:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-07 21:48 [PATCH] vcs_info hg: Compute the branch name correctly when get-revision is set and check-for-changes is not Daniel Shahaf
2021-04-07 22:02 ` Duke Normandin
2021-04-07 22:19 ` Daniel Shahaf
2021-04-07 22:32 ` Duke Normandin
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).