zsh-workers
 help / color / mirror / code / Atom feed
From: Frank Terbeck <ft@bewatermyfriend.org>
To: <zsh-workers@zsh.org>
Subject: Re: Issue with vcs_info and zsh 4.3.14
Date: Fri, 09 Dec 2011 19:11:14 +0100	[thread overview]
Message-ID: <87mxb1zkcd.fsf@ft.bewatermyfriend.org> (raw)
In-Reply-To: <91f8bdbd8b04c960f177e97d58423a08@archlinux.de> (Pierre Schmitz's message of "Wed, 07 Dec 2011 15:03:47 +0100")

Pierre Schmitz wrote:
[...]
> $ vcs_info
> svn: '.' is not a working copy

I think the patch below should fix this. Could you give it a test drive?

> I also noticed that when calling VCS_INFO_get_data_svn svn complains
> about the unknown option --non-interactive.

Daniel assures me in IRC, that at least since subversion 1.6, every
sub-command supports the `--non-interactive' option. Are you on a
particularly old version of subversion where the --non-interactive
errors are coming up?

I don't think I want to put too much effort into actively supporting
anything older than subversion 1.6.

Regards, Frank


diff --git a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
index b1cb730..2b51ea7 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
@@ -11,7 +11,20 @@ local -xA hook_com
 
 svnbase=".";
 svninfo=()
-${vcs_comm[cmd]} info --non-interactive | while IFS=: read a b; do svninfo[${a// /_}]="${b## #}"; done
+${vcs_comm[cmd]} info --non-interactive \
+|& while IFS=: read a b; do
+    # SVN 1.7+ prints out stable error numbers. The one below is the "not a
+    # working copy" error code. With prior versions we have to hope the error
+    # message fits. svn1.6 should spit out something that matches the 2nd
+    # pattern.
+    if [[ "$a $b" == *E155007* ]] \
+        || [[ "$a $b" == *'is not a working copy'* ]]
+    then
+        return 1
+    fi
+    svninfo[${a// /_}]="${b## #}"
+done
+
 while [[ -d "${svnbase}/../.svn" ]]; do
     parentinfo=()
     ${vcs_comm[cmd]} info --non-interactive "${svnbase}/.." | while IFS=: read a b; do parentinfo[${a// /_}]="${b## #}"; done


  parent reply	other threads:[~2011-12-09 19:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-07 14:03 Pierre Schmitz
2011-12-07 20:24 ` Daniel Shahaf
2011-12-09 18:11 ` Frank Terbeck [this message]
2011-12-23  9:38   ` Frank Terbeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mxb1zkcd.fsf@ft.bewatermyfriend.org \
    --to=ft@bewatermyfriend.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).