Tutorial: http://hgbook.red-bean.com/read/
create a new repository in the given directory:
hg init
Making a local copy of a repository:
hg clone http://hg.serpentine.com/tutorial/hello
A tour through history:
hg log
Viewing specific revisions:
hg log -r 3
hg log -r 0272e0d5a517
hg log -r 4:2 (from 2 to 4 revision)
display the latest changeset (HEAD revision):
hg tip
tell what Mercurial knows about the files in the repository:
hg status
review changes:
hg diff
create a new changeset:
hg commit
use the hg pull command to bring changes from remote repository to local (hg pull does not (by default) touch the working directory files):
hg pull [remote repository]
command to tell us what changes the hg pull command would pull into the repository, without actually pulling the changes in:
hg incoming [remote repository]
update working files to latest repository revision:
hg update tip
The hg outgoing command tells us what changes would be pushed into another repository
(it simply lists any changes in the current repository that aren’t in the another repository):
hg outgoing [remote repository]
And the hg push command does the actual push into another repository:
hg push [remote repository]
Make patch from single revision:
hg export 3 > ../changes.diff
or
hg export tip > patch.diff
Apply patch (single revision):
hg import ../changes.diff
Create branch:
hg clone -r mybranchname
List activerepository branches:
hg branches -a
List actual repository branch head revisions:
hg heads
Merge heads:
hg merge
hg commit -m "merge"
Tag version:
hg tag Version-1.0
Init new project:
hg init myproject
Import Subversion repository
(Mercurial will automatically detect the trunk, tags and branches layout that Subversion projects usually use):
hg convert http://python-nose.googlecode.com/svn
To start tracking working files:
hg add
Undo changes that you have made to your working directory:
hg revert
Undo revision:
hg rollback
Undo entire changeset:
hg backout --merge
Finding the source (revision) of a bug:
hg bisect
Repository backup (The -U option doesn't check out a working directory after the clone completes):
hg clone -U myrepo myrepo.bak
Sign code (GPG extension):
hg sign [REVISION]
Check signature:
hg sigcheck REVISION
List signed revisions:
hg sigs