#!/bin/bash -u
# this command outputs the top-most parent of the current folder that is still
# under svn revision control to standard out
# if the current folder is not under svn revision control, nothing is output
# and a non-zero exit value is given
parent=""
grandparent="."
while [ -d "$grandparent/.svn" ]; do
parent=$grandparent
grandparent="$parent/.."
done
if [ ! -z "$parent" ]; then
echo $parent
else
exit 1
fi
所以现在我可以做到:
[~/work/scripts/XXX/code/speech-detection/framework]$ cd $(svnbase)
[~/work/scripts/XXX]$ svn status
? code/speech-detection/framework/output.old
[~/work/scripts/XXX]$ cd -
/home/XXXX/work/scripts/XXX/code/speech-detection/framework
[~/work/scripts/XXX/code/speech-detection/framework]$
在Windows上:
在Linux上:
它可以通过一点字符串操作分配给一个变量。Windows版本:
如果使用^{} 作为Subversion客户机,则可以在本地使用Git命令与Subversion存储库透明地交互。当您在树中的任何位置使用^{} 等命令时,Git会自动显示整个存储库中的挂起。
我的第一个答案是:我写了一个名为
svnbase
的bash脚本:所以现在我可以做到:
相关问题 更多 >
编程相关推荐