svn迁移但转储部分存储库

时间:2014-10-05 15:38:31

标签: svn svnadmin svndump

我使用svnadmin转储/加载周期将存储库从服务器1迁移到服务器2,但我只是转储了最新的100版本(600~700)。我发现新存储库的修订版本是1到100而不是600到700.这是问题,在重新定位工作副本后,我更新它然后我得到“No such revision 700”错误。这似乎是新的存储库版本错误?

有什么建议吗?

1 个答案:

答案 0 :(得分: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 <tim@timj.co.uk>

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
相关问题