Пример #1
0
    def process_symbol_strategy_options(self):
        """Process symbol strategy-related options."""

        ctx = Ctx()
        options = self.options

        # Add the standard symbol name cleanup rules:
        self.options.symbol_transforms.extend([
            ReplaceSubstringsSymbolTransform('\\', '/'),
            # Remove leading, trailing, and repeated slashes:
            NormalizePathsSymbolTransform(),
        ])

        if ctx.trunk_only:
            if options.symbol_strategy_rules or options.keep_trivial_imports:
                raise SymbolOptionsWithTrunkOnlyException()

        else:
            if not options.keep_trivial_imports:
                options.symbol_strategy_rules.append(
                    ExcludeTrivialImportBranchRule())

            options.symbol_strategy_rules.append(UnambiguousUsageRule())
            if options.symbol_default == 'strict':
                pass
            elif options.symbol_default == 'branch':
                options.symbol_strategy_rules.append(AllBranchRule())
            elif options.symbol_default == 'tag':
                options.symbol_strategy_rules.append(AllTagRule())
            elif options.symbol_default == 'heuristic':
                options.symbol_strategy_rules.append(BranchIfCommitsRule())
                options.symbol_strategy_rules.append(HeuristicStrategyRule())
            elif options.symbol_default == 'exclude':
                options.symbol_strategy_rules.append(AllExcludedRule())
            else:
                assert False

            # Now add a rule whose job it is to pick the preferred parents of
            # branches and tags:
            options.symbol_strategy_rules.append(
                HeuristicPreferredParentRule())
Пример #2
0
    # converted as branches.  If you would like to resolve such
    # ambiguities manually, comment out the following line:
    BranchIfCommitsRule(),

    # Last in the list can be a catch-all rule that is used for
    # symbols that were not matched by any of the more specific rules
    # above.  (Assuming that BranchIfCommitsRule() was included above,
    # then the symbols that are still indeterminate at this point can
    # sensibly be converted as branches or tags.)  Include at most one
    # of these lines.  If none of these catch-all rules are included,
    # then the presence of any ambiguous symbols (that haven't been
    # disambiguated above) is an error:

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

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

# Specify a username to be used for commits for which CVS doesn't
# record the original author (for example, the creation of a branch).
# This should be a simple (unix-style) username, but it can be
# translated into a git-style name by the author_transforms map.
Пример #3
0
        symbol_transforms.extend([
            ReplaceSubstringsSymbolTransform('\\', '/'),
            # Remove leading, trailing, and repeated slashes:
            NormalizePathsSymbolTransform(),
        ])

        symbol_strategy_rules.append(UnambiguousUsageRule())
        if symbol_strategy_default == 'strict':
            pass
        elif symbol_strategy_default == 'branch':
            symbol_strategy_rules.append(AllBranchRule())
        elif symbol_strategy_default == 'tag':
            symbol_strategy_rules.append(AllTagRule())
        elif symbol_strategy_default == 'heuristic':
            symbol_strategy_rules.append(BranchIfCommitsRule())
            symbol_strategy_rules.append(HeuristicStrategyRule())
        else:
            assert False

        # Now add a rule that sets the SVN path for each LOD:
        symbol_strategy_rules.append(DefaultBasePathRule())

        # Now add a rule whose job it is to pick the preferred parents of
        # branches and tags:
        symbol_strategy_rules.append(HeuristicPreferredParentRule())

        if auto_props_file:
            ctx.svn_property_setters.append(
                AutoPropsPropertySetter(auto_props_file,
                                        auto_props_ignore_case))