Every months or so, I create a new repository for the development project I work on. But I always tend to forget how to setup the repository, so here’s a quick start quide which I found very helpful and I hope you will too.
1. First of all, we need to create a username file: .hgrc
Include the following text:
1 2 | [ui] username = Your Name <yourname@domain.com> |
Save it under you home folder eg:
1 2 3 | Guillaumes-MacBook-Pro: guillaumepiot$ cat ~/.hgrc [ui] username = Your Name <yourname@domain.com> |
This command should return the content of the file.
2. Go to your project folder
cd /my/folder
Start the repo:
hg init
* You can create a .hgignore file inside the .hg folder (make sure your hidden files are showing). This file will ignore a list of extension for example:
1 2 3 | syntax: glob *.pyc *.txt |
This will ignore Python compiled files and txt files.
3. Add project files to the repo:
1 | hg add |
or
hg addremove (if you set up your ignore file after the init)
4. Commit your work:
1 | hg commit -m 'Explain here the reason of this commit' |
This will create a new commit, the message explained what has been added or modified.
5. Push you work to the repository:
I advice to create a file with default settings for convenience, which will stop you from entering the repo URL each time.
In the .hg folder, create a file called hgrc and put the following:
1 2 | [paths] default-push = ssh://hg@codebasehq.com/vivaaspire/viva-website/hotel_innovation_network.hg<br /><br /> |
Then push:
1 | hg push |
It should be all set now.
This is a very basic startup guide, there’s many things you can do an option but that I recommend you check the Mercurial website: http://mercurial.selenic.com/

