简体   繁体   English

符号歧义和回购布局

[英]Symbol ambiguities and repo layout

I'm trying to convert to SVN from CVS using cvs2svn and we want the layout to have trunk/tags/branches inside each project. 我正在尝试使用cvs2svn从CVS转换为SVN,并且我们希望布局在每个项目中都有主干/标签/分支。 First I tried this: 首先,我尝试了这个:

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

Which didn't give me the right layout. 这没有给我正确的布局。 I got trunk/tags/branches as top level directories with all of my projects inside trunk. 我将trunk / tags / branches作为顶级目录,所有项目都放在trunk中。 So I started messing around with the options file method and came up with this: 因此,我开始弄乱options文件方法,并提出了以下建议:

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'),
        )

but now I am getting a large number of ambiguities and the error: 但是现在我得到了很多歧义和错误:

cvs2svn ERROR: Problems determining how symbols should be converted:

It seems to have a problem with everything that is a Tag, branch or import in CVS and there was no naming convention followed in CVS for branches and tags so there is not really any way to make simple rules to force tags or branches with regex's. CVS中的标记,分支或导入等所有内容似乎都存在问题,并且CVS中没有为分支和标记遵循命名约定,因此,实际上没有任何方法可以制定简单的规则来使用正则表达式强制标记或分支。

Here are the symbol strategy rules I'm using (I've tried various combinations of these but I always get the same result): 这是我正在使用的交易品种策略规则(我尝试了这些策略的各种组合,但始终得到相同的结果):

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

Two questions: 两个问题:

  1. Why do I get ambiguities when I use the options file and not when I use the default conversion options on the command line? 为什么在使用选项文件时而不在命令行上使用默认转换选项时会产生歧义?

  2. Is there a way to fix it without manually going through my 4600+ line symbol-info.txt file? 有没有一种方法可以解决此问题,而无需手动浏览4600+行的symbol-info.txt文件?

Once again I have found the answer to my own question. 我再次找到了自己问题的答案。 The problem was that in my run_options.add_project section I didn't have a symbol_strategy_rules section so it was skipping over all of my rules. 问题是我的run_options.add_project部分中没有symbol_strategy_rules部分,因此它跳过了我的所有规则。

Now for the next challenge: 现在是下一个挑战:

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

Anyone think they can figure it out before me? 有人认为他们可以在我之前弄清楚吗?

I had a really hard time finding good examples so Here's (the relevant portion of) my final cvs2svn.options file for anyone who stumbles across this post: 我很难找到好的例子,所以这是我最终的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,
        )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM