我正在尝试使用 cvs2svn 从 CVS 转换为 SVN,我们希望布局在每个项目中都有主干/标签/分支。首先我尝试了这个:
sudo cvs2svn -s /build/svn-test3 /build/cvs2016-02-08
这没有给我正确的布局。我将主干/标签/分支作为顶级目录,我的所有项目都在主干中。所以我开始弄乱选项文件方法并想出了这个:
cvs_repo_main_dir = r'/build/cvs2016-02-08'
projects = os.listdir(cvs_repo_main_dir)
# don't want to convert CVSROOT:
projects.remove('CVSROOT')
for project in projects:
run_options.add_project(
cvs_repo_main_dir + '/' + project,
trunk_path=(project + '/trunk'),
branches_path=(project + '/branches'),
tags_path=('tags'),
)
但是现在我得到了大量的歧义和错误:
cvs2svn ERROR: Problems determining how symbols should be converted:
CVS 中的标签、分支或导入似乎存在问题,并且 CVS 中没有遵循分支和标签的命名约定,因此实际上没有任何方法可以制定简单的规则来强制使用正则表达式的标签或分支。
以下是我正在使用的交易品种策略规则(我已经尝试了这些规则的各种组合,但我总是得到相同的结果(:
global_symbol_strategy_rules = [
#SymbolHintsFileRule('symbol-hints.txt'),
#ForceBranchRegexpStrategyRule(r'branch.*'),
ForceTagRegexpStrategyRule(r'[0-9]_[0-9]'),
ForceTagRegexpStrategyRule(r'RELEASE_'),
#ExcludeRegexpStrategyRule(r'unknown-.*'),
#ExcludeTrivialImportBranchRule(),
ExcludeVendorBranchRule(),
UnambiguousUsageRule(),
BranchIfCommitsRule(),
# Convert ambiguous symbols based on whether they were used more
# often as branches or as tags:
HeuristicStrategyRule(),
# Convert all ambiguous symbols as branches:
#AllBranchRule(),
# Convert all ambiguous symbols as tags:
AllTagRule(),
HeuristicPreferredParentRule(),
]
两个问题:
为什么当我使用选项文件时会出现歧义,而不是在命令行上使用默认转换选项时?
有没有办法在不手动浏览我的 4600+ 行符号信息.txt文件的情况下修复它?
我再次找到了自己问题的答案。问题是在我的run_options.add_project部分中,我没有symbol_strategy_rules部分,因此它跳过了我的所有规则。
现在来看下一个挑战:
The following paths are not disjoint:
Path tags/AF_RELEASE_23 is repeated 10 times
Path tags/AF_RELEASE_24 is repeated 10 times
Path tags/AF_RELEASE_25 is repeated 10 times
Path tags/AF_RELEASE_26 is repeated 10 times
Path tags/AF_RELEASE_27 is repeated 10 times
Path tags/AF_RELEASE_28 is repeated 10 times
Path tags/AF_RELEASE_30 is repeated 10 times
Path tags/AF_RELEASE_30_1 is repeated 9 times
Path tags/AF_RELEASE_31 is repeated 9 times
Path tags/AF_RELEASE_31_1 is repeated 7 times
有人认为他们可以比我先弄清楚吗?
我很难找到好的例子,所以这里是我最终的cvs2svn.options文件的(相关部分(,供任何偶然发现这篇文章的人使用:
global_symbol_strategy_rules = [
ExcludeTrivialImportBranchRule(),
ExcludeVendorBranchRule(),
UnambiguousUsageRule(),
BranchIfCommitsRule(),
HeuristicStrategyRule(),
# Convert all ambiguous symbols as branches:
#AllBranchRule(),
# Convert all ambiguous symbols as tags:
#AllTagRule(),
# The last rule is here to choose the preferred parent of branches
# and tags, that is, the line of development from which the symbol
# sprouts.
HeuristicPreferredParentRule(),
]
。
cvs_repo_main_dir = r'/build/cvs2016-02-08'
projects = os.listdir(cvs_repo_main_dir)
# don't want to convert CVSROOT:
projects.remove('CVSROOT')
for project in projects:
run_options.add_project(
cvs_repo_main_dir + '/' + project,
trunk_path=('/projects/'+project + '/trunk'),
branches_path=('/projects/'+project + '/branches'),
tags_path=('/projects/'+project + '/tags'),
symbol_strategy_rules=[
# Additional, project-specific symbol strategy rules can
# be added here.
] + global_symbol_strategy_rules,
)