数码资讯
mac上多个svn版本_where命令
选购提示
关注价格、性能、续航、售后和真实使用场景,理性比较后再下单。
本篇文章主要目的是:通过一个实例说明 where 命令的用途。
今天,在项目目录下执行svn info突然报错:
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版本不够高。
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。
确定当前用的是哪个svn:
ccc ➤ which svn /usr/bin/svn
查看机器上有哪些svn:
ccc ➤ where svn /usr/bin/svn /usr/local/bin/svn /usr/bin/svn
果然有多个,至于为啥显示了两次/usr/bin/svn,后面再解决。
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:
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)
果然可以了!
设置一下别名。vim ~/.zshrc 增加一行 alias svn=/usr/local/bin/svn,source一下,再执行svn --version
➜ 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 成语...
语死早。。。
声明:本文内容用于数码产品信息整理与选购参考,具体价格、库存、售后政策以官方渠道和电商页面实时信息为准。