@peccul is peccu

(love peccu '(emacs lisp cat outdoor bicycle mac linux coffee))

SubGitでSubversionリポジトリからGitリポジトリに移行すると速い

巨大なSubversionリポジトリをGitに移行しようと思ったのですが、git-svnが遅かった。

SubGitというのを見つけて使ってみると速かった。

www.subgit.com

Java1.7以降が必要。

雰囲気はこんな感じ。svnリポジトリからgitのbareリポジトリが吐き出される。 そのままGitBucketのリポジトリ置き場においても良い。

% ~/Downloads/subgit-3.0.0/bin/subgit configure /path/to/svn/repo
SubGit version 3.0.0 ('Bobique') build #3320

Configuring writable Git mirror of remote Subversion repository:
    Subversion repository URL : /path/to/svn/repo
    Git repository location   : repo.git

CONFIGURATION SUCCESSFUL

To complete SubGit installation do the following:

1) Adjust Subversion to Git branches mapping if necessary:
    repo.git/subgit/config
2) Define at least one Subversion credentials in default SubGit passwd file at:
    repo.git/subgit/passwd
   OR configure SSH or SSL credentials in the [auth] section of:
    repo.git/subgit/config
3) Optionally, add custom authors mapping to the authors.txt file(s) at:
    repo.git/subgit/authors.txt
4) Run SubGit 'install' command:
    subgit install repo.git
% ~/Downloads/subgit-3.0.0/bin/subgit install repo.git
SubGit version 3.0.0 ('Bobique') build #3320

About to shut down background translation process.
Background translation process is not running.

Continuing after an interrupted installation.

Translating Subversion revisions to Git commits...

    Subversion revisions translated: nnn.
    Total time: nnn seconds.

INSTALLATION SUCCESSFUL

Your copy of SubGit is not registered for repository at 'repo.git'.
You may use SubGit for evaluation purposes.

For production use, please obtain registration key at http://www.subgit.com/ and register SubGit.
Registration is free for Open Source, Educational and Startup projects.

本来はSubversionとGitリポジトリの同期ツールで、オープンソースなどでなければ同期するのは有料。SubversionからGitへのインポートのみなら無料。 上記の例はインポートではなく同期の設定をインストールするコマンドを実行したので、最後に登録してね。と出力された。

www.subgit.com

(追記)インストールじゃなくてインポートが必要

上記例のままだとgit push時に怒られる。無料で使うならアンインストールする必要があった。

% ~/Downloads/subgit-3.0.0/bin/subgit uninstall repo.git

最初からsubgit importsvn→gitしておけば問題ないはず。

ブランチについて

とりあえず何も考えずにインポートすると、Subversionでのブランチがちぎれて散らばった。

おそらくSubversionでのブランチがリポジトリルートからではなく、下位ディレクトリで切っていたため。

subgitのオプションで対応できそうな雰囲気だけど、ブランチの数もコミット数も多くて気にしないことにした。

ログとしては残っているがGitBucket上ではコミット数がカウントストップした。