Question

I have a project in Eclipse, MyProject/, that I want to share and import into my SVN repo:

MyProject/
    src/
    dist/
    lib/
    ...etc.

Ultimately, I want to end up with an SVN repo for this project that looks like this:

svn://mySVNrepo/
    MyProject/
        trunk/
            src/
            dist/
            lib/
        branches/
        tags/

But when I right-click MyProject and select Team >> Share, and follow the prompts, I end up with:

svn://mySVNrepo/
    MyProject/
        src/
        dist/
        lib/

So it's: (1) not allowing me to create trunk, branches and tags dirs, and (2) not allowing me to "nest" my imported project into trunk.

I then tried to create the directories manually from the SVN Repo Explorer view, and created:

svn://mySVNrepo/
    MyProject/
        trunk/
        branches/
        tags/

Then, I tried to share my project at:

svn://mySVNrepo/trunk

When I try to run this initial import, I get a warning from Eclipse:

Warning: The specified folder already exists in the repository. If you continue, that folder will be checked out to your local workspace and your project will be connected to this existing location. Do you want to continue?

  • I don't want to overwrite my local copy (that I'm trying to share); it has a lot of work in it!
  • I don't really understand what this warning is telling me, and basically I don't want to mess anything up!

So I ask: is my approach wrong, and if so, how can I commit my project for the first time into a trunk/ subdirectory? And if my approach is correct, then please help me decipher this warning message and advise on what I should do. Thanks in advance!

Was it helpful?

Solution

One approach that would work is to keep your manually created trunk/branches/tags directories in SVN. Check out the empty /trunk into a parallel directory on your local workstation (Let's say directory #2, with your local project as #1). Then copy your project + code from #1 into that /trunk directory and commit to SVN.

Then you can make a 3rd directory locally, and check-out your SVN copy and ensure it compiles/runs properly. If so you can delete the intermediate #1/#2 directories, or keep your initial project as a backup just incase (but it'll be non-versioned). Then continue to use directory #3 as your new SVN monitored workspace.

If I'm unsure how my changes will affect work that I don't want to lose, I try to take an approach like this so the least amount of harm is done to my code if something goes wrong (say with a SVN command/operation I'm unfamiliar with, etc).

OTHER TIPS

  1. From the menu, select Window > Open Perspective > SVN Repository Exploring

  2. Right click your repository > New Project Structure > Single project or multiple projects layout > enter 'MyProject' for the Name. This will create the new project with the /trunk/branches/tags/ project structure.

  3. Once it's created, right click the Project and select Checkout.

  4. 'MyProject' should now be in your Navigator View. From there you can copy your /src /dist and /lib folders into 'My Project' trunk folder.

  5. Right click your Project and select Team > Commit.

EDIT:

You can also try the Subversive plugin for Eclipse. This plugin has an easier way to share your existing projects to svn as a multiple project layout (trunk/branches/tags folder structure).

I posted the steps in a similar thread.

After one hour of trial and error, I just did the following:

  1. Share it to a wrong folder
  2. Go into the SVN explorer and rename the folder (with src etc.) to trunk
  3. Move that trunk to the correct location (e.g. Project/trunk) in svn
  4. Got into the Project Explorer in Eclipse, right click on the project, team, switch and select the new trunk.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top