Brain90
Brain90

Reputation: 1694

Did "svn delete" also permanently delete file on remote repositories?

I have remote repositories at http://foo.com/svn/myfoo.
I have checkout myfoo repos and do svn delete directoryA/ directoryB/ and commit it.

Did "svn delete" also delete those things permanently on my remote repositories ? Is it possible to recover directoryA/ directoryB/ again in the future ?.

Thank you.

Upvotes: 0

Views: 932

Answers (2)

David W.
David W.

Reputation: 107040

Subversion never permanently deletes anything. It is its greatest power and its greatest weakness. No, Sorry, I'm thinking of some Marvel Comics character.

An svn delete only removes the information from the most current revision of the head of the tree. You can get the information back if you copy it from the revision right before a delete.

First, search for the information deleted via a svn log:

$ svn log -v 
------------------------------------------------------------------------
r2 | david | 2013-07-16 23:14:23 -0400 (Tue, 16 Jul 2013) | 1 line
Changed paths:
   D /trunk/foo

I deleted foo in revision #2. What I'll do is copy it from Revision #1:

$ svn cp -r1 svn://localhost/trunk/foo@1 .
A         foo
[email protected]:~/temp/work/trunk

Now, foo is back. I'll do a commit:

$ svn commit -m"Undeleted 'foo'"

And, now my result:

$ svn log -v
------------------------------------------------------------------------
r3 | david | 2013-07-16 23:17:19 -0400 (Tue, 16 Jul 2013) | 1 line
Changed paths:
   A /trunk/foo (from /trunk/foo:1)

Undeleted 'foo'

So, nothing is permanently deleted. By the way, a reverse merge would have given me a similar result:

$ svn merge -c -2 svn://localhost/trunk/foo

This reverses Change #2 which will undelete foo and undo anything else I did.

Upvotes: 1

Adrian Shum
Adrian Shum

Reputation: 40036

all files are kept in SVN history, and nothing are deleted permanently. (In fact it is quite troublesome if you really want to permanently delete something on SVN).

The way to recover is straight-forward, just do a reverse merge, or copying the deleted files from a older revision.

It is well described in SVN's book

Upvotes: 3

Related Questions