Question

I have an SVN repository named 'Solution' (contains many projects) created without the default trunk, branch etc structure. I'd like to move this to the recommended structure.

I have created the new folder structure on the server where 'Team' is the root containing aforementioned trunk and branches. So should I relocate locally to Team/Trunk or copy locally and Add to the new repo folders? I'd like to maintain history in the process, if possible.

I have read a number of SO posts on this theme, but it seems there are many ways of getting this right or wrong, depending on circumstances.

Also, I'm new to SVN and development in general, hence I need GUI instructions as opposed to command line, please, sorry to be non-developer about it. Doing my best.

Illustration:

(Existing)
    Solution/
            Project folders/

(Proposed)
    Team/
            Trunk/
                 /Project folders
            Branches/
Was it helpful?

Solution

Firstly, you do not need to create an entirely new repo in order to reorganize your projects.

Secondly, if you can, checkout the entirety of your Solution repo somewhere, and create and svn add the branches, tags, trunk folders. Do NOT commit them yet; you will svn move every other folder (the project folders) into trunk and then commit everything in one go.

To illustrate, I created a SampleRepo, checked it out, then svn added and svn committed a few placeholder project folders:

Initial repo folder structure

Then, I created the branches, tags, and trunk folders at the root of the repo checkout, then svn added them using TortoiseSVN:

SVN Add Option in TortoiseSVN

The repo checkout now looks like this:

The repo checkout after adding the branches tags trunk folders

Now, I select all of the project folders, and right-drag them over to the trunk folder, selecting SVN Move versioned item(s) here:

TortoiseSVN

The root of the SampleRepo folder now contains just the branches, tags, and trunk folders. If you right-click any whitespace in the SampleRepo folder, and select TortoiseSVN -> SVN Check for modifications, you should see something like this:

The status of the repo checkout after the svn move

Finally, I right-click any whitespace in the SampleRepo folder, and choose TortoiseSVN -> SVN Commit..., add a commit message, and click OK.

Now, if I right-click any whitespace in the SampleRepo folder -> TortoiseSVN -> SVN Show log I will see this:

The log of the repo

All done!

NB: The reason I asked for a complete checkout of the repo is because then you can minimize the number of commits you'd have to make in order to achieve the restructuring you want. You can perform the restructure server-side using TortoiseSVN's Repo Browser, but then you'd need to commit every folder move, one at a time.

More reading:

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top