Time for action – checking out from EGit and Git

Eclipse's version control system of choice (and indeed, of many sane people's choice) is Git, the canonical distributed version control system for open-source projects. The EGit implementation in Eclipse is bundled by default for almost all of the standard packages, although it doesn't exist in the SDK package. The git command-line client is available for most operating systems and can be downloaded from http://git-scm.com.

  1. It may be necessary to install the Eclipse Git team provider, but most packages of Eclipse come with EGit built in. If not, it can be installed using the Help | Install New Software... menu; select the main Eclipse repository for the release (Neon, Mars, and so on) and search for git. Install the Eclipse Git Team Provider from the Collaboration group:
    Time for action – checking out from EGit and Git
  2. Restart Eclipse to complete the installation process.
  3. Since the org.eclipse.swt projects were imported from a source snapshot in the previous section, they need to be deleted before they can be cloned. Right-click on the org.eclipse.swt projects and choose Delete, including selecting the Delete project contents on disk option.
  4. To check out the SWT project from the Eclipse Git servers, navigate to File | Import… | Projects from Git and click on Next. Choose the Clone URI and then enter http://git.eclipse.org/gitroot/platform/eclipse.platform.swt.git in the URI details at the top:
    Time for action – checking out from EGit and Git
  5. Clicking on Next will then show what branches to check out; typically this will include master, which is the head of the development branch. Select only the master branch and then click on Next:
    Time for action – checking out from EGit and Git
  6. After the project has been cloned, the wizard will prompt to search for projects. Select the org.eclipse.swt project but not the others. When the wizard completes, the project will be in the workspace. There will be some compile errors at this point, which will be fixed in the next section.

What just happened?

The Git support in Eclipse provides a way of cloning repositories to the local disk, and then checking out the projects once the clone is complete. Repositories at Eclipse are available to check out from http://git.eclipse.org/c/ although the GitWeb browser is available at http://git.eclipse.org/c/. There is a Gerrit-based review system that hosts the repositories and reviews at http://git.eclipse.org/r/ as well, which will be covered in a later section in this chapter. There are clones of many Eclipse repositories at GitHub under the https://github.com/eclipse/ organization as well, although not all repositories are mirrored.

Projects at Eclipse are organized in two levels. The top level is generally a high-level partitioning; examples include platform, mylyn, egit, jdt, and pde. The Git repositories are a second level down and often include either the prefix of the project or the prefix excluding the org component.

Plug-ins developed in the same feature are typically co-hosted in the same repository. Each project organizes the layout in a different way, but will often have the name of the plug-in at the top level of the project, or underneath a bundles directory.

When a repository is cloned to the local disk, a copy of the project and all its history are made available. EGit will default to ~/git as the storage location for Git repositories; this can be changed in the Preferences | Team | Git preferences pane in the Default repository folder entry. Each repository can have one actively checked-out branch at a time; this is typically master for ongoing development, but there are branches for the release streams.

Finally, the import wizard searches for the .project entries in order to import them into the workspace.

Note

The Plug-ins view also allows projects to be imported from the repository by choosing Import As | Project from a Repository. If the Manifest contains an Eclipse-SourceReferences header containing a standard scm: Maven repository URL, then the project will automatically be imported from that location.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.250.169