我看了一下资料库。您无法在整个历史记录中使用svndumpfilter
重命名文件,因此我编写了一个小脚本,用于在转储文件中进行重命名。唯一棘手的部分是添加tags
和branches
文件夹的创建。要使用该脚本,你应该做一个cronjob或类似的是:
下载latest Putty SVN dump file:
$ wget http://www.chiark.greenend.org.uk/~sgtatham/putty/putty-svn.dump.gz
修复转储文件与脚本:
$ zcat putty-svn.dump.gz | fix-dump.py > fixed.dump
负荷它变成一个新的空的存储库:
$ svnadmin create putty
$ svnadmin load putty < fixed.dump
版本库转换为Mercurial库:
$汞柱转换文件:// $ PWD /腻子
据我所看到的,是正确创建分支和标签。
你问连续拉(增量转换)。幸运的是,hg convert
和hgsubversion
都支持这一点。您需要每天重做步骤1-3,然后才能将变更集转换为Mercurial。这将起作用,因为前三个步骤是确定性的。这意味着您的SVN存储库的行为就好像腻子开发人员使用您在其中维护的正确分支和标记名称直接在其中工作。
下面的脚本是:
#!/usr/bin/python
import sys, re
moves = [(r"^Node(-copyfrom|)?-path: %s" % pattern, r"Node\1-path: %s" % repl)
for (pattern, repl) in [(r"putty-branch-(0\...)", r"branches/\2"),
(r"putty-(0\...)", r"tags/\2"),
(r"putty(/|\n)", r"trunk\2")]]
empty_dir_template = """\
Node-path: %s
Node-kind: dir
Node-action: add
Prop-content-length: 10
Content-length: 10
PROPS-END\n\n"""
created_dirs = False
for line in sys.stdin:
if not created_dirs and line == "Node-path: putty\n":
sys.stdout.write(empty_dir_template % "tags")
sys.stdout.write(empty_dir_template % "branches")
created_dirs = True
for pattern, repl in moves:
line, count = re.subn(pattern, repl, line, 1)
if count > 0: break
sys.stdout.write(line)