Reorganise svn folder structure Tortoise
Asked Answered
O

1

5

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/
Ops answered 19/8, 2013 at 2:52 Comment(3)
What is "Team"? is it a new repository or it created child of "Solution"Icbm
Thanks Olive. Team is a new repository - currently empty. Should I create the new structure within 'solution' and move all project folders into thatOps
Why did you create another repository? You don't mind losing the commit history in the previous repo (though, there are ways to transfer the history over to the new one - not recommended)? I would create the new structure in the current repo and svn move the project folders into that, as you mentioned.Limes
L
11

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's svn move option

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:

Limes answered 20/8, 2013 at 7:53 Comment(5)
Sameer singh that's a clear answer and well explained, thank you.Ops
@Ops Glad to help! :) Please remember to mark this as the answer once you're done with your restructure and don't require any further help.Limes
Thanks. After doing that, I had to do a TortoiseSNV -> Switch... to the new /trunk/ folder on the original projects.Regal
@kannas I'm glad this helped!Limes
@J.A.Cado I added pictures when I first answered the question. Do you not see them?Limes

© 2022 - 2024 — McMap. All rights reserved.