From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=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 74fffb81 for ; Sun, 1 Dec 2019 00:53:07 +0000 (UTC) Received: (qmail 13500 invoked by alias); 1 Dec 2019 00:52:59 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24483 Received: (qmail 18064 invoked by uid 1010); 1 Dec 2019 00:52:59 -0000 X-Qmail-Scanner-Diagnostics: from wout5-smtp.messagingengine.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.0/25642. spamassassin: 3.4.2. Clear:RC:0(64.147.123.21):SA:0(-2.6/5.0):. Processed in 4.659016 secs); 01 Dec 2019 00:52:59 -0000 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrudejvddgvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpeffhffvuffkgggtugfgfgesthektd dttderjeenucfhrhhomhepffgrnhhivghlucfuhhgrhhgrfhcuoegurdhssegurghnihgv lhdrshhhrghhrghfrdhnrghmvgeqnecukfhppeejledrudektddrheejrdduudelnecurf grrhgrmhepmhgrihhlfhhrohhmpegurdhssegurghnihgvlhdrshhhrghhrghfrdhnrghm vgenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Date: Sun, 1 Dec 2019 00:52:17 +0000 From: Daniel Shahaf To: zsh-users@zsh.org Subject: [WIP PATCH] vcs_info svn support for 'svnversion' Message-ID: <20191201005217.m4rpqq623l4vapwe@tarpaulin.shahaf.local2> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: NeoMutt/20170113 (1.7.2) I hacked up 'svnversion' support into vcs_info, to enable vcs_info to indicate non-uniform revisions and local mods in Subversion working copies. As it stands, I feel it's too hacky — see log message for details — so I don't intend to commit it as-is. However, I'm posting it here in case it's useful to anyone. Cheers, Daniel [[[ From: Daniel Shahaf Subject: [PATCH] WIP: vcs_info svn: Use svnversion to show uniform revisions and local mods The 'staged' expando, %c, will now be set if there's an 'M' in the output of `svnversion`. The 'revision number' expando, %i, will now show the full output of svnversion. svnversion will only be used if the check-for-changes and get-revision styles are both set. TODO: derive the svnversion command name robustly TODO: write docs --- Doc/Zsh/contrib.yo | 2 ++ Functions/VCS_Info/Backends/VCS_INFO_get_data_svn | 21 +++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Doc/Zsh/contrib.yo b/Doc/Zsh/contrib.yo index d32ba018d..a20bf0c19 100644 --- a/Doc/Zsh/contrib.yo +++ b/Doc/Zsh/contrib.yo @@ -1095,6 +1095,7 @@ is used as the command name. ) kindex(check-for-changes) item(tt(check-for-changes))( +TODO(svn) If enabled, this style causes the tt(%c) and tt(%u) format escapes to show when the working directory has uncommitted changes. The strings displayed by these escapes can be controlled via the tt(stagedstr) and tt(unstagedstr) @@ -1183,6 +1184,7 @@ method will not return the local revision number. ) kindex(get-revision) item(tt(get-revision))( +TODO(svn) If set to true, vcs_info goes the extra mile to figure out the revision of a repository's work tree (currently for the tt(git) and tt(hg) backends, where this kind of information is not always vital). For tt(git), the diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn index c1547950f..dd5ce1b0f 100644 --- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn +++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn @@ -6,6 +6,7 @@ setopt localoptions noksharrays extendedglob NO_shwordsplit local svnbase svnbranch a b rrn +local non_uniform_revision modified local -i rc local -A svninfo parentinfo cwdinfo local -A hook_com @@ -60,11 +61,27 @@ svnbase=${svnbase:P} rrn=${svnbase:t} zstyle -s ":vcs_info:${vcs}:${usercontext}:${rrn}" branchformat svnbranch || svnbranch="%b:%r" hook_com=( branch "${svninfo[URL]##*/}" revision "${cwdinfo[Revision]}" ) +if zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "check-for-changes" && + zstyle -t ":vcs_info:${vcs}:${usercontext}:${rrn}" "get-revision" ; then + local svnversion_cmd + if [[ $vcs_comm[cmd] == */* ]]; then + svnversion_cmd=${vcs_comm[cmd]:h}/${${vcs_comm[cmd]:t}/svn/svnversion} + else + svnversion_cmd=${vcs_comm[cmd]/svn/svnversion} + fi + hook_com[svnversion]=$($svnversion_cmd 2>/dev/null) + if [[ ${hook_com[svnversion]} == *M* ]]; then + modified=${hook_com[svnversion]} + fi + if [[ ${hook_com[svnversion]} == *:* ]]; then + non_uniform_revision=${hook_com[svnversion]} + fi +fi if VCS_INFO_hook 'set-branch-format' "${svnbranch}"; then - zformat -f svnbranch "${svnbranch}" "b:${hook_com[branch]}" "r:${hook_com[revision]}" + zformat -f svnbranch "${svnbranch}" "b:${hook_com[branch]}" "r:${hook_com[revision]}" "v:${hook_com[svnversion]}" else svnbranch=${hook_com[branch-replace]} fi hook_com=() -VCS_INFO_formats '' "${svnbranch}" "${svnbase}" '' '' "${cwdinfo[Revision]}" '' +VCS_INFO_formats '' "${svnbranch}" "${svnbase}" '' "$modified" "${non_uniform_revision:-${cwdinfo[Revision]}}" '' return 0 ]]]