Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Integrate the Mercurial version control tool with IBM Rational Build Forge

Steps and sample code for creating an adapter

Fan Hu (fanhu@au1.ibm.com), Senior Consultant, IBM
Author1 photo
Fan Hu is a senior consultant for Australian Lab Services, IBM Software Group, with a focus on Rational Build Forge and the IBM Rational Automation Framework for WebSphere software. He has rich experience in build automation.

Summary:  From this article, you will learn how to write an adaptor to integrate the Mercurial distributed version control tool with IBM® Rational® Build Forge® build and release management software, how to parse and extract the detail information into the Bill of Materials, or BOM, and how to determine whether there are new changesets coming.

Date:  30 Aug 2011
Level:  Intermediate PDF:  A4 and Letter (29KB | 6 pages)Get Adobe® Reader®

Activity:  9714 views
Comments:  

What you need to know and do before you start

From this article, you will learn how to write an adaptor to integrate the Mercurial distributed version control tool with IBM® Rational® Build Forge® build and release management software, how to parse and extract the detail information into the Bill of Materials, or BOM, and how to determine whether there are new changesets coming.

Prerequisites

  • For this purpose, we assume that the agent, which will run the adaptor, is running in a Linux or UNIX environment, because you need some command of Linux or UNIX to parse the command.
  • You have made a clone in the server where the Rational Build Forge agent is running

Objective of this example

Using this example, you can get a quick start in integrating Mercurial with Build Forge. And using this example as a template, you can add more features based on it.

This example will connect a project by using a project name, which is passed in as an environment variable and checked if there are new changesets coming. If there are new changesets coming, the adaptor will download them from repository. If there are not, the adaptor will set the flag to "FAILED." It is easy to create a continuous build based on this adaptor.

Environment variables


Table: Variables used in this adaptor example
VariableVariable meaningExample
projects_root The root directory for projects of your Mercurial local clone projects_root=/code/mercurial/projects
project Your project name under whatever you named the projects_root project=testProjectOne
This means that your project is located in:
/code/mercurial/projects/testProjectOne

Use the example

Here is the procedure to use the example:

  1. Download the example code from the Downloads section of this article.
  2. Create an adaptor using this example code, and give it a name, for example MyMercurialAdaptor,
  3. Create a test project.
  4. Integrate the adaptor in either of these two ways:
    1. Use the Create an adaptor link to link the project with the adaptor.
    2. Use the .source command in a step, for example:
      .source MyMercurialAdaptor
  5. Run the project.
    Note:If you are using the adaptor link, don't forget to click the check box for Use adaptor link.

Output of the adaptor

In the adaptor, there are two steps.

  1. Use the hg in command to check whether there is any new changeset coming.
  2. Use the hg pull/hg update command to pull and update the changeset on the local server.

If there is no changeset coming, the adaptor will return "FAIL," but if there is new changeset coming, it will pull and update it. If successful, the adaptor will return a "Successful" response code. If it encounters any problem, it returns "FAIL" code.

After running, the changeset details (such as file name list, author, change date, and description) will be recorded in the Bill of Materials, or BOM.



Download

DescriptionNameSizeDownload method
Simple ProjectmecurialAdaptor.zip1KBHTTP

Information about download methods


Resources

Learn

Get products and technologies

  • Check the Trials and Demos page for Rational software.

  • Evaluate IBM software in the way that suits you best: Download it for a trial, try it online, use it in a cloud environment, or spend a few hours in the SOA Sandbox learning how to implement service-oriented architecture efficiently.

Discuss

About the author

Author1 photo

Fan Hu is a senior consultant for Australian Lab Services, IBM Software Group, with a focus on Rational Build Forge and the IBM Rational Automation Framework for WebSphere software. He has rich experience in build automation.

Report abuse help

Report abuse

Thank you. This entry has been flagged for moderator attention.


Report abuse help

Report abuse

Report abuse submission failed. Please try again later.


developerWorks: Sign in


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

Choose your display name

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


Rate this article

Comments

Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational
ArticleID=754665
ArticleTitle=Integrate the Mercurial version control tool with IBM Rational Build Forge
publish-date=08302011
author1-email=fanhu@au1.ibm.com
author1-email-cc=Author1 cc address

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

For articles in technology zones (such as Java technology, Linux, Open source, XML), Popular tags shows the top tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), Popular tags shows the top tags for just that product zone.

For articles in technology zones (such as Java technology, Linux, Open source, XML), My tags shows your tags for all technology zones. For articles in product zones (such as Info Mgmt, Rational, WebSphere), My tags shows your tags for just that product zone.

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.

Special offers