subversionリポジトリからの変換

Twitterでこんなことをつぶやいたら入門Mercurialの著者の方にいろいろ教えてもらいました。Twitterスゴイネ!

Twitterでのやりとり

:left

REVMAPとは

http://mercurial.selenic.com/wiki/ConvertExtension

REVMAP is a a simple text file that maps each source commit ID to the destination ID for each revision. Unless specified, it defaults to the .hg/shamap in the destination directory. This file is automatically created and updated on each commit copied, its purpose is to track which commits were already imported and which were not - and thanks to it allow to resume interrupted import and to make incremental updates. It is important to note that this REVMAP file is not copied when you a clone a repository. So you need to manually move it over if you are going to make incremental updates on a clone of the original import repository.

Subversionのリビジョン番号とMercurialのリビジョン(ハッシュ)を対応付けているファイル。最初にconvertしたときのこのファイルが失われていた、かつbitbucketのリポジトリに手前成果が入っているのでたいそう面倒な状態になっている。

結局

REVMAPを書き直してconvertし直したものを「IMPORT」、現在のbitbucketを「MASTER」とし、pull/push/mergeでやるのが良さそう。

最初のconvertリポジトリが残っていれば、REVMAP書き直し量なども少なくて済んだと思われる。

実際にやってみた

そんなに面倒じゃなかった。やったね!

テンプレートを用意するのが面倒だったので、logをsedとsortで整形して矩形コピペでREVMAPを直した後convertして全てがうまくいった。
自分が修正を加えた後は、REVMAPの最終行(以前のconvert時の最新svnリビジョン)に対応するハッシュ値を書き直す必要が出たけど、そんなに修正加えてないからなんとかなる感じ。