From 889f6690fd678ed2fdeb4d467e5b8db49b9c6667 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Fri, 23 Sep 2016 06:47:31 +0000 Subject: 39423: vcs_info git: Produce nicer applied-string messages for 'exec' actions. This changes the behaviour on "unknown" git-rebase actions (those other than pick/reword/edit/fixup/squash/execute). --- Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Functions/VCS_Info/Backends') diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 472c10d5d..18ba89a9a 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -213,8 +213,12 @@ elif [[ -d "${gitdir}/rebase-merge" ]]; then local p [[ -f "${patchdir}/done" ]] && for p in ${(f)"$(< "${patchdir}/done")"}; do - # remove action - git_patches_applied+=("${${(s: :)p}[2,-1]}") + # pick/edit/fixup/squash/reword: Add "$hash $subject" to $git_patches_applied. + # exec: Add "exec ${command}" to $git_patches_applied. + # (anything else): As 'exec'. + p=${p/(#s)(p|pick|e|edit|r|reword|f|fixup|s|squash) /} + p=${p/(#s)x /exec } + git_patches_applied+=("$p") done if [[ -f "${patchdir}/git-rebase-todo" ]] ; then git_patches_unapplied=(${(f)"$(grep -v '^$' "${patchdir}/git-rebase-todo" | grep -v '^#')"}) -- cgit v1.2.3 From 74aa45910b3711622e9eb5ccf8adef9566db6f62 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Mon, 31 Oct 2016 18:35:19 +0000 Subject: 39786: vcs_info (hg): Use native hexdump implementation instead of external command. Fixes issue whereby the external command would print "*" for repeated octets. Includes comment change, cf 39790. --- ChangeLog | 7 +++++++ Functions/VCS_Info/Backends/VCS_INFO_get_data_hg | 7 ++++--- Functions/VCS_Info/VCS_INFO_hexdump | 16 ++++++++++++++++ Functions/VCS_Info/vcs_info | 1 + 4 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 Functions/VCS_Info/VCS_INFO_hexdump (limited to 'Functions/VCS_Info/Backends') diff --git a/ChangeLog b/ChangeLog index e08cafd30..9dd63251e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2016-10-31 Daniel Shahaf + + * 39786: Functions/VCS_Info/Backends/VCS_INFO_get_data_hg, + Functions/VCS_Info/VCS_INFO_hexdump, Functions/VCS_Info/vcs_info: + vcs_info (hg): Use native hexdump implementation instead of + external command. + 2016-10-30 Peter Stephenson * 39777: Src/parse.c, Test/D08cmdsubst.ztst: $() is a valid diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg index f35ad5965..69b7db304 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_hg @@ -40,9 +40,10 @@ VCS_INFO_adjust # Disabled by default anyway, so no harm done. if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" get-revision ; then if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" use-simple \ - && ( VCS_INFO_check_com hexdump ) && [[ -r ${dirstatefile} ]] ; then - # Calling hexdump is (much) faster than hg but doesn't get the local rev - r_csetid=$(hexdump -n 20 -e '1/1 "%02x"' ${dirstatefile}) + && VCS_INFO_hexdump ${dirstatefile} 20 ; then + # Calling VCS_INFO_hexdump is (much) faster than hg but doesn't get + # the local rev + r_csetid=$REPLY else # 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 diff --git a/Functions/VCS_Info/VCS_INFO_hexdump b/Functions/VCS_Info/VCS_INFO_hexdump new file mode 100644 index 000000000..11f1c1a50 --- /dev/null +++ b/Functions/VCS_Info/VCS_INFO_hexdump @@ -0,0 +1,16 @@ +## vim:ft=zsh + +# VCS_INFO_hexdump FILENAME BYTECOUNT +# +# Return in $REPLY a hexadecimal representation (lowercase, no whitespace) +# of the first BYTECOUNT bytes of FILENAME. + +if [[ -r $1 ]]; then + setopt localoptions nomultibyte extendedglob + local val + read -k $2 -u 0 val <$1 + REPLY=${(Lj::)${(l:2::0:)${(@s//)val}//(#m)*/$(( [##16] ##$MATCH ))}} +else + return 1 +fi + diff --git a/Functions/VCS_Info/vcs_info b/Functions/VCS_Info/vcs_info index f13f6b501..c0c1182e6 100644 --- a/Functions/VCS_Info/vcs_info +++ b/Functions/VCS_Info/vcs_info @@ -19,6 +19,7 @@ static_functions=( VCS_INFO_check_com VCS_INFO_formats VCS_INFO_get_cmd + VCS_INFO_hexdump VCS_INFO_hook VCS_INFO_maxexports VCS_INFO_nvcsformats -- cgit v1.2.3