불행하게도, 나는 명령 줄 도구를 사용하여 목록 명령을 사용하는 파일이 저장소에 버전이 무엇을 알아낼 수 있지만 하나의 방법에 대한 완전 자동화 된 솔루션을 가지고 있지 않습니다
svn.exe list -R
이 명령은 현재 디렉토리에서 SVN에 의해 버전이 부여 된 모든 파일을 반복적으로 나열합니다. 그 목록이 있으면 다른 디렉토리에 복사하고 새로운 저장소에 일괄 처리 할 수 있습니다.
그 명령을 일부 Powershell 마술과 결합하면 아마도 저장소를 가능한 한 쉽게 재현 할 수 있습니다.
는 업데이트 :
나는 PowerShell로 재생 시간을 소요하고 당신이 할 수있는 방법을 알아 냈어. 예를 들어 원래 저장소 디렉토리가 C : \ source_repos \이고 새 저장소 디렉토리는 C : \ dest_repos \라고 설명하려고합니다.
- 명령 프롬프트를 엽니 다. 이 작업은 악세서리 시작 메뉴 폴더 나 Vista/Win7의 검색 창에서 "cmd"를 실행하거나 WinXP의 실행 ...을 통해 수행 할 수 있습니다. 명령 프롬프트에서
- 다음 명령을 실행는
cd C:\source_repos\
echo File > filelist.csv
svn.exe list -R >> filelist.csv
두 번째 명령은 단어 "파일"를 포함하는 첫 번째 줄에 filelist.csv 만듭니다. 세 번째 명령은 svn list 명령을 실행하고 출력을 filelist.csv에 추가하도록 리디렉션합니다. 이 시점에서 filelist.csv는 첫 번째 행에 "File"을 가져야하고 svn 디렉토리에서 버전이있는 모든 파일이 개별 행에 나열되어 있어야합니다.
- 아래 코드를 가지고라는 파일 reposcopy.ps1에 붙여 넣습니다
# Assumptions/Notes:
# - No crazy file names with "\" in them!
# - A file named filelist.csv was created by running:
# svn.exe list -R >> filelist.csv
# and is in the base directory of the source repository.
# - The first line of filelist.csv is "File" without quotes, this is
# important for the Import-Csv command
# - If you get an error about permissions when you try to run the script,
# use the command "Set-ExecutionPolicy RemoteSigned" in the powershell
# Source & destination repository directories
$src = "C:\source_repos\"
$dest = "C:\dest_repos\"
# Get current directory
$origdir = Get-Location
# Goto source repository directory
Set-Location $src
# Check if destination repository directory exists, if not create it
if (![IO.Directory]::Exists($dest)) {
[IO.Directory]::CreateDirectory($dest)
}
# Import filelist.csv created with these commands at a command prompt:
# cd C:\source_repos
# echo File > filelist.csv
# svn.exe list -R >> filelist.csv
$filelist = Import-Csv filelist.csv
# Go through each line in the filelist
foreach ($line in $filelist) {
# Concatenate the filename with the source and destination directories
$srcfile = [String]::Concat($src, $line.File)
$destfile = [String]::Concat($dest, $line.File)
# If the destination file is a directory and it doesn't exist create it
# Otherwise copy the source file to the destination.
if ($destfile.EndsWith("\")) {
if (![IO.Directory]::Exists($destfile)) {
[IO.Directory]::CreateDirectory($destfile)
}
} else {
Copy-Item $srcfile $destfile
}
}
# Go back to the original directory
Set-Location $origdir
당신은 각 실행에 대한 $src
및 $dest
변수를 수정해야합니다.
- 열기 파워 쉘 (이 WINXP 비스타/Win7에 또는 PowerShell을 액세서리에서 찾을 수 있습니다). 위의 스크립트를 저장 한 디렉토리로 이동하여 실행하십시오."스크립트 실행이이 시스템에서 사용 중지되었습니다"라는 오류가 발생하면 로컬 스크립트가 서명없이 실행될 수 있도록 powershell에
Set-ExecutionPolicy RemoteSigned
을 실행하십시오.
그렇게해야합니다. 모든 것이 잘되면
C:\dest_repos\
과
svn add
에 새 저장소에있는 모든 파일과
svn commit
으로 갈 수 있습니다.
내가 설명하려고 시도했거나 이상한 오류가 발생하는 것에 관한 질문이 있으면 알려주십시오. 스크립트의 표면적 인 테스트를했는데 몇 가지 중요한 경우를 깜박했을 가능성이 큽니다.
리포지토리를 복원하는 데 좋은 행운을 보냅니다!
@Kevin, 수동으로 특정 파일을 커밋하지 않고도 svn 서버를 복원 할 수 있었습니까? – lostriebo