Difference between revisions of "Mercurial"

From ArchWiki
Jump to: navigation, search
m (Configuration)
(update templates, see Help:Style)
Line 1: Line 1:
 
[[Category: Development (English)]]
 
[[Category: Development (English)]]
 +
{{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 {{Package Official|mercurial}}):
+
Mercurial is available from the standard repositories (see {{Pkg|mercurial}}):
{{Cli|# pacman -S mercurial}}
+
{{bc|# pacman -S mercurial}}
  
 
== Configuration ==
 
== 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 {{filename|~/.hgrc}} and adding the following:
+
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 {{ic|~/.hgrc}} and adding the following:
{{file|~/.hgrc|content=[ui]<br/>username = John Smith}}
+
{{hc|~/.hgrc|2=[ui]<br/>username = John Smith}}
  
 +
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=}}
  
To use the graphical browser '''hgk''' aka. '''hg view''', add the following to {{filename|~/.hgrc}} (see [https://bbs.archlinux.org/viewtopic.php?id=31999 forum thread]):
+
To remove Mercurial warnings of unverified certificate fingerprints, add the following to {{ic|~/.hgrc}} (see [http://mercurial.selenic.com/wiki/CACertificates Mercurial wiki]):
{{file|~/.hgrc|content=[extensions]<br/>hgk=}}
+
{{hc|~/.hgrc|2=[web]<br/>cacerts = /etc/ssl/certs/ca-certificates.crt}}
 
+
 
+
To remove Mercurial warnings of unverified certificate fingerprints, add the following to {{filename|~/.hgrc}} (see [http://mercurial.selenic.com/wiki/CACertificates Mercurial wiki]):
+
{{file|~/.hgrc|content=[web]<br/>cacerts = /etc/ssl/certs/ca-certificates.crt}}
+
  
 
== Usage ==
 
== Usage ==
 
All mercurial commands are initiated with the ''hg'' prefix. To see a list of some of the common commands, run
 
All mercurial commands are initiated with the ''hg'' prefix. To see a list of some of the common commands, run
{{Cli|$ hg help}}
+
{{bc|$ hg help}}
  
 
You can either work with a pre-existing repository (collection of code or files), or create your own to share.
 
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:
 
To work with a pre-existing repository, you must clone it to a directory of your choice:
{{Cli|$ mkdir mercurial<br/>$ cd mercurial<br/>$ hg clone http://hg.serpentine.com/tutorial/}}
+
{{bc|$ mkdir mercurial<br/>$ cd mercurial<br/>$ hg clone http://hg.serpentine.com/tutorial/}}
  
 
To create you own, change to the directory you wish to share and initiate a mercurial project
 
To create you own, change to the directory you wish to share and initiate a mercurial project
{{Cli|$ cd myfiles<br/>$ hg init myfiles}}
+
{{bc|$ cd myfiles<br/>$ hg init myfiles}}
 
+
  
 
=== Dotfiles Repo ===
 
=== Dotfiles Repo ===
If you intend on creating a repo of all your {{filename|~/.}} files, you simply initiate the project in your home folder:
+
If you intend on creating a repo of all your {{ic|~/.}} files, you simply initiate the project in your home folder:
{{Cli|$ hg init}}
+
{{bc|$ hg init}}
  
 
It is then just a case of adding the specific files you wish to track:
 
It is then just a case of adding the specific files you wish to track:
{{Cli|$ hg add |file1 file2 file3}}
+
{{bc|$ hg add |file1 file2 file3}}
 
+
You can then create a {{filename|~/.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 {{filename|.hgignore}} file, you can easily exclude groups of files from your repository.}}
+
  
 +
You can then create a {{ic|~/.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 {{ic|.hgignore}} file, you can easily exclude groups of files from your repository.}}
  
 
== More Resources ==
 
== More Resources ==

Revision as of 12:34, 16 December 2011

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.


Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어


External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

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

Mercurial is available from the standard repositories (see mercurial):

# pacman -S mercurial

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=

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.

More Resources