iESM Project Sofware Repository Guidelines

Forrest M. Hoffman
Updated: March 2, 2010

The iESM Project is using the Mercurial distributed source control managment tool for managing revisions to software source code from multiple developers on the project. This page offers some helpful hints and guidelines for using Mercurial for code development for the iESM Project. Please send questions, comments, suggestions, and corrections to Forrest M. Hoffman (forrest@climatemodeling.org).

Topics

  1. Is Mercurial available for my system and where do I get it?
  2. What do I need to do on my system before using Mercurial to access the iESM software repositories?
  3. How do I get access to the iESM software repositories?
  4. Are there any restrictions on the use or redistribution of software in the repositories?
  5. How do I check out a repository?
  6. How do I commit changes to my local repository?
  7. What should commit messages look like?
  8. How do I push changesets up to the server?
  9. How do I pull changesets down from the server?
  10. How do I create a new development branch?
  11. How do I merge branches, including the default branch?

Discussion


  1. Is Mercurial available for my system and where do I get it?

    Mercurial is a free, distributed source control management tool. It is presently available for Microsoft Window, GNU/Linux, MacOS X, OpenSolaris, and other systems. More information about Mercurial, the software, and installation instructions can be found at http://mercurial.selenic.com/.

    Return to Topics.


  2. What do I need to do on my system before using Mercurial to access the iESM software repositories?

    After installing Mercurial on your system, you should setup your identity and e-mail address. On Unix/Linux, this is accomplished by creating a file called .hgrc in your home directory containing your real name and e-mail address at a minimum. For example,

    File: ~/.hgrc

    [ui]
    username = John Q. Developer <jqdeveloper@biglabs.org>

    where you enter your own name and e-mail address.

    Return to Topics.


  3. How do I get access to the iESM software repositories?

    The iESM software repositories are available at https://www.climatemodeling.org/repos/iesm_software/. Access to the repositories requires use of SSL-encryption and a username and password. If you need a username/password combination for access to the iESM software repositories, contact Forrest M. Hoffman (forrest@climatemodeling.org).

    Return to Topics.


  4. Are there any restrictions on the use or redistribution of software in the repositories?

    Yes there are. Most of the software contained in the iESM repositories are unreleased, development versions of models, including the NCAR Community Climate System Model (CCSM) and the PNNL/JGCRI Global Change Assessment Model (GCAM). Only developers for the iESM project are granted access to the software repositories, and those developers must agree to use the code only for project development purposes. Both CCSM and GCAM have access policies that must be upheld by iESM developers. The CCSM Repository Access Policy is available here. The code cannot be shared with others, exchanged for other code, or used for research outside of the project simulations agreed to by the iESM Principal Investigators. Any violation of these access policies will result in the violator losing all access to the repositories.

    Return to Topics.


  5. How do I check out a repository?

    Simply clone the desired repository listed on the webpage at https://www.climatemodeling.org/repos/iesm_software/. For example, to obtain the GCAM code do the following:


    $ hg clone https://www.climatemodeling.org/repos/iesm_software/gcam1

    Now you have a copy of the entire repository, including all branches and changesets, on your local machine. Changes can be made and those changes can be committed to your local repository as you see fit. Once you are ready to share your changes, pull down the latest version of the repository, update your code to the head of the branch or tip, commit these changes, and push your changesets up to the server.

    Return to Topics.


  6. How do I commit changes to my local repository?

    From any directory within your repository, you can commit changes at any time. This will generate a new changeset in your local repository, but it will not automatically push changesets up to the server. Since other developers or users will not see these changesets until they have been pushed, it is safe to commit changes frequently for more incremental development. In order to push changesets up to the respository server after committing changes, see below. It's always a good idea to pull down any new changesets and update your local code, especially if you are not the only developer making changes on your branch or if you are modifying the tip. For information about about pulling down changesets, see below.

    In order to commit changes to your local repository, simply do the following:


    $ hg commit

    This command should start an editor to allow the developer to enter documentation about his changes. These commit messages should be as descriptive as possible and follow the convention outlined below.

    Return to Topics.


  7. What should commit messages look like?

    When committing code modifications in Mercurial (see above), an editor should start to allow the developer to enter documentation about his changes. These commit messages hould be as descriptive as possible to allow other developers and users understand exactly what changes were made any why. Our convention for commit messages consist of a one-line summary of changes, a blank line, and free-form text describing the details of the changes being committed. This text should be entered above lines of text produced by Mercurial, which should be left in the file when you save it and exit.

    One-line summary of changes → Changed type definition for net primary production (fnpp)
    One blank line →  
    Text describing changes → After discussion with researcher X, it was determined that the variable fnpp
    had the wrong type definition in clmtype.F90. This type was changed to
    real(r8). Tests of this change against Changeset 7cd797461c9a demonstrate
    that this fix resolves Bug #9999.
    Text produced by Mercurial → HG: Enter commit message. Lines beginning with 'HG:' are removed.
    HG: Leave message empty to abort commit.
    HG: --
    HG: user: Forrest Hoffman
    HG: branch 'default'
    HG: changed models/lnd/clm/src/main/clmtype.F90

    Return to Topics.



This Site vi powered Climate and Carbon Cycle Research
Contact: Forrest Hoffman (forrest@climatemodeling.org)
Warnings and Disclaimers