15 Sep 18:32
svn completion under Cygwin
From: Vadim Zeitlin <vz-zsh <at> zeitlins.org>
Subject: svn completion under Cygwin
Newsgroups: gmane.comp.shells.zsh.devel
Date: 2008-09-15 16:33:25 GMT
Expires: This article expires on 2008-09-29
Subject: svn completion under Cygwin
Newsgroups: gmane.comp.shells.zsh.devel
Date: 2008-09-15 16:33:25 GMT
Expires: This article expires on 2008-09-29
Hello, My Cygwin zsh 4.3.2 doesn't complete any file names for "svn ci" (and other svn subcommands) and the problem persists even when using the latest completion file version from http://zsh.cvs.sourceforge.net/*checkout*/zsh/zsh/Completion/Unix/Command/_subversion?revision=1.25 I couldn't really understand where exactly does the problem come from to be honest but, as this works under Unix I was almost sure that it was due to either "\r\n" line terminators or backslashes instead of slashes in the output of Win32 svn version. It turned out to be the latter and so the following trivial patch makes the completion work as expected: --- _subversion.orig 2008-09-15 18:29:24.788071400 +0200 +++ _subversion 2008-09-15 18:29:33.412740200 +0200 @@ -194,7 +194,7 @@ local pat="${1(Continue reading)[ADMR~]|?M)}" if (( ! $+_cache_svn_status[$dir] )); then - _cache_svn_status[$dir]="$(_call_program files svn status -N $dir)" + _cache_svn_status[$dir]="$(_call_program files svn status -N $dir) | tr '\\' '/'" fi (( ${(M)#${(f)_cache_svn_status[$dir]}:#(#s)${~pat}*$REPLY} )) This is almost surely not the best way to fix it but maybe this is going to be useful to somebody. And if anybody could propose a better fix which could be included in the next versions of zsh it would be great,
[ADMR~]|?M)}"
if (( ! $+_cache_svn_status[$dir] )); then
- _cache_svn_status[$dir]="$(_call_program files svn status -N $dir)"
+ _cache_svn_status[$dir]="$(_call_program files svn status -N $dir) | tr '\\' '/'"
fi
(( ${(M)#${(f)_cache_svn_status[$dir]}:#(#s)${~pat}*$REPLY} ))
This is almost surely not the best way to fix it but maybe this is going to
be useful to somebody. And if anybody could propose a better fix which
could be included in the next versions of zsh it would be great,
So,
case $OSTYPE in
(...) function _svn_osfixup { tr '\\' '/' } ;;
(*) function _svn_osfixup { cat } ;;
esac
_cache_svn_status[$dir]="$(_call_program files svn status -N $dir | _svn_osfixup)"
where ... should be whatever $OSTYPE is on Windows, or the list of such
types.
Make sense?
-Phil
RSS Feed