Jake Wilson
Jake Wilson

Reputation: 91193

How to add tags/trunk/branches to established SVN repo?

Lets say you have an established SVN repository with many hundreds of revisions and has been around for upwards of a year. The repository does not have the standard tags, trunk and branches at the top level. Instead it just goes straight into the code.

Is there a way to add in tags, trunk and branches to the repository on the top level without just checking out the entire repository, altering the directory structure and then committing? Is there anyway to add it in recursively so that if you wanted to view a file from a year ago that used to be here:

svn://svn.server.com/myfolder/myfile.txt

instead you would see it here

svn://svn.server.com/trunk/myfolder/myfile.txt

Is this possible? Or do I just have to check everything out, alter the dir structure at the top and commit the whole thing?

Upvotes: 4

Views: 1347

Answers (2)

blahdiblah
blahdiblah

Reputation: 33991

You don't need to check out the repo to manipulate it.

svn mv svn://svn.server.com/myfolder svn://svn.server.com/trunk
svn mkdir svn://svn.server.com/tags svn://svn.server.com/branches

If immediate commits are scary, you might also be interested in svn checkout --depth='immediates' which will checkout only the files and folders in the target directory--not the contents of the folders. Check out the root with --depth=immediates, arrange directory structure as desired, commit.

There isn't a good way to accomplish the recursive change short of rewriting the entire repo's history.

Upvotes: 3

Bill Heller
Bill Heller

Reputation: 250

I believe the only way to do this recursively would to use svnadmin dump, alter the dump file, then import to a clean repo.

Upvotes: 1

Related Questions