Rvervuurt
Rvervuurt

Reputation: 8963

Where do deleted files go in SVN?

I just removed some files by using svn --force delete path/folder copy. However, the space between folder and copy made it think it had to delete multiple things, so now it removed my original folder.

I hadn't versioned my original folder yet, so all changes are gone. Luckily, I didn't change a lot in that specific folder, so this is mostly for future use if I end up doing the same stupid thing: How do I revert or restore files that have not been committed before? Where do I find these files? They did not get moved to my trash can.

Upvotes: 0

Views: 453

Answers (1)

Patrick Quirk
Patrick Quirk

Reputation: 23747

They are deleted, pure and simple. Unfortunately, the documentation for the delete command only says this:

Files (and directories that have not been committed) are immediately removed from the working copy unless the --keep-local option is given.

For proof, we have to look waaaay down in the SVN source, where svn_io_remove_file2 eventually calls apr_file_remove, which:

  • if you're on Windows invokes DeleteFile. This method just deletes the file; if the programmers wanted to send it to the Recycle Bin, they'd instead have to use SHFileOperation and pass it the FOF_ALLOWUNDO flag.
  • if you're on *nix (includes Mac OS), invokes unlink, which does the following:

    ... the file is deleted and the space it was using is made available for reuse

Note: I'd do a deeper link to points in the code, but the web-accessible SVN and APR repositories don't allow line-level linking :(

Upvotes: 3

Related Questions