Thursday, July 8, 2010

Google Code and Mercurial Tutorial for Eclipse Users

Google Code and Mercurial Tutorial for Eclipse Users

From: http://blogs.intland.com/main/entry/39

This post is a short introduction to using the Eclipse IDE and the HgEclipse plugin for projects hosted at Google Code Mercurial repositories.

HgEclipse is a free and open source Eclipse plugin that supports the Mercurial Distributed Version Control System right within the IDE, thus making these two a very convenient and efficient toolset for Java and C/C++ development. It is important to note that HgEclipse is absolutely not limited to Google Code's Mercurial repositories, it works with any Mercurial repository. We use Google Code merely because of its immediate availability and easy use.

What is Google Code? It is a popular hosting service for open source projects. It provides revision control, a rudimentary wiki, a basic issue tracker and file downloads. As for revision control, since April 2009 Google Code offers the Mercurial Distributed Version Control System as an option besidesSubversion. (Git is still unsupported by Google Code. If you are a Git user, codeBeamer Managed Repositories is a compelling option for you!)

We recommend watching the guided video first, then reading the explanatory notes below. First, here is the video tutorial. Watch it in full-screen HD:

1 - Installing HgEclipse

You can easily install the plugin with the Eclipse Update Manager. Read here how.

2 - Cloning a repository from Google Code

You start by making a local copy (or clone according to the right DVCS terminology) of the repository hosted at the Google servers, and import that to Eclipse as a new project.

Luckily, HgEclipse offers a dedicated wizard for cloning and it makes the whole process very easy. The only thing you will need is the repository URL that is visible at the Command-line access section, under the Source tab in Google Code. You don't even need to authenticate with user name and password, since the Google Code repositories can be cloned anonymously.

3 - Working locally and committing your changes

You can add, delete and modify files just as you do it without Mercurial. The small grey stars over the regular file icons always indicate the files which have uncommitted changes.

When you decide you want to commit some changes, the most convenient way to do that is switching to the Syncronization View. This view shows three types of changes:

  1. Uncomitted: your local changes that are waiting to be committed to your local repo.
  2. Outgoing: changes committed to the local repo, but not pushed to Google Code yet.
  3. Incoming: changes that were pushed to Google Code by other developers, but are not pulled into your local repo yet.
Accordingly, you can use this view to commit changes to your local repository, push changes up to Google Code or pull changes down from Google Code. For now, just select some changes and commit them.

Don't forget that, unlike in centralized version control systems, at this point these changes are still only in your local repo, and not in Google Code! The distributed approach also has the advantage that you can commit even offline. You need to be online only when pushing to Google Code.

4 - Pushing your changes to Google Code

If you have changes that are worth to be contributed to the Google Code repo, then it's time to push them. This requires you to login to Google Code. Important: to identify yourself, you have to use your Google Code specific password, not your regular Google user account. You can see this password clicking your user name in the web interface, then switching to the Settings tab.

Posted via email from Troy's posterous

No comments:

Post a Comment

Google+