You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Björn Eriksson <ow...@gmail.com> on 2006/07/18 08:39:38 UTC

Why won't `svn revert` restore directories?

Greetings list,

 `svn help revert` says "... However, it does not restore removed directories."

 Why is that?


 [Btw, the svnbook (nightly) doesn't mention this. It says "svn revert
— Undo all local edits." and "Reverts any local changes to a file or
directory..."]

-- 
//Björnen. owbear(a)gmail.com | bjorn(a)bjornen.nu | http://bjornen.nu

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org


Re: Why won't `svn revert` restore directories?

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Aug 21, 2006, at 14:30, Piotr Przybylak wrote:

> 2006/7/18, Ryan Schmidt wrote:
>
>> If OTOH you did "rm -rf <directory>" then you could not "svn revert
>> <directory>" because the rm -rf also removed the .svn directory with
>> the pristine files.
>
> So what one should do to make local working copy usable again, without
> deleting the whole working copy and checking it out again. In other
> words how can you revert just this deleted directory ?

Just so we're clear: you should not delete a versioned directory  
using "rm -rf <directory>" or equivalent, because Subversion does not  
know that you have done this. You should be using "svn rm  
<directory>" if you want to schedule a directory for removal from  
version control, and if you want to undo that scheduled removal, then  
you "svn revert <directory>" to bring it back.

If you have however used "rm -rf <directory>" and now want it back,  
then "svn revert <directory>" doesn't work, as explained above. In  
fact, if I try it with Subversion 1.3.2, it prints this error message:

Failed to revert '<directory>' -- try updating instead.

So the solution is, as the message states, to "svn up <directory>"  
instead and it'll pull the current version down from the server again.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Why won't `svn revert` restore directories?

Posted by Ryan Schmidt <su...@ryandesign.com>.
On Jul 18, 2006, at 10:39, Björn Eriksson wrote:

> Greetings list,
>
> `svn help revert` says "... However, it does not restore removed  
> directories."
>
> Why is that?
>
>
> [Btw, the svnbook (nightly) doesn't mention this. It says "svn revert
> — Undo all local edits." and "Reverts any local changes to a file or
> directory..."]


In order to revert anything, Subversion needs to get at the pristine  
copy of everything it stashed away in the directory's .svn directory.

If you did "svn rm <directory>" and then wanted to revert that, you  
could, by saying "svn revert <directory>". This works because  
Subversion doesn't actually delete the directory until you commit,  
thus the .svn directory with the pristine files still exists.

If OTOH you did "rm -rf <directory>" then you could not "svn revert  
<directory>" because the rm -rf also removed the .svn directory with  
the pristine files.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org