URL-s summary:

Web browser: http://hg.sv.gnu.org/hgweb/

Basic commands

  • Checkout with authentication:

    hg clone ssh://login@hg.sv.gnu.org/project
    

    The RSA key fingerprint for hg.sv.gnu.org (as of 2010) is 80:5a:b0:0c:ec:93:66:29:49:7e:04:2b:fd:ba:2c:d5.

  • Checkout with anonymous read-only access:

    hg clone http://hg.sv.gnu.org/hgweb/project
    

Developer setup

Your identity for when you push commits (strongly recommended) editing your user configuration file (\~/.hgrc):

[ui]
username = Your Name Comes Here <you@yourdomain.example.com>

It is also possible to edit per project identity (project/.hg/hgrc).

Developer basic commands

  • Initial push / import:

    mkdir test
    cd test
    hg init
    touch README
    # edit/add other files...
    # Import everything:
    hg add .
    hg commit -m "Initial import"
    
    #  initial publication to Savannah
    hg push ssh://login@hg.sv.gnu.org/project
    

    Note: at this point your repository is not setup to merge _from_ the remote branch when you type 'hg pull'. You can either freshly 'clone' the repository (see "Developer checkout" below), or configure your current repository this way:

    Edit project/.hg/hgrc:

    [paths]
    default = ssh://you@hg.sv.gnu.org/project
    
  • Developer checkout:

    hg clone ssh://login@hg.sv.gnu.org/project
    
  • Commit:

    cd project/
    
    # <edit some_existing_file>
    hg commit -m "I automatically commit modified files"
    
    # <edit some_new_file and something_else>
    hg add some_new_file
    hg commit -m "I only marked some_new_file and other changes for commit"
    
    or
    
    hg commit -A -m "I automatically add new files and commit any other changes"
    
    # <only commit one modified file>
    touch some_existing_file
    hg commit -m "I only commit one file" some_existing_file
    
    # Check your changes with the graphical tool
    hg view
    
    # Check what's going to be pushed
    hg outgoing
    
    # Send everything to Savannah
    hg push
    

Importing from other VCS

Mercurial has a convert extension that supports multiple repository types (CVS, Subversion, GNU Arch, Git, darcs...).

You might get an error if the extension is not activated system-wide. In that case, edit your \~/.hgrc:

[extensions]
hgext.convert =

The conversion tool is the same for all the different repository types (check the convert extension for specific tweaks):

hg convert project
cd project-hg
hg push ssh://login@hg.sv.gnu.org/project
  • CVS conversion will also maintain CVS tags.
  • GNU Arch conversion does not handle multiple branches or version numbers, thus it only works for a given category--branch--version.

Links