0

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.

Rvervuurt
  • 8,589
  • 8
  • 39
  • 62

1 Answers1

3

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 :(

Community
  • 1
  • 1
Patrick Quirk
  • 23,334
  • 2
  • 57
  • 88
  • Ok, so it's lost. Thanks for the answer, will try to keep my head on my body next time I delete copies :D – Rvervuurt Feb 08 '16 at 13:36
  • 2
    Yeah, personally I don't think `svn delete` should remove non-committed files from your disk; too many people I think will assume it will just "unschedule" it for addition. – Patrick Quirk Feb 08 '16 at 13:39
  • I would really default to move it to the trash can. Might make an alias for that, to prevent idiocy to take over. – Rvervuurt Feb 08 '16 at 13:44