Mercurial Cheat Sheet
See also MercurialEclipse
You can use yum, but it typically will provide a relatively old version
yum install hg
To get a more recent version:
You may wish to previously update/upgrade Python
Install EasyInstall if missing (see Python)
You may need to also install the python-devel package
# yum install python-devel
Install Mercurial with EasyInstall
# easy_install -U mercurial
[root@s20 ~]# hg --version Mercurial Distributed SCM (version 2.6.3) ...
$ sudo apt-get install mercurial
Mac OS X
$ brew install mercurial
Configure a proper email address in ~/.hgrc (Windows C:\Program Files\Mercurial\Mercurial.ini) by adding lines such as the following:
[ui] username = John Doe <email@example.com>
Create new project
cd /path/to/project hg init hg status
- Directory .hg is created
- Files not yet added are shown
hg add hg commit hg status
Files are added to the project
cd /path/to/project hg serve --name project --port 8000
Project can be accessed through
- Remember to open port in firewall and/or router
Send repository or changes to remote server
$ hg push http://remotehost:8000
Once finished, on the remove server:
$ hg update
To allow insecure remote access (from Mercurial FAQ):
4.5. I get an "ssl required" error message when trying to push changes
If you're on a network you trust you can add
[web] allow_push = * push_ssl = false
in your <repository-name>/.hg/hgrc file.
Restore repository from backup
Some issues that may arise:
- some files wrongly reported as changed: if there were no pending commits, just revert the working copy to the repository tip.
symbolic links: backup/restore software may not treat them correctly, e.g., it would copies instead of symlinks. Solution: remove duplicated files&folders & recreate symlinks.
hg addremove : adds any new file and removes any missing one. Useful after renaming files. Shorthand to avoid having to perform a number of individual hg add & hg remove. New/missing files will be shown as a "?" or "!" by hg status.