views:

115

answers:

2

Is there any plugin in eclipse, so that when ever I created new java file it will be added to SVN. Though I am doing an SVN add immediately after creating a java file, I am forgetting it many times, which is causing problems. We have lot of un-versioned files, so when committing it is not easy to look through the un-versioned files to find out these missed files.

It would be great if there is a checkbox for this in the "Create New Class" dialog box itself.

+3  A: 

There is an open source Eclipse plug-in called Subclipse which adds support for Subversion to Eclipse which may help you a little by integrating SVN with eclipse.

Obtaining & Installing Subclipse

  1. Eclipse plug-ins are downloaded and installed from within Eclipse. Open Eclipse on your machine (it does not matter which workspace you open).

  2. From the Help menu select Install New Software…

  3. In the resulting Install dialog enter http://subclipse.tigris.org/update_1.6.x as the site address and click the Add… button.

  4. Enter a Name for the site like Subclipse

  5. The new name you chose will show up in your list of sites. Ensure it is the only entry checked and then click Finish.

  6. Expand the Subclipse entry which shows up in the window that pops up. Place a checkmark next to the Subclipse (required), Subversion Client Adapter (required), JavaHL Native Library Adapter (required), and the SVNKit Client Adapter (optional) sub-entries under the URL and click the Next button.

  7. Click Next

  8. Accept the license and then click Finish. Eclipse will now download and install the Subclipse plug-in from the project’s server.

  9. You may receive a warning about unsigned features, if you do choose OK to continue the installation.

  10. Once the install is complete you will be asked if you want to restart Eclipse, choose Yes.

Using Subclipse is like using the default Eclipse CVS client. There are a large number of walkthroughs and manuals available online. A Google search for ‘how to use subclipse’ is a good place to start.

Edit: As pointed out by a very helpful commenter Lombo you can also auto add files to SVN when you use Team -> Commit on your project, I was not aware of that function, thankyou!

Edit: If you want to know more about SVN check out this link from IBM. They have a section that deals with ignoring files which you may be able to bend to your needs of not auto-adding certain files. I think the Team > Add to svn:ignore functionality may be as close as you can get without playing with the command line SVN.

JonVD
You should also add that subclipse "svn adds" your files by default when you chose Team -> Commit on your project. That was what the OP was looking for. Your answer is not complete.
Lombo
I have subclipse already installed. But, what I wanted is I should be able to add a new java file to SVN in one click instead of first creating a new file and then adding it to SVN by clicking on Team > Add to version control.
Reddy
@Lombo, can we configure it to just add java files automatically?
Reddy
I've updated my answer to incorporate that functionality as was pointed out above. Does that solve your problem? If not there is a command-line alternative but that can be a bit tricker. The above solution will now add files automatically as you create them.
JonVD
hmmm ... thanks JonVD, will give it a try and check.
Reddy
thanks JonVD, when I right click on Team, option 'Add to svn:ignore' is not enabled. However it seems more like single file operation. However I found Window > Preferences > Team > Ignored Resources which is very close, but not exactly what I needed.
Reddy
@Lombo, I couldn't find out any option for automatically adding files to SVN.
Reddy
A: 

Since it seems that this behaviour is not exist, I have filed an enhancement ticket for subclipse. http://subclipse.tigris.org/issues/show_bug.cgi?id=1197

Reddy