zsh-workers
 help / color / mirror / code / Atom feed
* Issue with vcs_info and zsh 4.3.14
@ 2011-12-07 14:03 Pierre Schmitz
  2011-12-07 20:24 ` Daniel Shahaf
  2011-12-09 18:11 ` Frank Terbeck
  0 siblings, 2 replies; 4+ messages in thread
From: Pierre Schmitz @ 2011-12-07 14:03 UTC (permalink / raw)
  To: zsh-workers

Hi all,

after upgrading from 4.3.12 to 4.3.14 I noticed that my vcs_info always
prints a warning if the current dir is not tracked by svn (but a parent
dir is). This breaks the grml-zsh-config for example.

How to reproduce:
$ svnadmin create /tmp/foo
$ svn co file:///foo bar
$ mkdir bar/blah
$ cd bar/blah
$ vcs_info
svn: '.' is not a working copy

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

Let me know if you need more info.

Greetings,

Pierre

-- 
Pierre Schmitz, http://pierre-schmitz.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Issue with vcs_info and zsh 4.3.14
  2011-12-07 14:03 Issue with vcs_info and zsh 4.3.14 Pierre Schmitz
@ 2011-12-07 20:24 ` Daniel Shahaf
  2011-12-09 18:11 ` Frank Terbeck
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Shahaf @ 2011-12-07 20:24 UTC (permalink / raw)
  To: Pierre Schmitz; +Cc: zsh-workers

Pierre Schmitz wrote on Wed, Dec 07, 2011 at 15:03:47 +0100:
> Hi all,
> 
> after upgrading from 4.3.12 to 4.3.14 I noticed that my vcs_info always
> prints a warning if the current dir is not tracked by svn (but a parent
> dir is). This breaks the grml-zsh-config for example.
> 
> How to reproduce:
> $ svnadmin create /tmp/foo
> $ svn co file:///foo bar
> $ mkdir bar/blah
> $ cd bar/blah
> $ vcs_info
> svn: '.' is not a working copy
> 

Unversioned subdirectory of a working copy?

>From a libsvn_wc perspective, the things to beware of here are tree
changes (uncommitted add/rm of directories; these may nest) and
non-direct-child externals --- namely, svn:externals properties on
directory X that create X\foo\bar\baz.

In practice, though, taking care of non-nested dir add/rm's should
address the vast majority of use-cases.

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

All svn subcommands accept --non-interactives.

> Let me know if you need more info.
> 
> Greetings,
> 
> Pierre
> 
> -- 
> Pierre Schmitz, http://pierre-schmitz.com


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Issue with vcs_info and zsh 4.3.14
  2011-12-07 14:03 Issue with vcs_info and zsh 4.3.14 Pierre Schmitz
  2011-12-07 20:24 ` Daniel Shahaf
@ 2011-12-09 18:11 ` Frank Terbeck
  2011-12-23  9:38   ` Frank Terbeck
  1 sibling, 1 reply; 4+ messages in thread
From: Frank Terbeck @ 2011-12-09 18:11 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Issue with vcs_info and zsh 4.3.14
  2011-12-09 18:11 ` Frank Terbeck
@ 2011-12-23  9:38   ` Frank Terbeck
  0 siblings, 0 replies; 4+ messages in thread
From: Frank Terbeck @ 2011-12-23  9:38 UTC (permalink / raw)
  To: zsh-workers

Frank Terbeck wrote:
[...]
> +    if [[ "$a $b" == *E155007* ]] \
> +        || [[ "$a $b" == *'is not a working copy'* ]]

So... long time, no mail about this.

I've discussed this a little more with Daniel on IRC. And it turns out,
there would be more than one error to check for here.

And I'm not going to do that. Instead, I want to check for the return
code of calling "svn info" and bail out if that's non-zero.

I wanted to do that with `$pipestatus[]', but I've stumbled across a
rather severe issue with that (see workers-29973 for details). So, in
the meantime, I'll commit patch included below. It contains the code I
really want to use (commented out) and a clumsier approach using a
temporary array `$dat[]'. As soon as the `pipestatus' issue is resolved,
I'll be removing the workaround. But I'd like to get an svn-1.7 enabled
vcs_info going.

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..41cc3e7 100644
--- a/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
+++ b/Functions/VCS_Info/Backends/VCS_INFO_get_data_svn
@@ -6,12 +6,28 @@
 
 setopt localoptions noksharrays extendedglob NO_shwordsplit
 local svnbase svnbranch a b rrn
+local -i rc
 local -A svninfo parentinfo
 local -xA hook_com
 
 svnbase=".";
 svninfo=()
-${vcs_comm[cmd]} info --non-interactive | while IFS=: read a b; do svninfo[${a// /_}]="${b## #}"; done
+# Unfortunately, `$pipestatus' is broken currently. Until that problem is
+# resolved, here is a workaround that will get things done, without using it.
+# Clumsily, but that's life.
+local -a dat
+dat=( ${(f)"$(${vcs_comm[cmd]} info --non-interactive 2>&1)"} )
+rc=$?
+(( rc != 0 )) && return 1
+# The following line is the real code, the following is the workaround.
+#${vcs_comm[cmd]} info --non-interactive \
+print -l "${dat[@]}" \
+|& while IFS=: read a b; do
+    svninfo[${a// /_}]="${b## #}"
+done
+#rc=${pipestatus[1]}
+#(( rc != 0 )) && return 1
+
 while [[ -d "${svnbase}/../.svn" ]]; do
     parentinfo=()
     ${vcs_comm[cmd]} info --non-interactive "${svnbase}/.." | while IFS=: read a b; do parentinfo[${a// /_}]="${b## #}"; done


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-12-23 14:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-07 14:03 Issue with vcs_info and zsh 4.3.14 Pierre Schmitz
2011-12-07 20:24 ` Daniel Shahaf
2011-12-09 18:11 ` Frank Terbeck
2011-12-23  9:38   ` Frank Terbeck

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).