How to commit existing project to SVN with Eclipse Subclipse?
Asked Answered
I

1

12

I have an existing Java project in Eclipse:

MyProject/
    src/
        ... all main sources
    test/
        ... all test sources
    build.xml
    ... lots of other stuff

I now want to add this project (commit all of it) to the empty trunk/ of a new SVN repo:

https://svn.example.com/MyProject/
    trunk/
        (Empty)

So that, after the commit, the repo now looks like:

https://svn.example.com/MyProject/
    trunk/
        src/
            ... all main sources
        test/
            ... all test sources
        build.xml
        ... lots of other stuff

I installed the Subclipse plugin.

In Package Explorer, I:

  1. Right-click MyProject/
  2. Team >> Share Project >> SVN >> https://svn.example.com/MyProject
  3. Use specified folder name of "trunk" so that the URL is now https://svn.example.com/MyProject/trunk
  4. Click "Finish"

When I do this, instead of committing all my source code (contained in MyProject) to the trunk/ in the repo, it overwrites (thus a checkout) MyProject/ with an empty directory!

Thus, Share Project seems to be for checking out code from a repo, not committing new code into a repo for the first time!

How do I accomplish such an initial commit with the Subclipse plugin and/or Eclipse's Team features?

Innuendo answered 18/6, 2013 at 21:40 Comment(0)
R
5

Share Project is the right option. However, you should let it create the trunk folder. What the process will do is run the svn mkdir command to create the trunk folder. It will then checkout that empty folder into your project (which does not impact your content at all). At this point, you now have a working copy which is the critical part. Obviously all of your project content still needs to be added. At this point your content will show as Unversioned. The process will launch the synchronize option to give you a chance to do this, though you can also just do it via the Team > menu option. You need to use Add to Version Control for everything you want to add, and then ultimately commit it. You can also choose to ignore some items if you want to be sure they are never committed.

Rhodarhodamine answered 21/6, 2013 at 19:4 Comment(2)
Following this process did not create a trunk folder for me.Luthanen
What I meant by that is do not create the trunk folder yourself manually prior to doing the Share. When you Share, it is still up to you to type in "trunk" as the name of the location you would be sharing it to. I think it puts your project name in as the default.Rhodarhodamine

© 2022 - 2024 — McMap. All rights reserved.