Just Enough Mercurial
Get started with one of the major distributed version control systems.
WHY
Version control is an essential tool for software development and maintenance. Until recently, Mercurial was the official version control system for Zotonic. It has been switch to Git beginning september 2011.
ASSUMPTIONS
Mercurial will run on both UNIX and Windows system. Installation below assumes that you are loading a Mercurial binary from an apt repository. See references for information on installation from source or yum.
All commands were tested on Ubuntu 11.04.
HOW
How can I install mercurial?
apt-get update apt-get install mercurial
How can I configure mercurial?
Create a file called .hgrc in your home directory, then enter and save:
[ui] username = yourname editor = your_favorite_editor
See also:
hg help config
How can I get a list of commands?
For essential commands
hg
For a full list of commands
hg help
How can I clone a project's source code?
hg clone https://someproject.googlecode.com/hg/ someproject
How can I initialize Mercurial in a directory?
hg init
How can I add all the source files?
hg add
How can I add a file name?
hg add <filename>
hg commit -m “Comment for adding the filename”
How can see what files have been added or changed, but not committed?
hg status
How can I commit a change?
hg commit -m “Description of the change”
How can I undo a change?
hg revert <filename-to-revert>
How can I remove a file?
hg remove <filename>
hg commit -m “Comment for removing the file”
How can I rename a file?
hg rename <filename> <new-filename>
hg commit -m “Comment for above changes”
How can I review additions and changes in this directory?
hg log
TROUBLESHOOTING
There are no troubleshooting steps available for this guide. Please provide any you have learned in the comments below or on the Zotonic Users Group.
REFERENCES
Mercurial
http://mercurial.selenic.com/
Hg – Tips and Tricks
http://mercurial.selenic.com/wiki/TipsAndTricks
Hg Init: a Mercurial tutorial
http://hginit.com/
Version control with Mercurial
http://forums.tigsource.com/index.php?topic=3184.0;wap2
Managing your web site with Mercurial
http://echoreply.us/tuto/mercurial_site_management.html
Submitted: 7/7/11
This page is part of the Zotonic documentation, which is licensed under the Apache License 2.0.