how to restore a locally deleted folder?
Locally deleting a file followed by svn update restores the local copy of that file. However this does not seem to apply to folders. Is there any way to make it work for folders as well?
EDIT: This is what the console output looks like:
C:\svn\Google Project Hosting\xulwin\xulrunnersamples>rmdir /S /Q treeview
C:\svn\Google Project Hosting\xulwin\xulrunnersamples>svn up
D treeview
Updated to revision 50.
EDIT2: I have used svn for over two years now and I never had this error before. But I didn't change any settings. The only thing I can think of was that I created a Local Repository with Tortoise SVN today on my external hard drive to back up some unrelated old stuff. But that should not be the cause of the problem because the behavior occurs both on the local copy from this local repository and my code from Google Project Hosting.
EDIT3: WTF I suddenly can't reproduce the bug anymore. It all works as it should now. But I didn't change anything.
EDIT4: In EDIT1 the file seems to b开发者_JS百科e marked as deleted, but it isn't since the svn commit command did nothing. Neither did Tortoise Check for modifications list anything.
Note: When the problem still occurred, a fully recursive update did restore the folder.
I ran into this problem today with svn 1.5.6.
svn up --force the_dir_path
fixed it for me.
To recreate:
$ svn up
Updated to revision X.
$ rm -rf the_dir_path
$ svn up
D the_dir_path
Updated to revision X.
$ svn up
Updated to revision X.
$ svn up --force the_dir_path
A ....
A ....
Updated to revision X.
You probably want to use the svn revert command rather than going through the process of deleting items and then updating to revert them. Use the -R switch to recursively revert files/directories.
svn help info for revert is as follows
revert: Restore pristine working copy file (undo most local edits).
usage: revert PATH...
Note: this subcommand does not require network access, and resolves
any conflicted states. However, it does not restore removed directories.
Valid options:
--targets ARG : pass contents of file ARG as additional args
-R [--recursive] : descend recursively, same as --depth=infinity
--depth ARG : limit operation by depth ARG ('empty', 'files',
'immediates', or 'infinity')
-q [--quiet] : print nothing, or only summary information
--changelist ARG : operate only on members of changelist ARG
[aliases: --cl]
Global options:
--username ARG : specify a username ARG
--password ARG : specify a password ARG
--no-auth-cache : do not cache authentication tokens
--non-interactive : do no interactive prompting
--trust-server-cert : accept unknown SSL server certificates without
prompting (but only with '--non-interactive')
--config-dir ARG : read user configuration files from directory ARG
--config-option ARG : set user configuration option in the format:
FILE:SECTION:OPTION=[VALUE]
For example:
servers:global:http-library=serf
use svn revert (-R) foldername
to bring it back. you have deleted it using svn rm
and svn up
will not recreate it for you, because it is still marked as deleted
I use for accidentally deleted folder command
SVN UPDATE
on parent folder
svn status|grep ^D|^Ct -c9-|xargs -n1 svn revert
精彩评论