Google Code + Mercurial Tutorial for Eclipse

January 12, 2010

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 besides Subversion. (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:Uncomitted: your local changes that are waiting to be committed to your local repo.
    Outgoing: changes committed to the local repo, but not pushed to Google Code yet.
    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.

Final words

If you are curious about the more advanced features like branching and tags, just tweet a message to @intland on Twitter, and we will be happy to write more.

Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedIn

Tags:

Aron Gombas

Written by

As Head of Development Áron was passionate to share his experience with others about software development, features and the latest tech trends.

Aron Gombas has written 58 posts for Intland Software.

No comments

Leave a Reply

Your email address will not be published. Required fields are marked *