Quantcast
Channel: Kevin LaBranche
Viewing all articles
Browse latest Browse all 20

Mercurial for a small team series–Mercurial or Git

$
0
0

This is the first in the series Getting started with Mercurial for a small team.

Distributed Version Control Systems (DVCS)

DVCS offer many advantages over traditional systems such as Subversion. Most agree that branching and merging are much easier, the operations are usually much faster and the reason I like the most – their distributed.

Distributed

Every developer has a copy of the repository on their drive and can work on this copy however they like. This results in much faster operations as well as a new freedom for a developer to work on code locally WITH source control operations and not having to worry about what it is doing to the server version or other users. Commit 50 times, add two branches, delete a branch, etc.... No more having to worry about checking in to the central server. Work how you need to complete the task with local source control support! When your ready you can get an update for the "central" server and check your work/build locally. Then commit and since merging is so much more powerful and intelligent this isn't as scary as before. A developer can get your changes from the central repository OR EVEN YOUR repo (if setup) when they want to their repository.

Trust me, I'm not giving it enough justice. DCVS is here to stay and is the only way moving forward. Now it comes down to currently two really great choices.

Mercurial vs. Git

Both are great, so why Mercurial? My decision came down to three reasons.

  1. Mercurial has better tooling on Windows. I am sure Git will change this but today this is the case.
    • As of this week, Git released a Windows client. This may change the game but I haven’t had a look at it yet.
  2. Mercurial is a little simpler to use. Think of Mercurial as less options but not hobbled and Git as the option full, can easily shoot yourself if you don't know what you are doing option.

They both are great!!!! In fact I recommend a developer learn both. #3 is listed below.

Bitbucket vs. Github vs. Self-Hosting

The final reason for Mercurial is not based on Mercurial. The cloud hosting service Bitbucket offers a free plan that includes unlimited private repositories for up to five users. Github offers free to open source.

Bitbucket offers both Mercurial and Git hosting so choosing which DVCS is a little easier as it can be changed fairly easily. Bitbucket offers repo conversion tools as well.

Self-Hosting? - Yes, it's possible but setting up a Mercurial server at this time seemed more work and maintenance than it's worth compared to cloud hosting.

Here’s a few more examples of others who use Mercurial.

http://wildermuth.com/2012/03/06/Modern_Web_Development_-_Part_7

http://www.headspring.com/2012/03/migrating-from-bitbucket-to-github (Using both)

The team making stack exchange (stack overflow sites) also use Mercurial and have created a terrific tutorial.

Security with the Cloud

Worried about your source? Bitbucket is secured by HTTPS and requires a login with access to the repositories and / or SSH Keys per machine accessing the repository. A repository is owned by an account and that account can grant access to other accounts. Ownership of a repository can be transferred to another but only by contacting Bitbucket support.

While this is secure, dillegence in coding & backup practices should still be followed such as avoiding storing passwords where possible and backing up our source.

Secure Code

Storing the connection string in the clear in the web.config is a risk that can be mitigated. You can encrypt your connection string information and other sections that might contain sensitive information. You could have a connection string configuration file on each machine/server you use at a specified location and just have your web.config point to it to keep it completely out of source control.

Backup

Relying solely on any cloud vendor as your source code backup strategy is a nightmare waiting to happen. The cloud never goes down or looses data. Don't kid yourself. Don't play the fool and leave it all up to the cloud.

Going down for a little while using a DVCS is not that big of a deal. You can keep working and there are ways to get work from another peer box (hg serve).

DVCS being distributed by nature can make small outages very tenable. When you pull down a repo from the "central" repo, which in DVCS can change but for our purposes will always be considered Bitbucket, you are getting the entire repo UNLESS you purposefully choose different. This means your local repo is a copy/backup. That does not mean you should entirely rely on this in a disaster BUT it is an extra layer.

I recommend backing up the Bitbucket repositories on a regular interval and store them elsewhere.

Currently, there are two ways to do this.

  1. Log into bitbucket and download the source for each repo in a zip file. This has one major drawback. The zipped version will not include any version control history.
  2. Use https://bitbucket.org/christianspecht/bitbucket-backup script. This script will download all repo's with version information. The script is actually cloning all repo's to a destination directory. The script requires Mercurial to be installed on the machine running it and login information.

The next in the series is Installing and basic configuration of Mercurial.


Viewing all articles
Browse latest Browse all 20

Trending Articles