Wednesday, February 10th, 2010
TortoiseHg Usage Introduction (Mercurial on Windows)
I wanted to share a quick introduction to using a Mercurial repository on Windows with TortoiseHg. This assumes someone has already setup the repository on a shared network drive (we’ll call \\Shared\Repo\Project44) and you want to keep up do date with the changes directly in Windows Explorer.
Initial Checkout
- Download and install the latest TortoiseHg at http://bitbucket.org/tortoisehg/stable/downloads/.
- After rebooting, Right-click -> TortoiseHG -> Settings -> Global -> Commit, and set your Username to something. I’m using “Alan Brooks”.
- Right-click -> TortoiseHG -> Clone a Repository.
- Put your
\\Shared\Repo\Project44in “Source Path”. - Click “clone” in the upper left.
- The folder “Project44” on your hard drive is a working copy of all the latest files and also a complete copy of the entire history of the project (a.k.a. the repository in the “.hg” folder). I’ll call this folder your “local repo” for short.
Example Workflow
- Edit some code or files until you get to a point where you’d like to record a small incremental change in your local repo.
- Notice that the files/folders you’ve changed all have little red marks in Windows Explorer.
- Commit to your local repo. Right-click -> HG Commit …, select files to commit, write a checkin comment, then click Commit. This commit will be an atomic action for all the files as a group.
- Sync with the remote repo. Right-click -> TortoiseHG -> Synchronize…, click Pull to get anyone else’s changes. If there are changes, they may need merged before you push. If no changes, click Push to publish your changes to the repo.
- Look at the history. Right-click -> TortoiseHG -> View Changelog.
References
A couple of good things to read to get started with Mercurial are:
- Windows Integration
- The Basics in the Red-Bean Book
