Difference between revisions of "Mercurial"

From ArchWiki
Jump to: navigation, search
(More Resources: added Intuxication)
(added explanation for hgk. using templates for formatting.)
Line 3: Line 3:
  
 
== Installation ==
 
== Installation ==
Mercurial is available from the standard repositories:
+
Mercurial is available from the standard repositories (see {{Package Official|mercurial}}):
# pacman -S mercurial
+
{{Cli|# 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 ~/.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 {{filename|~/.hgrc}} and adding the following:
[ui]
+
{{file|~/.hgrc|content=[ui]<br/>username = John Smith}}
username = John Smith
+
  
== Use ==
+
 
 +
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]):
 +
{{file|~/.hgrc|content=[extensions]<br/>hgk=}}
 +
 
 +
 
 +
== 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
$ hg help
+
{{Cli|$ 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:
$ mkdir mercurial
+
{{Cli|$ mkdir mercurial<br/>$ cd mercurial<br/>$ hg clone http://hg.serpentine.com/tutorial/}}
$ 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
 
To create you own, change to the directory you wish to share and initiate a mercurial project
$ cd myfiles
+
{{Cli|$ cd myfiles<br/>$ hg init myfiles}}
$ 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 {{filename|~/.}} files, you simply initiate the project in your home folder:
$ hg init
+
{{Cli|$ 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:
$ hg add file1 file2 file3
+
{{Cli|$ 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.
 
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 .hgignore file, you can easily exclude groups of files from your repository.}}
+
{{Tip|If you include: syntax: glob at the top of the {{filename|.hgignore}} file, you can easily exclude groups of files from your repository.}}
 +
 
  
 
== More Resources ==
 
== More Resources ==

Revision as of 12:44, 26 June 2011

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 Template:Package Official): Template:Cli

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 Template:Filename and adding the following: Template:File


To use the graphical browser hgk aka. hg view, add the following to Template:Filename (see forum thread): Template:File


Usage

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

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: Template:Cli

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


Dotfiles Repo

If you intend on creating a repo of all your Template:Filename files, you simply initiate the project in your home folder: Template:Cli

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

You can then create a Template:Filename 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 Template:Filename file, you can easily exclude groups of files from your repository.


More Resources