2014-10-05 104 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