符号歧义和回购布局

时间:2016-02-10 17:58:07

标签: svn cvs2svn

我试图使用cvs2svn从CVS转换为SVN,我们希望布局在每个项目中都有trunk / tags / branches。首先我尝试了这个:

sudo cvs2svn -s /build/svn-test3 /build/cvs2016-02-08

哪个没给我正确的布局。我将trunk / tags / branches作为顶级目录,我的所有项目都在trunk中。所以我开始搞乱选项文件方法并想出了这个:

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(),
    ]

两个问题:

  1. 为什么我在使用选项文件时会出现歧义,而不是在命令行上使用默认转换选项时出现歧义?

  2. 有没有办法修复它而无需手动浏览我的4600+行symbol-info.txt文件?

2 个答案:

答案 0 :(得分:0)

我再一次找到了自己问题的答案。问题是在我的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

有人认为他们可以在我面前解决这个问题吗?

答案 1 :(得分:0)

我很难找到好的例子,所以这是我最后的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,
        )