Quite often I\'m sitting in the middle of a subversion working copy, and I want to do a quick svn status
to find out what changes I have made since the last che
On linux with svn, version 1.9.3 (r1718519), I run this:
svn info --show-item wc-root
actually, if you look in your .svn/entries file, you'll find the base listed in there usually around line 6. In any event, the format of your svn url will give you some significant clues :P
Oh yeah, i took the liberty of looking, and svn info
will also tell you.
...sigh, that's not what you asked though. I like the solution in the first answer :P
On Windows:
svn info . |findstr /C:"Working Copy Root Path:"
On Linux:
svn info . |grep -F "Working Copy Root Path:"
It can be assigned to a variable using a little string manipulation. Windows version:
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%
It is not possible. SVN can be checked out from any depth, and any subdir acts like brand new checkout.
edit: svnbase script in prev comment works, but it is not precise.
Try the following command at any depth of your working copy:
svn info . --show-item wc-root --no-newline
Here's my first go at an answer: I wrote a little bash script called 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
So now I can do this:
[~/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]$