I am working on several projects in Eclipse. The projects are checked out from an SVN repository. The projects also depend on each other. Currently, if I want to commit them, I have to mark each project and then call Team -> Commit.
Is it possible to commit everything without selecting particular projects? That's quite annoying. It is especially difficult to remember which projects were changed today and which were not. I tried doing this with working sets but I do not see any option of committing them.
Any ideas?
You can only commit them together if they are all part of the same working copy. If you checked each project out individually via Eclipse, this will not be the case.
Unless there's very tight coupling between the projects, you normally should not be committing multiple projects at once. It's not about making things less convenient to you, but about making your commits smaller, self-contained "units".
Related
I'm currently working on a team project in Java, using Eclipse to commit changes I make to an SVN repository. To make things safer, I actually have two versions of the Project on Eclipse: One on which I work directly, and one into which I'm supposed to copy changes made after testing. The latter is then to be committed and shared with the rest of the team.
I've done some work on the second version of the Project. Now, I want to copy all that into the first version. So, how do I synchronize two Projects on Eclipse? Copy all changes from one onto the other?
If you are using SVN, why are you keeping duplicate copies? SVN does this for you. You check-out (or update, if you already have the project), then make your modifications, test them, and (assuming they test correctly) commit. There is no reason NOT to work directly on your working copy.
If you mess up, you just use SVN to revert your changes to the last good state.
Of course if you are making major changes that could impact the whole application while at the same time doing some work on current tickets you might look into using SVN branches.
I am in the process of moving to Git from SVN. In SVN I had multiple eclipse projects in a single SVN repository that is convenient for browsing projects. I was going to move to having one git repository per eclipse project but EGit suggests doing otherwise.
The guide for EGit suggests putting multiple projects into a single Git repository.
Looking at similar questions such as this suggest one project per repository.
Which approach is best practice and what do people implement?
It depends on how closely-related these projects are. Ask yourself the following questions:
Will they always need to be branched/tagged together?
Will you want to commit over all projects, or does a commit mostly only touch one project?
Does the build system operate on all of them or do they have a boundary there?
If you put them all in one, some things from above will be easier. You will only have to branch/tag/stash/commit in one repository, as opposed to doing it for every repository separately.
But if you need to have e.g. separate release cycles for the projects, then it's necessary to have each project in an independent repository.
Note that you can always split up a repository later, or combine multiple repositories into one again without losing history.
Combining is a bit harder to do than splitting, so I would go for one repository first and see how it goes.
I use 1 repo per project.
Some reasoning:
When you discover you messed up something after several commits, it's much easier to fix when it's just one project. Just think about, you did commits to two other projects and now you need to fix the commit you did on the 3rd project.
As Fedir said, your history and log is much cleaner. It only shows the commits for that project.
It works better with the development workflow I have. I have a master branch for production, develop branch for, well, development, and I create branches to implement features (you can read more about it here: http://blog.avirtualhome.com/development-workflow-using-git/)
When you work in a team, and so "share" the git repo, do the team members really need all the other projects as well?
Just a few thoughts, but what it boils down to: Do what works for you.
I have multiple projects (Eclipse projects) and have tried different things to find out what worked best in terms of actual daily development. Here is what I found and I think that most people would find the same thing if they kept track of the results and analyzed the results objectively.
In short applying the following rules will give the best results:
Make a separate repository for each project group.
Each project group consist of a group of projects that are tightly connected to each other, that should be administered together and that cannot be easily decoupled from each other.
A project group can contain a single project.
A project group that contains multiple projects should be examined to see if some of its projects can be decoupled from each other so it can be split into smaller project groups that are still contain projects that are tightly connected to each other, that should be administered together and that cannot be easily decoupled from each other.
The following guidelines explain this process for determining which projects to put in the same repository in more detail:
If a project is not closely connected to any other project (for example, the project can be opened without other projects being opened and no other projects relies on the project being opened when they are opened) then you should definitely place it in its own repository for the reasons explained in the answers above this one.
If a project is dependent upon other projects or other projects depend upon the project then it comes down to exactly how connected are they upon each other, how well they can be packaged together and how easily can they be decoupled from each other.
A) For example a testing project that contains junit test classes to test the classes of a main project is a case where the two projects are very connected with each other, can easily be packaged together and cannot be easily decoupled from each other. These projects should be placed in the same repository for the reasons explained in part C below.
B) In a case where one project relies on another project to provide some sort of shared resources it really comes down to how well that they can be administered together and how easily that they can be decoupled from each other. For example if the project with the shared resources is relied upon by many projects, then it should be put in its own repository because the other unrelated projects are impacted by changes to the shared source code project. In a case like this, the shared resources project should be decoupled from the dependent projects instead of being directly connected to the dependent projects. (For example, it would be better to create versioned archive files [Jar files with a name like "projectName".1.0.1.0.jar for example] and include a copy of those in each project instead of sharing the resources by linking the projects together.)
C) If the multiple projects are connected, can be easily administered together but cannot be easily decoupled from each other, then it depends upon how tightly connected they are with each other.
I) If the projects are put into one repository, then the projects will be kept in sync with each other in the repository each time there is a commit, which can be a real life saver if the projects are tightly connected. However, this also creates the issues noted in the answers above this one.
II) If the projects are put into separate repositories, then you will have to take care to keep there commits in sync with each other and be sure to include some sort of mechanism to indicate which commits belong to the same sync point across the projects (Perhaps something like including the same sync point number in the comments for the commit of each project when a group of commits is done across the projects.)
III) So in cases like this, it is almost always better to put these projects together into a single repository to reduce the overhead of human effort in syncing the commits and to avoid human error should the commits need to be backed out. The only time that it might be better to place them in separate repositories is when only one of the projects is being changed regularly and the other connected projects are rarely changed.
I think this question is related to one I answered here. basically Git by its nature supports a very fine granular structure when it comes to projects/repositories. I have read and been taught that 1 repository per project is almost always best practice. You lose almost nothing by keeping the projects separate and gain a lot as other have been describing.
Probably, it will be more performant to work with if You will create multiple git repositories.
If You will make a branch, only project's files would be branched, and not all the projects.
Small project it will be faster to analyze, to commit. Operations will take less of time.
The log will be more clear also, You could make more granulated configuration if You will have multiple git repositories.
We're using eclipse and svn. We keep the .project file in version control.
The problem is, if you have more than one checked-out project (e.g. a trunk checkout and a feature branch) and would like them both to be available in Eclipse, you lose, because the .project files are identical and therefore can't both be imported into Eclipse.
What's the right way to deal with this? (I'm mostly having to deal with this in TI's Code Composer v4 which uses an older version of eclipse, but I'm also going to need to do this in the regular Eclipse)
I recommend setting up separate workspaces for working on multiple branches. It is possible to do it all in one workspaces, but it gets awkward in a hurry. Depending on which tooling you use, you may need to close projects from branches you are currently not working on to keep them from interfering.
Since Eclipse3.3, you find bugs like:
Bug 218973
[Import/Export] Import existing projects wizard: can't import two version of same project
Bug 110135
[Import/Export] Import existing projects wizards: enhancements for duplicate projects
Both bugs illustrates that this issue hasn't been fixed yet.
Separate workspaces (like Konstantin advices in his answer) is the best option.
Modifying the .project as described in this thread is not very practical.
I think modifying the .project is a solution if it already checked out.
Another solution is during checkout to define a different name to the project.
Third solution, and the one I use is changing the project name on the source-control when creating a branch.
I also prefer one workspace so that all my preferences are correct and coherent.
I use working sets to separate branches. In the past I was closing and reopening the projects of branches, but window working set is a better approach and most views support it quite good.
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 projects 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.
I have a folder where I keep checked-out version from Aptana Subversive SVN plugin. I have another folder where the checked-out copy from Eclipse resides. Both, Aptana & Eclipse, are using the same repository. Though the repository is the same, but I am using two different working folders. Sometimes I use Eclipse to work with the same set of files in the repository and sometimes I use Aptana.
I want a tool that can synchronize the two working folders automatically. Is there any free tool?
Actually, SVN is the tool to do just that. If you fight SVN, you will run into trouble, because you might not have both working copies updated to the same the same revision, the merge tool messes up the hidden .svn folders and whatnot.
Why do you think you need to manually synchronize those two working copies? If you want to work on both simultaneously without disrupting other's work because you keep checking in half-baked things, consider working on a branch. Doing so, you make use of SVN, which was designed to keep two working copies in sync. If you're done with whatever you're doing, merge that branch into the trunk (or whatever branch you were working at) and throw it away.
If you feel like all this checking in might make your repository become too big, get a bigger disk to store it on. The very first time you or that tool messes up manual merging, it would have payed off. If you're afraid of bumping SVN's revision count without doing actual work, get a grip.
Araxis Merge has automated merge.