kakyo
kakyo

Reputation: 11640

Migrate a regular SVN repo into a trunk-branches-tags folder structure

I have a regular svn repo with this folder structure:

conf
dav
db
hooks
locks

How can I migrate it into the

trunk
branches
tags

structure without losing my history?

Upvotes: 0

Views: 1430

Answers (3)

David W.
David W.

Reputation: 107060

You've got two things confused. The first is the representational of the repository. The second is how the repository is physically structured. No matter what you do, your repository will always have that physical structure.

To really understand your question, you need to show us the representational structure. To do that, run the following command:

 $ svn ls $REPO

Where $REPO is your repository's root URL. For example, how do you checkout a project? Like this?

$ svn checkout http://svn.firstvegibankcorp.com/svn/project

Then $REPO will be http://svn.firstvegibankcorp.com/svn.

Fortunately, you can always use svn mv to move things around. I'll append the exact commands to my answer, but I don't know your current layout.

Assuming no, branches, tags, and trunk directories at all

Let's say people simply checked in files without the setup:

$ shop -s extglob                         # Assuming BASH. No need to do this with Kornshell
$ svn co --depth=immediates $REPO workdir # Checks out first level of the directories
# cd workdir
$ svn mkdir trunk                         # Create the "trunk" directory
$ svn mv !(trunk) trunk                   # Moves all files and directories to under trunk
# svn mkdir branches tags                 # Make the rest of the structure
$ svn commit -m"Creating basic directory structure.  # That's it!

The other way is to do a dump and load of your physical repository. You take your repository down, create a dump, then create a new version with a load. You can specify the --parent-dir parameter:

$ ssh $SVN_REPO_SYSTEM
$ cd /opt/svn_repos
$ svnadmin create new_repo
$ svnadmin dump repo | svnadmin load --parent-dir trunk new_repo

This will take a dump of your physical repository, then immediately load it in to a new repository. All history and revisions will be preserved. However, instead of being in the root of the repository representational structure, they will be under the trunk directory. Users will have to use svn switch to switch the URL of their local working directory to match the new repository structure.

Upvotes: 7

maxim1000
maxim1000

Reputation: 6365

It's very likely that you confuse two very different things:

  • content of SVN repository
  • the way SVN repository is stored on disk

To see content of SVN repository you should use some kind of client. Examples: svn.exe (command-line client), TortoiseSVN (GUI client with integration into Windows Explorer). trunk-branches-tags convention is for repository content.

On disk SVN is usually stored as a set of files and folders (conf, dav, ...), but you should not touch them, SVN will manage that structure. And this structure has no relation to the structure of content.

Upvotes: 1

Volker Seibt
Volker Seibt

Reputation: 1536

Let your repository be http://svn.atyourserver/ with the above subfolders.

Make a svn mkdir http://svn.atyourserver/trunk to create a new folder (you may have to use also the -m-Parameter for a comment).

Do this also for branches and tags.

Then do a svn move http://svn.atyourserver/conf http://svn.atyourserver/trunk. This will move folder (or file) conf to folder trunk, preserving the history because everything is inside the subversion repository.

Do this also for your other folders/files.

Upvotes: 0

Related Questions