From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: zsh-workers-return-43618-ml=inbox.vuxu.org@zsh.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id 65d5bc12 for ; Sun, 7 Oct 2018 17:47:50 +0000 (UTC) Received: (qmail 389 invoked by alias); 7 Oct 2018 17:47:01 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 43618 Received: (qmail 20935 invoked by uid 1010); 7 Oct 2018 17:47:00 -0000 X-Qmail-Scanner-Diagnostics: from out3-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(66.111.4.27):SA:0(-2.6/5.0):. Processed in 6.776008 secs); 07 Oct 2018 17:47:00 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= daniel.shahaf.name; h=from:to:subject:date:message-id; s=fm1; bh=b3O07ccrAKyjeSQcCh7LlWUA/D1Oj2sfGP+DghMQ7ek=; b=IuexgVQI8sc3 LRPJA3Q0ojP6nEEVis+89yrArvc7yHTpPU6upG/aMwJSpfX+ZgClysiyAV35G21t yMNRRXkBkdChPS9vMx5vLVrUJqkMUy3DyZW3MXWFn/ZkT1KwR0YFsbshKIywL10U YgeGfIoFm2J1e4HgKvhHzdHmsKCNmp1PNwGd7gcBeOxc/CDDFyvrMkwe0YLnOkXN a41j50W6I1Ig3EpblsKjjSd34u1XaeCOE4RWNRXgbMmDs25aNZl1IPn/0k76sa3J Aj1wvlbSnjUiA2YOXhUBVC0VX4IwA+zb+PZPg3ZlmDkrQ2FcD+t/uuBPvvDb8orK Y0tEffoq4g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=date:from:message-id:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=b3O07ccrAKyjeSQcCh7LlWUA/D1Oj2sfGP+DghMQ7ek=; b=TR3sDfNg zwKeHpCsJhxhtQ189Fr/ShLKn5EEVurATPsnu3no+wng8Zp+ZlL8v8C1Euuhm6e2 T+V84naOWYkEytrKNvadwhAzdPrIHF2VfbW5Y5q/kTuQD7YfAwOWwAWFPBXsArYs wStBQl1WbPUn360D0wIxTqgS9m06YYG/pO4HNbJqQP1IATirpIOS5Kb+q85NfpTL Lx+YRBFRB1bsLkj/F/LG4cDCafD/M7EuYNgtkyDrhmORBNCrbpQ/yCTQGKhuheZx dzlwh3ojpwRYpdhH/YmbgeL92ff6YLfz6W2CNlcFmV49X28IGIhAq3TK3qaobVlN mcja3TKjiJ4HAw== X-ME-Sender: X-ME-Proxy: From: Daniel Shahaf To: zsh-workers@zsh.org Subject: [PATCH 1/4] vcs_info: Don't redefine helper functions on every execution of the autoloadable outer function. Date: Sun, 7 Oct 2018 17:46:40 +0000 Message-Id: <20181007174643.16262-1-danielsh@tarpaulin.shahaf.local2> X-Mailer: git-send-email 2.11.0 This allows enabling tracing of the helper functions without fned'ing the outer function. --- Functions/VCS_Info/Backends/VCS_INFO_detect_p4 | 2 ++ Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr | 3 +++ Functions/VCS_Info/Backends/VCS_INFO_get_data_git | 3 +++ Functions/VCS_Info/VCS_INFO_quilt | 7 +++++-- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Functions/VCS_Info/Backends/VCS_INFO_detect_p4 b/Functions/VCS_Info/Backends/VCS_INFO_detect_p4 index 95a534786..d171c68ee 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_detect_p4 +++ b/Functions/VCS_Info/Backends/VCS_INFO_detect_p4 @@ -16,6 +16,7 @@ # of having such files in all client root directories and nowhere above. +(( ${+functions[VCS_INFO_p4_get_server]} )) || VCS_INFO_p4_get_server() { emulate -L zsh setopt extendedglob @@ -43,6 +44,7 @@ VCS_INFO_p4_get_server() { } +(( ${+functions[VCS_INFO_detect_p4]} )) || VCS_INFO_detect_p4() { local serverport p4where diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr index 705db65a7..b30e0e12b 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_bzr @@ -8,6 +8,7 @@ local bzrbase bzrbr bzr_changes bzr_type local -a bzrinfo local -A hook_com bzr_info +(( ${+functions[VCS_INFO_bzr_get_info]} )) || VCS_INFO_bzr_get_info() { bzrinfo=( ${(s.:.)$( ${vcs_comm[cmd]} version-info --custom \ --template="{revno}:{branch_nick}:{clean}")} ) @@ -20,6 +21,7 @@ VCS_INFO_bzr_get_info() { fi } +(( ${+functions[VCS_INFO_bzr_get_info_restricted]} )) || VCS_INFO_bzr_get_info_restricted() { # we are forbidden from fetching info on bound branch from remote repository bzrinfo=( $(${vcs_comm[cmd]} revno) ${bzrbase:t} ) @@ -30,6 +32,7 @@ VCS_INFO_bzr_get_info_restricted() { fi } +(( ${+functions[VCS_INFO_bzr_get_changes]} )) || VCS_INFO_bzr_get_changes() { local -A counts local line flag diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git index 04d15bb4a..0050f613a 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_git +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_git @@ -8,6 +8,7 @@ local -i querystaged queryunstaged local -a git_patches_applied git_patches_unapplied local -A hook_com +(( ${+functions[VCS_INFO_git_getaction]} )) || VCS_INFO_git_getaction () { local gitdir=$1 local tmp @@ -70,6 +71,7 @@ VCS_INFO_git_getaction () { return 1 } +(( ${+functions[VCS_INFO_git_getbranch]} )) || VCS_INFO_git_getbranch () { local gitdir=$1 tmp actiondir local gitsymref="${vcs_comm[cmd]} symbolic-ref HEAD" @@ -118,6 +120,7 @@ VCS_INFO_git_getbranch () { return 0 } +(( ${+functions[VCS_INFO_git_handle_patches]} )) || VCS_INFO_git_handle_patches () { local git_applied_s git_unapplied_s gitmsg git_patches_applied=(${(Oa)git_patches_applied}) diff --git a/Functions/VCS_Info/VCS_INFO_quilt b/Functions/VCS_Info/VCS_INFO_quilt index 381b58489..1f20e895d 100644 --- a/Functions/VCS_Info/VCS_INFO_quilt +++ b/Functions/VCS_Info/VCS_INFO_quilt @@ -1,5 +1,6 @@ ## vim:ft=zsh:foldmethod=marker +(( ${+functions[VCS_INFO_quilt-match]} )) || function VCS_INFO_quilt-match() { emulate -L zsh setopt extendedglob @@ -20,6 +21,7 @@ function VCS_INFO_quilt-match() { return 1 } +(( ${+functions[VCS_INFO_quilt-standalone-detect]} )) || function VCS_INFO_quilt-standalone-detect() { emulate -L zsh setopt extendedglob @@ -58,6 +60,7 @@ function VCS_INFO_quilt-standalone-detect() { return 1 } +(( ${+functions[VCS_INFO_quilt-dirfind]} )) || function VCS_INFO_quilt-dirfind() { # This is a wrapper around VCS_INFO_bydir_detect(). It makes sure # that $vcs_comm[] is unchanged. Currently, changing anything in it @@ -80,11 +83,12 @@ function VCS_INFO_quilt-dirfind() { return ${ret} } +(( ${+functions[VCS_INFO_quilt-patch2subject]} )) || function VCS_INFO_quilt-patch2subject() { VCS_INFO_patch2subject "$@" } -function VCS_INFO_quilt() { +{ emulate -L zsh setopt extendedglob local mode="$1" @@ -192,4 +196,3 @@ function VCS_INFO_quilt() { VCS_INFO_hook 'post-quilt' ${mode} ${patches} ${pc:-\\-nopc-} } -VCS_INFO_quilt "$@"