■ 環境
Ubuntu 11.10
Play framework 1.2.4
Mercurial Distributed SCM (version 1.9.1)
Mercurialとは、手軽で便利な構成管理ソフトです。
Mercurialのインストールから、Play frameworkのプロジェクトをコミットする所まで書いてみます。
■1.Mercurialインストール
$ sudo apt-get install mercurial
# Mercurialバージョン確認
$ hg -v
Mercurial Distributed SCM (version 1.9.1)
■2.リポジトリ作成
# プロジェクト作成
$ play new yabe
# リポジトリの初期化
$ cd /home/user/play/yabe
$ hg init
## ファイルの状態確認
$ hg status
# すべてのファイルが?マークです
# tmpディレクトリとlogsディレクトリはリポジトリに追加しなくていいでしょう
■3.最初のコミット
## 無視ファイルリスト作成
$ nano .hgignore
## tmpディレクトリとlogsディレクトリを無視させましょう
$ cat .hgignore
tmp/
logs/
## ファイルを追加設定
$ hg add *
$ hg add .hgignore
## ファイルの状態確認
$ hg status
## すべてのファイルにAマークが付きました
## tmpディレクトリとlogsディレクトリが除外されています
## コミット…失敗
$ hg commit -m "first commit"
abort: no username supplied (see "hg help config")
## 言われた通りヘルプコマンドを叩いてみる
$ hg help config
...前略
"username"
The committer of a changeset created when running "commit". Typically
a person's name and email address, e.g. "Fred Widget
<fred@example.com>". Default is "$EMAIL" or "username@hostname". If
the username in hgrc is empty, it has to be specified manually or in a
different hgrc file (e.g. "$HOME/.hgrc", if the admin set "username ="
in the system hgrc). Environment variables in the username are
expanded.
...以下略
## とりあえず、ユーザーHOMEに.hgrcファイルを作ればよさそう
## ユーザーHOMEに.hgrcファイル作成
$ nano /home/user/.hgrc
$ cat /home/user/.hgrc
[ui]
username=user<user@example.com>
## こんどこそコミット成功
$ hg commit -m "first commit"
## ステータス確認…何も出なければOK
$ hg status