[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Subversion 0.7 released.

From: <cmpilato_at_collab.net>
Date: 2001-12-05 04:14:22 CET

Philip Martin <pmartin@uklinux.net> writes:

> So how does one restore deleted items using the command line client?
>
> Given
>
> $ svn co file:///home/pm/repo -d wc
> $ cd wc
> $ svn rm foo
> D foo
> $ svn ci
> Deleting /home/pm/wc/foo
> Commit succeeded.
> $ svn up
>
> how do I restore the file foo?
>
> The only way I have found is to update to a revision that includes
> foo, 'svn copy' it to some temporary name, commit it, update and then
> 'svn move' it back to its original name; the commit in the middle
> makes this unacceptable. Can I 'svn copy' directly from the file's
> repository URL, and what does that look like?

Yes, copy is the solution. Let's do a play by play, annotated with
revision numbers.

Say the repository is at revision 5.

> $ svn co file:///home/pm/repo -d wc

Now you have a working copy at revision 5.

> $ cd wc
> $ svn rm foo
> D foo
> $ svn ci
> Deleting /home/pm/wc/foo
> Commit succeeded.

Okay, now the repo is at revision 6, your working copy still at 5.

> $ svn up

Fine, then. So you want your working copy at version 6. I'm cool
with that.

Now, you realize, "Oh, poop. I really shouldn't have done that. The
file 'foo' was my girlfriend's favorite, and she is gonna be soooooo
upset that I've deleted it."

Never fear, 'svn copy --salvage-relationship' is here.

   svn copy -r 5 file:///home/pm/repo/foo .

This should basically download revision 5 of foo into your working
copy, and schedule it for addition as a copy of ... well, itself (foo
at revision 5). Then you commit this addition, and *poof* you have
your old file back.

Now...I'm seeing some bugs as I try to prove this to myself.
Wondering if Karl and Ben know of any outstanding issues with this
implementation...but in theory! Yeah, in theory! :-/

Actually, it did work for me, but I just came across some bugs that
occur when you 'svn up' at just the wrong time in the process.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Oct 21 14:36:51 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.