我经常坐在颠覆工作副本的中间,我想快速svn status
找出自上次检查以来我所做的改变.但是svn status
只适用于当前文件夹及其子项.(同样svn up
也是)
我想快速更改到subversion工作副本的根文件夹,这样我就可以运行svn status
并查看所有已更改的文件,可能是签入或更新,然后返回到以前工作的地方.
Dav*_*ean 15
这是我的第一个回答:我写了一个小的bash脚本,名为svnbase
:
#!/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
Run Code Online (Sandbox Code Playgroud)
所以现在我可以这样做:
[~/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]$
Run Code Online (Sandbox Code Playgroud)
如果您使用git-svn
Subversion客户端,那么您可以在本地使用Git命令与Subversion存储库进行透明交互.当您使用git status
树中任何位置的命令时,Git会自动显示整个存储库中的待处理状态.
在Windows上:
svn info . |findstr /C:"Working Copy Root Path:"
Run Code Online (Sandbox Code Playgroud)
在Linux上:
svn info . |grep -F "Working Copy Root Path:"
Run Code Online (Sandbox Code Playgroud)
可以使用一点字符串操作将其分配给变量.Windows版本:
FOR /F "delims=" %%i IN ('svn info . ^|findstr /C:"Working Copy Root Path:"') DO SET SOME_TEMP_VAR=%%i
SET WORKING_COPY_ROOT=%SOME_TEMP_VAR:~24%
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
15232 次 |
最近记录: |