本篇文章主要目的是:经过一个实例说明 where 命令的用途。
php
今天,在项目目录下执行svn info忽然报错:html
ccc ➤ svn info svn: E155021: This client is too old to work with the working copy at '/Users/luzuheng/PhpstormProjects/vagrant/data/ccc' (format 31). You need to get a newer Subversion client. For more details, see http://subversion.apache.org/faq.html#working-copy-format-change
提示svn版本不够高。apache
ccc ➤ svn --version svn, version 1.7.22 (r1694152) compiled Feb 10 2016, 16:22:46 Copyright (C) 2015 The Apache Software Foundation. This software consists of contributions made by many people; see the NOTICE file for more information. Subversion is open source software, see http://subversion.apache.org/ The following repository access (RA) modules are available: * ra_neon : Module for accessing a repository via WebDAV protocol using Neon. - handles 'http' scheme - handles 'https' scheme * ra_svn : Module for accessing a repository using the svn network protocol. - handles 'svn' scheme * ra_local : Module for accessing a repository on local disk. - handles 'file' scheme * ra_serf : Module for accessing a repository via WebDAV protocol using serf. - handles 'http' scheme - handles 'https' scheme
看来确实是版本低了,可是奇怪的是前两天还能够用的,说明个人机器上确定有多个版本的svn。vim
肯定当前用的是哪一个svn:app
ccc ➤ which svn /usr/bin/svn
查看机器上有哪些svn:svn
ccc ➤ where svn /usr/bin/svn /usr/local/bin/svn /usr/bin/svn
果真有多个,至于为啥显示了两次/usr/bin/svn,后面再解决。vagrant
ccc ➤ /usr/local/bin/svn --version svn, version 1.8.11 (r1643975) compiled Jan 18 2015, 06:42:12 on x86_64-apple-darwin14.1.0 Copyright (C) 2014 The Apache Software Foundation. This software consists of contributions made by many people; see the NOTICE file for more information. Subversion is open source software, see http://subversion.apache.org/ The following repository access (RA) modules are available: * ra_svn : Module for accessing a repository using the svn network protocol. - with Cyrus SASL authentication - handles 'svn' scheme * ra_local : Module for accessing a repository on local disk. - handles 'file' scheme * ra_serf : Module for accessing a repository via WebDAV protocol using serf. - using serf 1.3.8 - handles 'http' scheme - handles 'https' scheme
/usr/local/bin/svn下的是1.8的,再去项目里执行svn info:code
ccc ➤ /usr/local/bin/svn info Path: . Working Copy Root Path: /XXXXXXXXX/ccc URL: http://svnXXXXXXXX/trunk Relative URL: ^/XXX/trunk Repository Root: http://XXXXX/ Repository UUID: xxx Revision: xxxx Node Kind: directory Schedule: normal Last Changed Author: aaa Last Changed Rev: xxxx Last Changed Date: 2016-09-21 17:50:31 +0800 (三, 21 9 2016)
果真能够了!orm
设置一下别名。vim ~/.zshrc 增长一行 alias svn=/usr/local/bin/svn,source一下,再执行svn --versionhtm
➜ ccc svn --version svn, version 1.8.11 (r1643975) compiled Jan 18 2015, 06:42:12 on x86_64-apple-darwin14.1.0 Copyright (C) 2014 The Apache Software Foundation. This software consists of contributions made by many people; see the NOTICE file for more information. Subversion is open source software, see http://subversion.apache.org/ The following repository access (RA) modules are available: * ra_svn : Module for accessing a repository using the svn network protocol. - with Cyrus SASL authentication - handles 'svn' scheme * ra_local : Module for accessing a repository on local disk. - handles 'file' scheme * ra_serf : Module for accessing a repository via WebDAV protocol using serf. - using serf 1.3.8 - handles 'http' scheme - handles 'https' scheme
OK了!
再回头看where svn的时候为啥显示了两次/usr/bin/svn。怀疑跟环境变量PATH有关
ccc ➤ echo $PATH /usr/local/Cellar/php55/5.5.22/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
果真有两个 /usr/bin,一样/bin 和 /usr/sbin 和 /sbin 也有两个。
查看zsh配置:
ccc ➤ cat ~/.zshrc|grep PATH export PATH="/usr/local/Cellar/php55/5.5.22/bin:/usr/bin:/bin:/usr/sbin:/sbin:$PATH"
原来问题出在这,修改文件后, source ~/.zshrc,而后再看
➜ ccc where svn svn: aliased to /usr/local/bin/svn /usr/local/bin/svn /usr/bin/svn
OK了,由于svn的问题发现环境变量配置的错误,也算XXXX。 求XXXX这个成语……想不出来。。。
隔了两个小时,忽然想到where svn结果显示顺序是按照PATH环境变量优先级来的,前两天项目中svn info仍是可用的,今天忽然不能用的缘由就是昨天我调整了PATH,也就是说如今我修复完PATH以后不用别名也是优先使用的1.8版本的svn。 确认一下,先删除alias,而后:
└─[$]> where svn /usr/local/bin/svn /usr/bin/svn ─[$]> svn --version svn, version 1.8.11 (r1643975) compiled Jan 18 2015, 06:42:12 on x86_64-apple-darwin14.1.0 Copyright (C) 2014 The Apache Software Foundation. This software consists of contributions made by many people; see the NOTICE file for more information. Subversion is open source software, see http://subversion.apache.org/ The following repository access (RA) modules are available: * ra_svn : Module for accessing a repository using the svn network protocol. - with Cyrus SASL authentication - handles 'svn' scheme * ra_local : Module for accessing a repository on local disk. - handles 'file' scheme * ra_serf : Module for accessing a repository via WebDAV protocol using serf. - using serf 1.3.8 - handles 'http' scheme - handles 'https' scheme
果真啊…… 原来PATH错误才是致使项目里svn忽然用不了的罪魁祸首!!!
以前还在庆幸由于svn问题发现了PATH错误……
蜜汁尴尬。。。
继续求一发 XXXX 成语...
语死早。。。