我使用svnadmin转储/加载周期将存储库从服务器1迁移到服务器2,但我只是转储了最近的100次还原(600~700)。我发现新存储库的修订版是从1到100,而不是从600到700。问题是,在重新定位工作副本后,我更新了它,然后我得到了"没有这样的修订700"的错误。似乎是新存储库版本错误?
有什么建议吗?
在加载转储之前,似乎需要为SVN回购生成空的填充修订:
但是,当它被加载回新的存储库(
svnadmin load mynewrepo < repo.dump
)时,修订将从1开始重新编号,因此修订1234将变为修订1。这是不可取的,因为我有引用SVN修订号的现有错误和变更日志,所以我创建了一个小脚本(SVN生成空修订)来创建一些空修订。在使用中,将其输出拼接到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生成空的修订脚本本身:
#!/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