Resurrecting Deleted Items with svn cp

Ben Collins-Sussman sussman at red-bean.com
Sat Nov 24 13:31:30 CST 2007


While we appreciate your transcript, you should really be posting this
stuff to the users@ list, since it's not a bug in the book so much as
your needing general help understanding svn.  :-)


> B: COMMANDS IN WORKING DIR -> ERRORS
> --------------------------
> svn copy -r10 \
>  file:///home/malaise/SVN/tmp/trunk/ParentDir/TheDir/Thefile.txt \
>  ./Thefile.txt
> svn: Path 'Thefile.txt' is not a directory

I believe 'svn cp' assumes the target is a directory to copy to.

>
> malaise at telemaque:~/tmp/ParentDir/TheDir $  svn copy -r10  \
>  file:///home/malaise/SVN/tmp/trunk/ParentDir/TheDir/Thefile.txt \
>  .
> svn: Path 'Thefile.txt' already exists

You can't overwrite an existing versioned file with another one.

>
> malaise at telemaque:~/tmp/ParentDir/TheDir $ rm Thefile.txt

You should have used 'svn rm' to remove it, not 'rm'.  subversion
still thinks it's under version control.

> malaise at telemaque:~/tmp/ParentDir/TheDir $  svn copy -r10 \
>  file:///home/malaise/SVN/tmp/trunk/ParentDir/TheDir/Thefile.txt \
>  .
> svn: Entry for 'Thefile.txt' exists (though the working file is missing)
>

... which is why this command then fails.  It can't add the file when
it's already under version control.

>
> C: COMMANDS IN PARENT DIR -> OK, BUT NOT WHAT IS DESCRIBED IN THE BOOK
> -------------------------
> malaise at telemaque:~/tmp/ParentDir/TheDir $ cd ..
> malaise at telemaque:~/tmp/ParentDir $  svn copy -r10 \
>  file:///home/malaise/SVN/tmp/trunk/ParentDir/TheDir/Thefile.txt \
>  .
> A         Thefile.txt
>
> malaise at telemaque:~/tmp/ParentDir $ cp Thefile.txt TheDir

You should be using 'svn cp', not 'cp'.  Or is this really what you intended?

> malaise at telemaque:~/tmp/ParentDir $ svn revert Thefile.txt
> Reverted 'Thefile.txt'

OK, you've undone your schedule-addition.

>
> malaise at telemaque:~/tmp/ParentDir $ cd TheDir
> malaise at telemaque:~/tmp/ParentDir/TheDir $ svn status
> M      Thefile.txt

... and you've overwritten the text of the versioned file.  Is this
what you wanted?  It's not clear to me what your goal is.  Do you
simply want to revert the contents of a versioned file to some older
version?  This technique certainly works.  An much easier (and more
common) method is to just do

  svn cat -r REV URL > versionedfile

I don't know how these results are "not what's described in the book",
because you're aren't quoting particular parts of the book here, nor
telling us what your expectations are.




More information about the svnbook-dev mailing list