tags:

views:

100

answers:

4

I have a large project but I need only some folders in my svn repository.

Now these are the first two levels of my projects structure

folder_1
    subfolder_1.1
    subfolder_1.2
folder_2
    subfolder_2.1
    subfolder_2.2
    subfolder_2.3
folder_3
    subfolder_3.1
    subfolder_3.2

I only need

folder_1
    subfolder_1.1
folder_3
    subfolder_3.2

and their subfolders of course under version control.

How do I import only these folders in the new created svn repository?
How do I ignore changes in any other folder on future commits?

Thanks in advance for any hint, step by step instructions greatly appreciated as I am not really experienced in handling svn administration.


EDIT: To clarify what I need to do: create a new repository (already done), import the folders as above, check them out using a svn client (no big deal) and make sure that files from other folders that are not under version vontrol (e. g. stuff from folder_2) are ignored by SVN on commit.

+3  A: 

First of all, the only things that will be committed to Subversion are those which you explicitly add to tracking - so just only add the folders you want tracked. The rest can exist in your working copy without being in Subversion's tracked list.

If you don't want Subversion tools to prompt you about potentially adding other folders, you can force it to completely ignore them by setting the svn-ignore property to exclude those paths.

Amber
+1  A: 

Try using TortoiseSVN to do this, but you should add first subfolder_1.1, than right-click on subfolder_2 and TortoiseSVN > Add to Ignore List > subfolder_2 and only after that add folder_1 to SVN. Same for the rest of folders/sub-folders, the idea is to exclude the subfolders you're not interested in, you could probably do this by command line as well.

Billy
A: 

You have two options, depending on what you are exactly going to do with the previous code:

  • export (and not check out!) the existing directory into a fresh local directory structure that you can import into the new repository
  • link the new repository to the previous one.

1) Use the following commands for the first option:

mkdir project
cd project
svn export <URL old project>/folder_1 folder_1
svn export <URL old project>/folder_3 folder_3
svn mkdir <URL new project>/trunk -m "Initial trunk"
svn import <URL new project>/trunk -m "Initial files"

Which will create the /trunk directory in your repository and put the two folders in it.

Then you need to check out your project somewhere to start working on your local copy. The "project" directory created above was temporary and can be removed.

2) The second option is only useful if you don't need to touch the existing code but use it with your new project. You could have the following structure:

folder_1 (link to your old repository)
    subfolder_1.1
folder_3 (link to your old repository)
    subfolder_3.2
new_folder

To do that, check how the svn:externals properties work in the documentation, it's longer to explain and it doesn't look like the solution you want, so I'll just mention the possibility.


Edit: I left out the ignore part, but it has been answered by Dav already. Know that there is the possibility to tell SVN to ignore all files with defined extensions, for all your projects on a workstation, this is described in the documentation I gave the link to.

RedGlyph
A: 

If you want to have only a subset of your repository in other repository - simply checkout selected stuff from repository1, and check it into repository2. If you want repository2 to be in sync with repository1 - it's achievable using svnsync, but the repository2 will be read-only then. If you want repository2 to be in sync with repository1, and still commit to repository2 - it's not achievable with subversion

Bolek Tekielski