Complete Example Of General Use

    $ mkdir coolware
    $ cd coolware
    $ echo "/* The coolware main program */" > coolware.c
    $ hg init
    $ hg add coolware.c
    $ hg ci -u xed -m "Initial coolness." coolware.c
    $ cd ..
    $ hg clone coolware coolware-dev
    $ cd coolware-dev
    $ echo "/* A very cool program. */" >> coolware.c
    $ hg ci -u xed -m "Writing cool software." coolware.c
    $ cd ../coolware
    $ hg pull ../coolware-dev/
    pulling from ../coolware-dev/
    searching for changes
    adding changesets
    adding manifests
    adding file changes
    added 1 changesets with 1 changes to 1 files
    (run 'hg update' to get a working copy)
    $ cat coolware.c
    /* The coolware main program */
    $ hg up
    1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    $ cat coolware.c
    /* The coolware main program */
    /* A very cool program. */

Cloning A Repository

If a project lives somewhere and you want it somewhere else, this is a possible technique for doing that:

hg clone ssh://xed@xablab.ucsd.edu/../sysadmin/safe/chemmgr/

Note the weird ssh URL format, the host is separated from the path by the path separator (/). Also note that the path is relative to the home directory. In this example, I’m showing how to lift a repository out of someone else’s home directory as an example of how to get around this overly helpful feature.

Updating Changes From Elsewhere

Say you made some changes on a work machine called w and then you came home to a machine called h that you wanted the changes to also be on. First you have to pull the work repository (or you could have pushed before you left).

hg pull ssh://xed@w/path/aproject

But that’s not all. Nothing will seem different. The h repository will now be aware that changes have been made, but to actually apply them to the local repository, you need to update that with:

hg up