2017-11-22 13 views
-1

https://github.com/nirvdrum/svn2git 도구를 사용하여 지정하는 https://docs.gitlab.com/ce/user/project/import/svn.html에있는 설명서를 사용하여 SVN 저장소를 소수의 git repos로 변환하려고합니다.SVN to Git : 저장소 일부 추출 중

나의 기본적인 목표는 원래 SVN repo를 반영하는 하나의 git repo를 갖는 것입니다. 이 레포는 주로 역사적인 기록으로 사용됩니다. 그런 다음 SVN 저장소의 하위 디렉토리 중 일부를 자신의 git repos로 옮기고 싶습니다.

#!/bin/sh 

mkdir repo.git 
pushd repo.git 
git config --global gc.auto 0 
svn2git svn+ssh://svnhost/svn/dvl/svn/repo --authors ~/authors.txt 
git gc 
git config --global unset gc.auto 
popd 

pushd repo.git 
git subtree split -P subdir/project/ -b project-subtree 
popd 

mkdir project.git 
pushd project.git 
git init 
git pull ../repo.git project-subtree 
popd 

repo.git 내가 기대했던 지점 및 태그를 가지고 있지만, 그 중 하나를 project.git하지 않습니다

나는 아래 스크립트로이 일을하고있다. 가지와 태그를 project.git에 넣는 방법이 있습니까? 그렇지 않다면, 이것을하기위한 "올바른"방법은 무엇입니까?

또한

svn2git svn+ssh://svnhost/svn/dvl/svn/repo/subdir/project --authors ~/authors.txt --no-minimize-url 

을 시도하지만 svn+ssh://svnhost/svn/dvl/svn/repo/subdir/project/trunk을 찾습니다으로 그 빈의 repo를 생성합니다. 위의 명령에 --rootistrunk을 추가하면 오류가 발생합니다.

답변

1

자식 필터 지점

당신 힘내에 SVN에서 REPO를 변환 한 후

, 당신이 명령을 사용하여 독립 실행 형 자식의 repo로 하나 개의 하위 디렉터리를 추출 할 수 있어야한다 :

git filter-branch --prune-empty --subdirectory-filter subdir -- --all 

하는 것은 조심해야 (복사본을 작업하는 것이 더 낫습니다) ... 이전 마스터 (및 유사하게 다른 브랜치)는 일시적으로 refs/original/refs/heads/master 을 사용하여 연결할 수 있습니다. 그것 회복 ...

을 모두 확인한 후 instructions 다음에 삭제할 수 있습니다. 특히 :

git for-each-ref --format="%(refname)" refs/original/ | xargs -n 1 git update-ref -d