Ubuntu 12.04に Mercurialインストール

Mercurial インストール

$> sudo apt-get install mercurial
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています                
状態情報を読み取っています... 完了
以下の特別パッケージがインストールされます:
  mercurial-common
提案パッケージ:
  qct vim emacs kdiff3 tkdiff meld xxdiff python-mysqldb python-pygments
以下のパッケージが新たにインストールされます:
  mercurial mercurial-common
アップグレード: 0 個、新規インストール: 2 個、削除: 0 個、保留: 0 個。
1,982 kB のアーカイブを取得する必要があります。
この操作後に追加で 6,691 kB のディスク容量が消費されます。
続行しますか [Y/n]? y
取得:1 http://jp.archive.ubuntu.com/ubuntu/ precise/universe mercurial-common all 2.0.2-1ubuntu1 [1,945 kB]
取得:2 http://jp.archive.ubuntu.com/ubuntu/ precise/universe mercurial i386 2.0.2-1ubuntu1 [37.1 kB]
1,982 kB を 4秒 で取得しました (409 kB/s)
以前に未選択のパッケージ mercurial-common を選択しています。
(データベースを読み込んでいます ... 現在 645883 個のファイルとディレクトリがインストールされています。)
(.../mercurial-common_2.0.2-1ubuntu1_all.deb から) mercurial-common を展開しています...
以前に未選択のパッケージ mercurial を選択しています。
(.../mercurial_2.0.2-1ubuntu1_i386.deb から) mercurial を展開しています...
man-db のトリガを処理しています ...
mercurial-common (2.0.2-1ubuntu1) を設定しています ...
mercurial (2.0.2-1ubuntu1) を設定しています ...

Creating config file /etc/mercurial/hgrc.d/hgext.rc with new version

$> hg version
Mercurial - 分散構成管理ツール(バージョン 2.0.2)
(詳細は http://mercurial.selenic.com を参照のこと)

Copyright (C) 2005-2011 Matt Mackall 他
本製品はフリーソフトウェアです。
頒布条件に関しては同梱されるライセンス条項をお読みください。
市場適合性や特定用途への可否を含め、 本製品は無保証です。

テスト

  • ユーザー名の定義 ~/.hgrcファイルを作成し、以下を記述。(例)
[ui]
username = username <mail address> 
$> hg init
  • ファイル作成(例:main.cpp)
#include <stdio.h>

int main(int argc, char const* argv[])
{
    printf("hello world\n");
    return 0;
}
$> hg add main.cpp 
  • commit
$> hg commit -m 'hello world' main.cpp 
  • clone -> commit -> pull -> update
$> hg clone ../org new
$> cd new
$> vim main.cpp
$> hg commit -m 'modify' main.cpp
$> cd ../org/
$> hg pull ../new
$> hg update
  • clone -> commit -> push -> update
$> hg clone ../org new
$> cd new
$> vim main.cpp
$> hg commit -m 'push' main.cpp
$> hg push ../org
$> cd ../org
$> hg update

おぉ!なるほど。
基本的な操作はみんな同じ♪

参考サイト