tags:

views:

635

answers:

4

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 be 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.

+6  A: 

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
tschaible
Deleting a folder followed by an svn update is a handy way of cleaning up junk/temp files inside that folder.
StackedCrooked
And if the folder gets corrupted it's usually faster to simply delete and restore it than trying to repair it.
StackedCrooked
+1  A: 

svn up should restore folders that have been deleted... do you mean svn rm deleted?

Update:

Ah, your output indicates that svn thinks the folder is marked for deletion..

In that case I'd do svn revert treeview

John Weldon
It doesn't seem to work, check my edit.
StackedCrooked
+1  A: 

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

knittl
+1  A: 

I ran into this problem today with svn 1.5.6. svn up --force dir fixed it for me.

To recreate:

$ svn up
Updated to revision X.
$ rm -rf dir
$ svn up
D dir
Updated to revision X.
$ svn up
Updated to revision X.
$ svn up --force dir
A ....
A ....
Updated to revision X.
Bryan Drewery