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

Re: How to recover deleted directory in repository?

From: Geoff Hoffman <ghoffman_at_cardinalpath.com>
Date: Sat, 8 Oct 2011 22:45:45 -0700

On Sat, Oct 8, 2011 at 8:38 PM, Xiang Liu <lx_hl_at_yahoo.com.cn> wrote:

> Hi, everybody
>
> I have removed a directory by mistake.
>
> > svn del https://pl3.projectlocker.com/gnwd/notes/svn/a_dir
>
> So, How can I recover it?
>
> Thanks.
> xiang
>

Xiang-

What I would do is pick a new location on your machine and export the parent
directory of where your directory used to be (the svn dir above?) and force
the revision number of the repository to be what it was, when a_dir used to
exist. If your repo is at -r 10 now but the folder existed at -r 9, do
something like:

#> cd /other/dir
#> svn export https://pl3.projectlocker.com/gnwd/notes/svn -r 9 svn
Exported revision 9

now you will have a new svn folder at /other/dir/svn, you can then copy the
a_dir inside there back to your working copy and commit it back to the
repository

cp svn/a_dir /path/to/workingcopy/gnwd/notes/svn/

now if you cd to your working copy dir and do a svn status, you can see
these a_dir files are just a new unversioned directory

#> cd /path/to/workingcopy/gnwd/notes/svn
#> svn add a_dir
A foo.c
A bar.c
etc
#> svn commit -m "Restored a_dir"
Committed revision 11.

Hope that helps -
Received on 2011-10-09 07:46:29 CEST

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

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