February 8th, 2007 | 2 MIN READ

Developer Notebook - Eclipse Change Sets

Written by Tom Manning

An often-overlooked feature in Eclipse 3.2 is support for Change Sets in the Team functionality. What are Change Sets, you ask? Well, picture this oft-occurring developer scenario:You're in the middle of working on an import feature (aren't they all?), let's call it FeatureX, happily coding away and hoping to be awarded FeatureImplementorOfTheYear, when suddenly an "emergency issue" is dropped into your lap. You have to drop everything you're working on and attack this Feature Y. But here's the problem: you've modified 20 source files already, and they're not ready to check in! Implementing this "Emergency issue" is going to require modifying another dozen or so files and when it comes time to commit your FeatureY, how do you remember which files were modified for which feature?

Here you have a few possibilities:

  • Checkout a new copy of your branch from CVS/SVN and implement FeatureY on that local copy (not very efficient).
  • Write down or otherwise commit to memory every file you changed for FeatureX and every file for Feature Y, then make sure you only commit the right ones when it's time to do so. (good luck!)
  • Use Eclipse's "Change Set" functionality to "tag" the files for FeatureX and don't worry about them - Eclipse will remember them for you!

Here's how it works:

  1. Before you start work on Feature Y, perform a Synchronize on your Project(s). Select "outgoing mode" and click the little button on the the right of the Synchronize toolbar to enable Change Sets (it's greyed out if you're in "incoming/outgoing mode", and don't even think about using it for "incoming" mode because it will take forever).
  2. Select the files that were modified for FeatureX, then right-click them and select "Add to... New Change Set". In the dialog box that pops up, give the change set a name (say, FeatureX), and if you like, give it a CVS commit message, then press OK.
  3. Notice that Ecliipse has now segregated your Synchronize view to show files that are part of your new Change Set independently of the Project's other changes (if any).

Now you can merrily go about working on Feature Y, content in the knowledge that next time you do a Synchronize, as long as your implementation of FeatureY didn't modify the same files as FeatureX then Eclipse will keep track of which changes belong to which feature.

Change sets aren't perfect, and they're not the right tool in all cases, but sometimes they're just what a time-crunched developer needs.

Share on


Thanks for signing up!

You'll receive a welcome email shortly.

By submitting this you agree with our privacy policy.