svn2git 을 사용하는게 더 나음. 서브버전 저장소(subversion repository)를 git 으로 이관하기 참조

 

아틀라시안이 작성한 svn 저장소를 git 으로 변환하는 방법 정리(https://www.atlassian.com/git/migration)

 

 

Prepare

  1. 다운로드  (https://bitbucket.org/atlassian/svn-migration-scripts/downloads)

  2. migration 이 가능하게 시스템이 구성(git, svn, perl 설치 여부)되었는지 검증

    java -jar svn-migration-scripts.jar verify
    CODE
  3. svn author 정보 추출 - svn 은 id 지만 git 은 이름과 email 이므로 변환 필요

    java -jar ~/svn-migration-scripts.jar authors <svn-repo> > authors.txt
    CODE

    <svn-repo. 는 저장소의 URI 로 외부에 있다면 전체 URL 명시

    java -jar ~/svn-migration-scripts.jar authors https://svn.example.com > authors.txt
    CODE
  4. 저자 정보 파일 편집. 다음과 같은 형식으로 생성이 된다.  좌측은 id 이고 우측은 full name 과 email 주소이다.

    j.doe = j.doe <j.doe@mycompany.com> 
    m.smith = m.smith <m.smith@mycompany.com>
    CODE

    좌측의 id는 그대로 두고 우측의 full name 과 email 을 사용자에 맞게 수정한다.

    j.doe = John Doe <john.doe@atlassian.com>
    m.smith = Mary Smith <mary.smith@atlassian.com>
    CODE

 

변환

  1. svn repos 체크아웃. 저장소가 trunk, tags, branches 가 붙는 표준 구조라면 --stdlayout 옵션을 사용한다. <svn-repo> 는 URI 로 명시해야 한다. 

    git svn clone --stdlayout --authors-file=authors.txt <svn-repo>/<project> <git-repo-name>
    CODE

    svn 저장소의 URI 가 https://svn.example.com 이고 프로젝트가 test-proj 일 경우 다음과 같이 실행한다.

    git svn clone --stdlayout --authors-file=authors.txt https://svn.example.com/test-proj test-proj-git
    CODE

    저장소가 표준 구조가 아니면 옵션으로 지정해야 한다.

    git svn clone --trunk=/trunk --branches=/branches --branches=/bugfixes --tags=/tags --authors-file=authors.txt https://svn.example.com/test-proj test-proj-git
    CODE
  2. clean

    java -Dfile.encoding=utf-8 -jar ~/svn-migration-scripts.jar clean-git
    CODE
  3. a

 

Ref