2012-03-30

Add existing project to SVN repository with Subclipse

First of all setup an SVN repository.  I'm no expert on this.  I can tell you that if you set up a free one with Codesion, that you will be stepped through the process immediately after you sign up.  I do recall that their setup wizard directed me to the Linux command line a lot;  it didn't seem Windows friendly (fine with me).

You will also need to install Subclipse in Eclipse.  Tigris.org releases it and they have this page with a list of releases and the appropriate url's.  Please read that page carefully, because it is important that you install the right version for your installation.  (In Eclipse everything depends on other things, that's why they call them dependencies...)  Basically, Subclipse installs on top of Subversion, so you might want to read up on this stuff before you break Eclipse.  This is a huge point, because Eclipse breaks very easily;  once you add something to Eclipse it seems near impossible to remove it.  It will SAY it's removed, but elements of it will show up and haunt you like those evil little pac-man ghosts.  So, especially for beginners, I recommend that you do NOT monkey around with your Eclipse installation.  For instance, don't just install plugins to try them out, thinking that you will be able to cleanly remove them.  Nope, they will not remove cleanly.  You will end up having to completely track down every piece of Eclipse and all of its plugins, and associated folders, and references in the .bashrc folder, kill them, chop off their heads, steak them and set them on fire.  Then kill Eclipse (steak it and set it on fire).  And then re-install from scratch and re-install everything you want.  And that still might not work.  Cockroaches kill easier.  So be careful.

Alright then... back to the topic at hand.

Once you've discovered which release of Subclipse you need to install, and have all the dependencies lined up, go to "Help/Install New Software" in Eclipse.

Click the "Add" button on the upper right.  Name it whatever makes sense to you:  "Subclipse 1.6" might be good.  Enter the url in the bottom field.

Now you should be able to select that url listing in the "Work with:" field at the top of the "Available Software" screen.  Click the drop down menu and select it. You may need to wait a minute while Eclipse updates itself.

Then find "Subclipse" and check the box next to it. (This will check all of the boxes under this heading, which is a good idea, because it includes some dependencies like the JavaHL Native Library Adapter, which is required.)  Eclipse will do it's thing, and, if all goes well, you now have Subclipse installed.

Create a project in Eclipse, the usual way.

Right click on the project in Eclipse.  Mouse almost all the way down and select "Team/Share Project..."  Step through the dialog boxes that pop up, entering all the appropriate information.  (You will need your repository information during this process).  It goes like this:

"Team/Share Project..."
select "SVN"
select "Use existing repository location"
select "Use project name as folder name" (you don't HAVE to)
enter the URL into the "URL:" field
(for example: "https://mycompany.svn.cvsdude/project/helloworld"  helloworld being the name of the project we are adding to the SVN repo)
click Finish
You'll get a drop down screen on top of Eclipse talking about the Synchronize view.  I recommend checking the "Remember my decision" box and then clicking "Yes", because we need to go over there and finish the process, before we forget (SVN might bite you if you don't!).

Now you will see the "Synchronize" panel on the left side of Eclipse.  On the upper left of the panel is a little button showing a tiny picture of a 2 ended arrow pointing from a window to a yellow cylinder and back again.  Hover over it.  A tooltip will pop up saying "Synchronize SVN"  It may even actually have in parentheses the name of the project that we just added to the repository.  Right now, the project is added, but the Subclipse plugin and the SVN server are not synchronized.
Click that button.
A busy little dialog will pop up and fill a loading bar.
Finally, hover over a little button on the upper right of the panel.  It is the "Commit All Outgoing Changes... " button.  Click it!
A dialog box appears.  Enter a comment in here.  Try and make it descriptive, because you may want to search for it at a later date and "Commit of Glory" probably won't ring a bell in the future.  For this instance, "First Commit" will suffice.
That should do it.
You'll see the SVN "Checking in" box loading up.  Afterwards, the Synchronize panel will say something like "No changes in 'SVN (/Helloworld)'."

I took some screenies, I'll get them attached later.

3 comments:

  1. Thanks! Arif. I'm not really a professional blogger, I just sort of document what I do as I go and if it looks useful I go ahead and post a blog about it. Hopefully I'm getting better at it. I think a lot of my posts could use some serious editing ( I talk too much ), because I didn't think anyone was reading them. I have realized now that I should make things simpler and more digestible to the public, instead of just griping about stuff that hacked me off and ate up my entire day (week).

    ReplyDelete
  2. Just used this at work, it worked brilliant! Thanks very much!

    ReplyDelete

Let me know what you think!