複数svnレポジトリをgit-svnで使用する

今までdotfilesの類いをcodereposにコミットしていたのですが、codecheck.inにもコミットしたくなりました。でも複数svnレポジトリをトラックとかできんの?ということでとりあえずmanpageを見る事に。

man git-svn

Specify the [svn-remote ""] section to use, this allows SVN multiple repositories to be tracked. Default: "svn"

git-svn(1)

という事が書いてあったので、できそうな気がします。

git-svn initしてみる

何も考えずにgit svn initしてみよう。

git svn init http://hogehoge.com/
git svn init http://fugafuga.com/ --svn-remote another-svn

この時点で .git/config を覗いてみる。

[svn-remote "svn"]
url = http://hogehoge.com/
fetch = :refs/remotes/git-svn

[svn-remote "another-svn"]
url = http://fugafuga.com/
fetch = :refs/remotes/git-svn

2種類の設定ができている。でもfetchの部分がどちらもgit-svnなので、ちょっと問題あり?

git-configで設定を弄る

という訳でconfigファイルを設定する。直接変更した方が早い気もするけど、git-configを使ってみる。

git-config --unset svn-remote.another-svn.fetch
git-config --add svn-remote.another-svn.fetch :refs/remotes/another-svn

この時点で .git/config を覗いてみる。

[svn-remote "svn"]
url = http://hogehoge.com/
fetch = :refs/remotes/git-svn

[svn-remote "another-svn"]
url = http://fugafuga.com/
fetch = :refs/remotes/another-svn

これで良さげ?

git-svn fetch

設定を終えたのでgit-svn fetchで取ってきてみる。

git-svn fetch anotehr-svn

fetchの後ろに設定した名前を指定すると、そこを使うっぽい。デフォルトではsvnなので、何も指定しなければsvnを指定したのと同じらしい。

git-svn dcommit

同様に後ろに --svn-remote で設定した名前を指定すればいい。

git-svn dcommit another-svn