符号歧义和回购布局
Posted
技术标签:
【中文标题】符号歧义和回购布局【英文标题】:Symbol ambiguities and repo layout 【发布时间】:2016-02-10 17:58:06 【问题描述】:我正在尝试使用 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+ 行 symbol-info.txt 文件的情况下修复它?
【问题讨论】:
【参考方案1】:我又一次找到了自己问题的答案。问题是在我的 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
有人认为他们能在我之前弄清楚吗?
【讨论】:
这很简单...我将所有项目的所有标签都放在同一个目录中。【参考方案2】:我很难找到好的例子,所以这是我最终的 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,
)
【讨论】:
以上是关于符号歧义和回购布局的主要内容,如果未能解决你的问题,请参考以下文章