2014-10-05 83 views
0

我使用svnadmin轉儲/加載循環將存儲庫從服務器1遷移到服務器2,但我只是拋棄了最新的100版本(600〜700)。我發現新版本庫的修訂版本是從1到100而不是從600到700.這裏是問題,重新定位工作副本後,我更新它,然後得到「No such revision 700」錯誤。這似乎是新的版本庫版本錯誤?svn遷移但轉儲部分存儲庫

有什麼建議嗎?

回答

1

看來你裝載轉儲前需要generate empty padding revisions爲您的SVN回購:

然而,當這個被裝回到一個新的存儲庫(svnadmin load mynewrepo < repo.dump),修訂版被重新編號從1開始,使什麼是修訂1234成爲修訂1.這是不可取的,因爲我有現有的錯誤和更新日誌引用SVN修訂版號,所以我創建了一個小腳本(svn-generate-empty-revisions)創建了一些空的修訂版。

在使用中,它是最有用的輸出拼接成一個SVN轉儲的開始,例如:

svnadmin dump -r 1234:HEAD /path/to/repo > repo.dump 
# Extract the first few lines of the dump, which contain metadata 
head -n 4 repo.dump > repo-padded.dump 
# Splice in some empty "padding" revisions to preserve revision numbering 
# Note that the first revision is 1234, so we want 1233 empty revisions at start 
./svn-generate-empty-revisions.sh 1233 >> repo-padded.dump 
# Add the rest of the original repository dump to the file 
tail -n +4 repo.dump >> repo-padded.dump 

svn-generate-empty-revisions腳本本身:

#!/bin/bash 
# Generate a number of empty revisions, for incorporation into an SVN dump file 
# 2011 Tim Jackson <[email protected]> 

if [ -z "$1" ]; then 
    echo "Usage: svn-generate-empty-revisions.sh NUMREVISIONS [TIMESTAMP]" 
    exit 1 
fi 

timestamp=$(date +%Y-%m-%dT%H:%M:%S.000000Z) 
if [ ! -z "$2" ]; then 
    timestamp=$2 
fi 

for i in $(seq 1 $1); do 
cat <<EOF 
Revision-number: $i 
Prop-content-length: 112 
Content-length: 112 

K 7 
svn:log 
V 38 
This is an empty revision for padding. 
K 8 
svn:date 
V 27 
$timestamp 
PROPS-END 

EOF 
done 
+0

確保使新文件可執行文件:'chmod + x svn-generate-empty-revisions.sh' – avs099 2016-08-07 19:17:46