You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Evan Easton <ev...@eeaston.com> on 2003/07/01 10:59:45 UTC

Support for undelete from history?

I see from the archive that there's been a fair amount of discussion in the
past over whether to provide an undelete feature, but I haven't been able to
find any clear conclusion to the issue.
 
I'm wondering if there's a simple way to restore a directory that was
deleted in the past.  Right now, the only ways I think I can do this is to:
 
method 1
1) checkout/update to the old revision of the directory's parent dir
2) make a copy of the dir and its contents
3) update my working copy to the HEAD revision
4) drop my copy of the dir [sans .svn dirs?] into place 
5) readd the dir and its contents
 
method 2
1) create a branch/copy of the parent dir containing the removed dir
2) commit 
3) merge the copy to trunk
 
I tried a reverse merge:
    svn -r 218:217 <parentdir>
and it looked like it was going to work.  But unfortunately, in the same
commit, I not only removed the directory by I also removed two files in that
directory.  The reverse merge looks like it'll work to add-back the
directory, but I get 404 errors when svn tries to effectively reverse the
file delete via an add b/c these files don't esit on the server.
 
Any ideas?  Am I missing something obvious?
Thanks,
Evan

RE: Support for undelete from history?

Posted by "eeaston.com" <ev...@eeaston.com>.
> > > -----Original Message-----
> > > From: sussman@collab.net [mailto:sussman@collab.net]
> > > ...
> > > But for the record, the simplest way to "restore" a 
> deleted object is
> > > to just use 'svn cp -r oldrev URL wc'.   This sucks down 
> the deleted
> > > item into the working copy and schedules it for 
> addition-with-history.
> > 
> > Except won't this restore the entire contents of the parent's old 
> > revision rather just undoing the element deletion?
> 
> If revision N deleted a directory, then there is *no* 
> difference between
> 
>   $ svn merge -r N:N-1 URL-to-repos-root .
> 
> and 
> 
>   $ svn cp -r N-1 URL-to-deleted-directory .
> 
> Both things end up doing the exact same thing:  the directory 
> (as it looked in revision N-1) will be copied into your 
> working copy and scheduled for addition-with-history.  
> 
> Isn't this what you want?

Yes, but I was thinking about URL to deleted dir's parent ... see below.

> > BTW, I swear I tried this already...so I tried it again.  If I run 
> > this command on the parent dir using dav, I get the following:
> >   
> >   ...\eeaston> svn cp -r 217 
> > 
> > http://localhost:81/migratedrepo/trunk/casetracker/src/com/eeaston/util
.
> >   svn: Obstructed update
> >   svn: `util' is in the way
> 
> How can 'util' be in the way?  Why does 'util' exist in your working copy?
Wasn't it deleted?

Util is the parent of the directory that I wanted to restore.

I think my problem is primarily that I keep thinking like a long term
clearcase user...to add, remove, or rename elements, you modify the parent
directory, make the changes to its contents, then check it in with any
changes underneath it.  Since I'm pretty new to subversion and not entirely
in the right mindset, when things haven't worked as I expected in directory
operations, I've tried both working on the file in question and it's parent.

I'm all squared away now.  Thanks Philip and Ben.

Evan


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: Support for undelete from history?

Posted by Ben Collins-Sussman <su...@collab.net>.
"eeaston.com" <ev...@eeaston.com> writes:

> > -----Original Message-----
> > From: sussman@collab.net [mailto:sussman@collab.net] 
> > ...
> > But for the record, the simplest way to "restore" a deleted object is
> > to just use 'svn cp -r oldrev URL wc'.   This sucks down the deleted
> > item into the working copy and schedules it for addition-with-history.
> 
> Except won't this restore the entire contents of the parent's old revision
> rather just undoing the element deletion?

If revision N deleted a directory, then there is *no* difference
between

  $ svn merge -r N:N-1 URL-to-repos-root .

and 

  $ svn cp -r N-1 URL-to-deleted-directory .

Both things end up doing the exact same thing:  the directory (as it
looked in revision N-1) will be copied into your working copy and
scheduled for addition-with-history.  

Isn't this what you want?


> BTW, I swear I tried this already...so I tried it again.  If I run this
> command on the parent dir using dav, I get the following:
>   
>   ...\eeaston> svn cp -r 217
> http://localhost:81/migratedrepo/trunk/casetracker/src/com/eeaston/util .
>   svn: Obstructed update
>   svn: `util' is in the way

How can 'util' be in the way?  Why does 'util' exist in your working
copy?  Wasn't it deleted?


> And if I run it on the deleted directory itself using dav, I get the
> following:
> 
>    ...\eeaston>cd util
>    ...\util>svn cp -r 217
> http://localhost:81/migratedrepo/trunk/casetracker/src/com/eeaston/util/xml
> xml
>    svn: RA layer request failed
>    svn: PROPFIND request failed on
> 'http://localhost:81/migratedrepo/trunk/casetracker/src/com/eeaston/util/xml
> '
>    svn: PROPFIND of
> 'http://localhost:81/migratedrepo/trunk/casetracker/src/com/eeaston/util/xml
> ': 404 Not Found (http://localhost:81)
> 
> It turns out that doing the reverse merge with file: URLs works.  This is a
> pretty rare scenario, so I think I can get by doing this for the time being.

This is issue 1370;  it only fails over DAV, as you say.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

RE: Support for undelete from history?

Posted by "eeaston.com" <ev...@eeaston.com>.
> -----Original Message-----
> From: sussman@collab.net [mailto:sussman@collab.net] 
> ...
> But for the record, the simplest way to "restore" a deleted object is
> to just use 'svn cp -r oldrev URL wc'.   This sucks down the deleted
> item into the working copy and schedules it for addition-with-history.

Except won't this restore the entire contents of the parent's old revision
rather just undoing the element deletion?

BTW, I swear I tried this already...so I tried it again.  If I run this
command on the parent dir using dav, I get the following:
  
  ...\eeaston> svn cp -r 217
http://localhost:81/migratedrepo/trunk/casetracker/src/com/eeaston/util .
  svn: Obstructed update
  svn: `util' is in the way

And if I run it on the deleted directory itself using dav, I get the
following:

   ...\eeaston>cd util
   ...\util>svn cp -r 217
http://localhost:81/migratedrepo/trunk/casetracker/src/com/eeaston/util/xml
xml
   svn: RA layer request failed
   svn: PROPFIND request failed on
'http://localhost:81/migratedrepo/trunk/casetracker/src/com/eeaston/util/xml
'
   svn: PROPFIND of
'http://localhost:81/migratedrepo/trunk/casetracker/src/com/eeaston/util/xml
': 404 Not Found (http://localhost:81)

It turns out that doing the reverse merge with file: URLs works.  This is a
pretty rare scenario, so I think I can get by doing this for the time being.
Evan



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org


Re: Support for undelete from history?

Posted by Ben Collins-Sussman <su...@collab.net>.
Philip Martin <ph...@codematters.co.uk> writes:

> Philip Martin <ph...@codematters.co.uk> writes:
> 
> >> I tried a reverse merge:
> >>     svn -r 218:217 <parentdir>
> >> and it looked like it was going to work.  But unfortunately, in the same
> >> commit, I not only removed the directory by I also removed two files in that
> >> directory.  The reverse merge looks like it'll work to add-back the
> >> directory, but I get 404 errors when svn tries to effectively reverse the
> >> file delete via an add b/c these files don't esit on the server.
> >
> > Hmm, that appears to be an ra_dav bug.
> 
> I see now that this is issue 1370.

Yes, we're still looking at this bug.

But for the record, the simplest way to "restore" a deleted object is
to just use 'svn cp -r oldrev URL wc'.   This sucks down the deleted
item into the working copy and schedules it for addition-with-history.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Support for undelete from history?

Posted by Philip Martin <ph...@codematters.co.uk>.
Philip Martin <ph...@codematters.co.uk> writes:

>> I tried a reverse merge:
>>     svn -r 218:217 <parentdir>
>> and it looked like it was going to work.  But unfortunately, in the same
>> commit, I not only removed the directory by I also removed two files in that
>> directory.  The reverse merge looks like it'll work to add-back the
>> directory, but I get 404 errors when svn tries to effectively reverse the
>> file delete via an add b/c these files don't esit on the server.
>
> Hmm, that appears to be an ra_dav bug.

I see now that this is issue 1370.

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: Support for undelete from history?

Posted by Philip Martin <ph...@codematters.co.uk>.
"Evan Easton" <ev...@eeaston.com> writes:

> I'm wondering if there's a simple way to restore a directory that was
> deleted in the past.  Right now, the only ways I think I can do this is to:
[...]  
> method 2
> 1) create a branch/copy of the parent dir containing the removed dir
> 2) commit 
> 3) merge the copy to trunk

That should work.  You could also merge directly into a trunk wc.

> I tried a reverse merge:
>     svn -r 218:217 <parentdir>
> and it looked like it was going to work.  But unfortunately, in the same
> commit, I not only removed the directory by I also removed two files in that
> directory.  The reverse merge looks like it'll work to add-back the
> directory, but I get 404 errors when svn tries to effectively reverse the
> file delete via an add b/c these files don't esit on the server.

Hmm, that appears to be an ra_dav bug.  Using ra_local

svnadmin create repo
svn mkdir -m "" file://`pwd`/repo/foo
svn import -m "" svn-config file://`pwd`/repo/foo/bar
svn rm -m "" file://`pwd`/repo/foo
svn co file://`pwd`/repo wc
svn merge -r3:2 wc wc
A         wc/foo
A  wc/foo/bar

it works, and it also works over ra_svn.  However ra_dav fails

rm -rf wc
svn co http://localhost/repo wc
svn merge -r3:2 wc wc
../svn/subversion/libsvn_ra_dav/util.c:408: (apr_err=175002)
svn: RA layer request failed
svn: PROPFIND request failed on 'http://localhost:8888/obj/repo/foo'
../svn/subversion/libsvn_ra_dav/util.c:81: (apr_err=175002)
svn: PROPFIND of 'http://localhost:8888/obj/repo/foo': 404 Not Found (http://localhost:8888)

-- 
Philip Martin

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org