Keeping multiple projects on the on same CVS branch in Eclipse
So my team is just starting to use branches on our project, and we've run into an organizational issue concerning the way Eclipse/CVS handle branches and projects. My question is this:
Is it possible to ensure that multiple project开发者_JS百科s are always synched to the same branch with CVS in Eclipse?
Here's a simplified scenario:
Two projects: ProjA
and ProjB
, and two branches: Dev
and Release
.
So let's say both projects are synched to Release
in my workspace, and I decided to add a new feature. I only anticipate that this feature will touch ProjA
, so I naively branch only that project to Dev
. So now my workspace is inconsistent.
After a few hours of work, I realize that I need to make a small change to ProjB
, so I pop open the file in question and make my change, forgetting to sync it to Dev
.
Later, after my changes are complete, I commit them. Now, I've just committed the changes in the first project to Dev
, and the changes in the second project to Release
. Woohoo, broken build!
A solution to this problem would either:
- not have let me sync the two projects separately
- not have let me commit to two branches at the same time
Now, in the real world, we have about 30 projects, and a number of developers working on feature branches, many of whom seem destined to use branching to break the build any way possible. I'd like to remove some of those ways.
Is changing vcs an option? Having recently transitioned at my work from cvs to mercurial, I don't think I could go back. I think that any of mercurial, git or bzr would solve those issues.
After much trial and research, it seems that because of the way branches are handled in CVS (that is, on a per-file basis), a scenario like the one I seek is not possible (at least not without some tool special-built to this purpose).
We ended up just going with a soft solution: By changing the color and format of the CVS label decorations in Eclipse to something more striking and isolated, it's much easier to casually identify which branch a project (or file) is synched to.
The Eclipse settings are found at Team > CVS > Label Decorations > Text Decorations
and General > Appearance > Colors and Fonts > Basic > Decoration Color
.
And, of course, implementing some best-practices along the way.
There are two approaches you can take here.
Name your Eclipse projects after the branch they're created. So if you're working on a feature branch for ticket number 123 dealing with ProjA you check out your Eclipse project as ProjA_123 (or ProjA_Dev if you wish). You can call your release branch ProjA_Release.
Alternatively you could maintain separate Eclipse workspaces for each branch.
So long as you have some system to identify which branch your working checkout is from, you should be fine.
精彩评论