## Monday, November 14, 2011

### Source Control with Mercurial and BitBucket

The benefits of source control have been covered in numerous places around the Internet. The reference for Mercurial is available here. We'll simply describe how we manage the process.

## BitBucket

Create a BitBucket account. This will provide you with unlimited storage for your source code.

Create a base folder for your projects.

$HOME/hgdev/org.bitbucket/${username}


The reasoning for the path segments of this layout are:

• hgdev enables us to segregate source control systems {e.g. svndev, gitdev}
• org.bitbucket enables us to segregate hosting providers
• ${username} is your BitBucket username so you can also pull easily from others' repositories We'll refer to this folder as your BitBucket folder (the BitBucket folder under your username). ## New Repositories To work with a new repository: 1. Log onto BitBucket and create the project (e.g. myproject) there. 2. cd into your BitBucket folder. 3. Clone your newly created project hg clone https://${username}@bitbucket.org/\${username}/myproject

Anonymous said...

You may like to mention that there are two common ways to avoid having to enter your bitbucket password each time you push to bitbucket.

One is to include your user-name and password under "paths" in the .hg/hgrc file:

[paths]

The other is to have Mercurial encrypt and save the user-name and password, using the extension:

[extensions]
mercurial_keyring=

Neither is as secure as entering the password each time you push, of course.

Anonymous said...

See http://pypi.python.org/pypi/mercurial_keyring on installing the mercurial_keyring extension.