简体   繁体   中英

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. 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. So I started messing around with the options file method and came up with this:

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.

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?

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.

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:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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