From cb87816b0f47367a763790adabcec1e331156ea2 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 26 Mar 2020 01:32:50 +0000 Subject: 45626: vcs_info: Deduplicate calling the set-branch-format hook. --- Functions/VCS_Info/VCS_INFO_set-branch-format | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Functions/VCS_Info/VCS_INFO_set-branch-format (limited to 'Functions/VCS_Info/VCS_INFO_set-branch-format') diff --git a/Functions/VCS_Info/VCS_INFO_set-branch-format b/Functions/VCS_Info/VCS_INFO_set-branch-format new file mode 100644 index 000000000..8cff51b9a --- /dev/null +++ b/Functions/VCS_Info/VCS_INFO_set-branch-format @@ -0,0 +1,22 @@ +# A function for calling the branch-format hook +# +# Return the value to use in REPLY +# +# Parameters: +readonly branch=$1 +readonly revision=$2 +# + +[[ -n $rrn ]] || return 1 +local -A hook_com +local branchformat + +zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat branchformat || branchformat="%b:%r" +hook_com=( branch "${branch}" revision "${revision}" ) +if VCS_INFO_hook 'set-branch-format' "${branchformat}"; then + zformat -f REPLY "${branchformat}" "b:${hook_com[branch]}" "r:${hook_com[revision]}" +else + REPLY=${hook_com[branch-replace]} +fi +hook_com=() +return 0 -- cgit v1.2.3 From c055c6464de20da13a6c805f017543f94b6e0ca9 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Sat, 29 Jan 2022 11:08:21 +0000 Subject: unposted: vcs_info: Add Vim modelines ... for consistency with all other vcs_info function files. --- ChangeLog | 5 +++++ Functions/VCS_Info/VCS_INFO_patch2subject | 2 ++ Functions/VCS_Info/VCS_INFO_set-branch-format | 2 ++ Functions/VCS_Info/VCS_INFO_set-patch-format | 2 ++ Misc/vcs_info-examples | 2 ++ 5 files changed, 13 insertions(+) (limited to 'Functions/VCS_Info/VCS_INFO_set-branch-format') diff --git a/ChangeLog b/ChangeLog index 1aa704c23..92646df79 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2022-01-29 Daniel Shahaf + * unposted: Functions/VCS_Info/VCS_INFO_patch2subject, + Functions/VCS_Info/VCS_INFO_set-branch-format, + Functions/VCS_Info/VCS_INFO_set-patch-format: vcs_info: Add + Vim modelines + * 49723: Functions/VCS_Info/VCS_INFO_quilt: vcs_info quilt: Use quilt-patch-dir and ${QUILT_PATCHES} even when get-unapplied hasn't been set diff --git a/Functions/VCS_Info/VCS_INFO_patch2subject b/Functions/VCS_Info/VCS_INFO_patch2subject index a467edcdb..5aa9efd23 100644 --- a/Functions/VCS_Info/VCS_INFO_patch2subject +++ b/Functions/VCS_Info/VCS_INFO_patch2subject @@ -1,3 +1,5 @@ +## vim:ft=zsh +# # This function takes as an argument a filename of a patch and sets $REPLY to # a single-line "subject", or unsets it if no subject could be extracted. { diff --git a/Functions/VCS_Info/VCS_INFO_set-branch-format b/Functions/VCS_Info/VCS_INFO_set-branch-format index 8cff51b9a..cbab60e29 100644 --- a/Functions/VCS_Info/VCS_INFO_set-branch-format +++ b/Functions/VCS_Info/VCS_INFO_set-branch-format @@ -1,3 +1,5 @@ +## vim:ft=zsh +# # A function for calling the branch-format hook # # Return the value to use in REPLY diff --git a/Functions/VCS_Info/VCS_INFO_set-patch-format b/Functions/VCS_Info/VCS_INFO_set-patch-format index e387110a2..c35b695c3 100644 --- a/Functions/VCS_Info/VCS_INFO_set-patch-format +++ b/Functions/VCS_Info/VCS_INFO_set-patch-format @@ -1,3 +1,5 @@ +## vim:ft=zsh +# # This function is the common guts of the gen-applied-string / # gen-unapplied-string / set-patch-format dance of several backends. # diff --git a/Misc/vcs_info-examples b/Misc/vcs_info-examples index c2b02a2ac..94c47278d 100644 --- a/Misc/vcs_info-examples +++ b/Misc/vcs_info-examples @@ -1,3 +1,5 @@ +## vim:ft=zsh +# # A collection of vcs_info usage examples ### Running vcs_info ######################################################### -- cgit v1.2.3