LoginSignup
3
3

More than 5 years have passed since last update.

git-cinnabar の導入 - mercurial リポジトリを git で開発する

Last updated at Posted at 2016-07-21

mercurial リポジトリの Unity UI を git リポジトリで管理・開発したい。
mercurial の作法を意識することなく git リポジトリで開発したり、アップストリームの差分を取り込めるようにしたり、いずれは PR を送るので自社開発した分も mercurial リポジトリに反映したい。

git-cinnabar を利用すればそれっぽい事をできそうだったので導入した。
本稿ではその時の手順をまとめてある。

git-cinnabar

https://github.com/glandium/git-cinnabar
git コマンドが mercurial リポジトリと仲良くなれるようにするモジュール。
git ログもキッチリ反映してくれる優れモノ。

環境

OS X : 10.11.5
python : 2.7.10 (built in)
git : 2.7.4 (command line tools for Xcode)
brew : 0.9.9

事前準備

  • アップストリームの mercurial リポジトリのフォーク
  • フォークしたリポジトリと同期するための git リポジトリ作成

依存モジュールのインストール

python module Merculial

https://pypi.python.org/pypi/Mercurial
git-cinnabar が内部で利用しているので入れておいてあげる。

$ curl -o https://pypi.python.org/packages/12/a6/c6c8fc072feb0255d18c32f9aa29595d418e542d91bcc50cb77042f7da46/mercurial-3.9-rc.tar.gz#md5=2bb529089511340a01c21c60e2d3bb29 mercurial-3.9-rc.tar.gz
$ tar -xzvf mercurial-3.9-rc.tar.gz # 普通に上記URLから落とすのも良し
$ pushd mercurial-3.9-rc
$ python setup.py install
$ popd
$ rm -rf mercurial-3.9-rc

git-cinnabar のインストール

$ git clone https://github.com/glandium/git-cinnabar.git
$ cd git-cinnabar
$ git submodule update --init
$ brew link --force openssl # openssl のリンカエラー回避
$ NO_GETTEXT=1 make helper  # libintl.h が mac にないので gettext を無視する
$ echo "PATH=\${PATH}:$(pwd)" >> ~/.bash_profile # パスを通す
$ source ~/.bash_profile

以上で git を利用した通常の開発と同じように mercurial リポジトリを扱えます。

注意点

git で PR 用のリポジトリをリモートに作る感覚で下記のようなコマンドを打っても、clone 時のリポジトリに反映されてしまう。

git push mercurial sonzaisinai_repo

ひとまず導入して基本的な操作が出来ることを確認した段階です。
その他の注意点やノウハウは、都度更新します。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3