Questions about egit and github/travis - eclipse

i'm a beginner java developer, i need to use eclipse and i have some questions about eclipse/github/egit/jgit/travis.
I need to get the commits made on a repository in github. I found on the internet that this is possible with both jgit and egit and more in depth that egit uses jgit. My first question is: are jgit and egit functionally equivalent? (all i can do with egit i can do it with jgit and vice versa)?
To get the date of a commit with egit I have to write something like commit.getAuthor().getDate(), why does this work? That is, commit.getAuthor() returns an instance of the class CommitUser, why a method of the class CommitUser returns the commit date? shouldn't getDate() be a method of the class Commit?
My project must be loaded into a repository managed through SVN and on which I will have to use the tools travis and sonarcloud. My question is: how does the management of external jars added to the project take place when I use travis and sonarcloud? Will I get errors? How should I handle them?

JGit is a Java implementation of Git and used by EGit (= Eclipse IDE Git support) and other Java applications and frameworks, e.g. by Gerrit.
That's JGit, not EGit. A commit has two dates, the authored date (when it was committed) and the committed date (when it was pushed).
In a plain Java application JGit can be used as Maven dependency, the Eclipse IDE is not required to build your application.

Related

How do EGit versions map to Git versions

The Git Source Code Mirror on GitHub (https://github.com/git/git) says that the most recent version of Git is 2.7.4. I'm using EGit 3.5.2 on Spring Tool Suite (Eclipse Luna SR1), so that version number obviously doesn't correspond to a Git version. Is there any way to trace back what version of Git this version of EGit is based off of?
I checked here, but it only maps versions of EGit to versions of Eclipse...
https://wiki.eclipse.org/EGit/FAQ#What_is_Git.3F
As you noticed, EGit does not appear to be based on a particular version of Git. The EGit documentation has the following to say:
How compatible is EGit with Git?
Some, but not all configuration options/features in Git are available in EGit/JGit. Here is a summary, not yet complete describing some of these, including notable differences. Note that the set of EGit/JGit is not based off a particular Git version.
Practically speaking, as long as you are using the most recent version of Git, you should be OK. This is because Git itself should be backwards-compatible with whatever version of Git was concurrent with the particular release of EGit which you are using. But I would not recommend the other way around, e.g. using the first release of Git from many years ago with the latest EGit plugin.
There is no correlation between EGit and Git versions. EGit uses JGit, a pure Java implementation of the Git VCS, to access repositories. JGit versions do not follow a specific Git versions either. Though JGit is relatively on par with Git, some things are missing, for example git clone -- depth. Unfortunately, a detailed comparison does not exist

Comparing different versions of a Java project

I am not an experienced Java developer and I am currently modifying and re-building a plugin project. I am about to adopt a versioning control system (e.g. Subclipse), however I already have several versions of such project. My intention is that to check how these versions differs from each other and I was wondering what is the best approach into this. I work with Eclipse IDE.
Thank indeed,
I.
Subclipse just connects Eclipse with a Subversion repository. You have to have a Subversion repository somewhere for Subclipse to work.
Assuming you have a Subversion repository, you commit the oldest version first. You create a Eclipse workspace on you computer that you'll use to communicate with Subversion. First, you copy the oldest version of your project into the Eclipse workspace. Then you commit the workspace. You update your workspace by copying each saved version to your Eclipse workspace in turn, and commit.
That way, the source control will be able to show you the differences between each saved version.
Ctrl click on the root of the two projects, Right click, then Compare With -> Each Other
Pro tip: use a better source control system than svn, like Bazaar, Git, or Mercurial

Git, SVN and Eclipse workflow

I am trying to adopt the following workflow:
git svn clone a svn repository through command line (egit doesn't support git-svn)
Open the project in eclipse with egit since I rather use egit to branch, merge, commit etc...
When i'm ready commit the changes back, I use use git svn dcommit to commit back to svn
I am having trouble with step number 2, don't understand how to import a git project, eclipse tells me i can't import it to use the same directory it's currently in because another project with the same name is already there. this is confusing.
Anyone knows how to do this ?
Also would like to hear other workflow examples that uses egit and git svn. I am aware that it is better to do it all through command line, however, I am trying to ease the move to git for fellow developers in my team, who are not used to command line interface etc...
I've worked briefly with the egit plugin (I actually recently stopped using it and just use msysgit as my Git guiclient and run it separately from Eclipse). I find Eclipse very busy as is and adding this plugin slows it down (for me at least).
What I did when setting up an already cloned project in Eclipse:
In Eclipse. File -> Import -> Existing Project into Workspace
Select root directory of project. Do NOT check copy projects into workspace. Click finish.
After project has been imported. Right click on project, go to Team -> Share Project
Select Git as a repo type, click next
Check use or create repo in parent folder of project. Since you already cloned the project it will be tracked with git. When you check this option it will show the project, the path, and the repo (.git).
Click finish and you will be all set.
I think you'd better use SubGit instead of git-svn.
SubGit works on a server side. It synchronizes all the modification between Subversion and Git repositories automatically on every incoming modification from either side.
From the client perspective SubGit enabled repository is a usual Git repository, so you may pull from and push to it. Please refer to SubGit documentation or SubGit vs. git-svn comparison for more details.

Working with several repositories at the same time with Subversive in Eclipse

I would like to use two svn repositories. One is to synchronize with my production environment and the other is to synchronize with another developer. Is it possible using Subversive in Eclipse?
EDIT: Sorry! I meant SVN, not CVS
I think what you means is "For one given project, I would like to be able to synchronise on one side with the official repo and at the same time, use the synchronisation and merging facilities to stay i sync with another CVS repository".
Best of my knowledge, this is not possible from the same project. Neither with CVS nor with subversion nor with any other SCM. This is a little bit because all SCM plugins are actually plugged into the Team Management plugins of eclipse and has actually a lot to do with the fact that the relation between a dev environment and a repository is quite exclusive.
What you have to do if you want to synchronize on an exceptional basis is :
Disconnect from one repo (say CVS) (team disconnect). Do not delete the .cvs folders.
Reconnect to a second repo (say SVN - either subversive or subclipse <= my preferred one)
Synch with SVN
disconnect from SVN
reconnect with CVS (team => share).
This is too risky to be done on a regular basis.
Therefore there are other strategies
Use a "shadow project" in your workspace synchronised through a regular synchronisation tool. The master project being connected to the CVS repo and the shadow to VN.
Use git + SVN. git as your local repo backed by SVN. The other developer can use a similar approach.
All in all there are no simple "out of the box" solution. All these solutions require a significant amount of commitment to work flawlessly. But SCM has always been like this, I guess.
Subversive adds Subversion
integration for Eclipse (subversion
is a version control system similar
to CVS). It does not handle CVS
repositories!!!
To use CVS repositories with eclipse
you should use the appropriate CVS
Plugin for eclipse.
You may even use both eclipse plugins (subversive and the cvs plugin). They will work with Eclipse like a charm (but keep in mind that subversive only handles subversion repositories).
Yes its possible to use Subversive in Eclipse. I am using Subversion and CVS both through Eclipse and Tortoise. Subversion is much faster and seems to handle binary files better. The one thing to get your head around is that revision numbering is totally different between subversion and cvs. May be this can help you.
Hope this helps.

Checking out a project on github with the Eclipse CVS client?

I am playing with my eclipse cvs functionality (on my windows box), is there a way to check out a project hosted on github?
Anyone shows me a pointer? Thanks,
Not with the CVS client. You need to install git for Windows or a git plugin for Eclipse.
CVS and git are two different source code version control systems. Other popular choices are Subversion or Mercurial. You have to use different clients or Eclipse plugins for each of them.
Use EGit, which provides Git support as part of Eclipse and is available in both the latest Helios builds as well as the upcoming Indigo release.