Difference between revisions of "Mercurial"

From ArchWiki
Jump to: navigation, search
(update templates, see Help:Style)
m (Added note about installing tk for hg view.)
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
[[Category: Development (English)]]
+
[[Category:Version Control System]]
{{i18n|Mercurial}}
+
 
+
 
[http://mercurial.selenic.com/ Mercurial] (commonly referred to as '''hg''') is a distributed version control system written in Python and is similar in many ways to [[Git]], [http://bazaar.canonical.com/ Bazaar] and [http://darcs.net/ darcs].
 
[http://mercurial.selenic.com/ Mercurial] (commonly referred to as '''hg''') is a distributed version control system written in Python and is similar in many ways to [[Git]], [http://bazaar.canonical.com/ Bazaar] and [http://darcs.net/ darcs].
  
 
== Installation ==
 
== Installation ==
Mercurial is available from the standard repositories (see {{Pkg|mercurial}}):
+
[[pacman|Install]] {{Pkg|mercurial}}, available in the [[Official Repositories]].
{{bc|# pacman -S mercurial}}
+
  
 
== Configuration ==
 
== Configuration ==
Line 14: Line 11:
 
To use the graphical browser '''hgk''' aka. '''hg view''', add the following to {{ic|~/.hgrc}} (see [https://bbs.archlinux.org/viewtopic.php?id=31999 forum thread]):
 
To use the graphical browser '''hgk''' aka. '''hg view''', add the following to {{ic|~/.hgrc}} (see [https://bbs.archlinux.org/viewtopic.php?id=31999 forum thread]):
 
{{hc|~/.hgrc|2=[extensions]<br/>hgk=}}
 
{{hc|~/.hgrc|2=[extensions]<br/>hgk=}}
 +
You will need to install {{Pkg|tk}} before running '''hg view''' to avoid the rather cryptic error message:
 +
{{bc|/usr/bin/env: wish: No such file or directory}}
  
 
To remove Mercurial warnings of unverified certificate fingerprints, add the following to {{ic|~/.hgrc}} (see [http://mercurial.selenic.com/wiki/CACertificates Mercurial wiki]):
 
To remove Mercurial warnings of unverified certificate fingerprints, add the following to {{ic|~/.hgrc}} (see [http://mercurial.selenic.com/wiki/CACertificates Mercurial wiki]):
Line 40: Line 39:
 
{{Tip|If you include: syntax: glob at the top of the {{ic|.hgignore}} file, you can easily exclude groups of files from your repository.}}
 
{{Tip|If you include: syntax: glob at the top of the {{ic|.hgignore}} file, you can easily exclude groups of files from your repository.}}
  
== More Resources ==
+
==See also==
 
* [http://hgbook.red-bean.com/read/ Mercurial: The Definitive Guide]
 
* [http://hgbook.red-bean.com/read/ Mercurial: The Definitive Guide]
 
* [http://hginit.com/ hginit.com] - a tutorial by Joel Spolsky
 
* [http://hginit.com/ hginit.com] - a tutorial by Joel Spolsky
 +
* [http://mercurial.aragost.com/kick-start/en/ Mercurial Kick-Start] one more tutorial by Aragost.
 
* [http://bitbucket.org Bitbucket] - free and commercial hosting of mercurial repositories
 
* [http://bitbucket.org Bitbucket] - free and commercial hosting of mercurial repositories
 
* [http://mercurial.intuxication.org/ Intuxication] - free mercurial hosting
 
* [http://mercurial.intuxication.org/ Intuxication] - free mercurial hosting

Revision as of 14:47, 3 August 2012

Mercurial (commonly referred to as hg) is a distributed version control system written in Python and is similar in many ways to Git, Bazaar and darcs.

Installation

Install mercurial, available in the Official Repositories.

Configuration

At the minimum you should configure your username or mercurial will most likely give you an error when trying to commit. Do this by editing ~/.hgrc and adding the following:

~/.hgrc
[ui]
username = John Smith

To use the graphical browser hgk aka. hg view, add the following to ~/.hgrc (see forum thread):

~/.hgrc
[extensions]
hgk=

You will need to install tk before running hg view to avoid the rather cryptic error message:

/usr/bin/env: wish: No such file or directory

To remove Mercurial warnings of unverified certificate fingerprints, add the following to ~/.hgrc (see Mercurial wiki):

~/.hgrc
[web]
cacerts = /etc/ssl/certs/ca-certificates.crt

Usage

All mercurial commands are initiated with the hg prefix. To see a list of some of the common commands, run

$ hg help

You can either work with a pre-existing repository (collection of code or files), or create your own to share.

To work with a pre-existing repository, you must clone it to a directory of your choice:

$ mkdir mercurial
$ cd mercurial
$ hg clone http://hg.serpentine.com/tutorial/

To create you own, change to the directory you wish to share and initiate a mercurial project

$ cd myfiles
$ hg init myfiles

Dotfiles Repo

If you intend on creating a repo of all your ~/. files, you simply initiate the project in your home folder:

$ hg init

It is then just a case of adding the specific files you wish to track:

$ hg add 

You can then create a ~/.hgignore to ensure that only the files you wish to include in the repository are tracked by mercurial.

Tip: If you include: syntax: glob at the top of the .hgignore file, you can easily exclude groups of files from your repository.

See also