Ejemplo n.º 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())
Ejemplo n.º 2
0
    # 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.
ctx.username = '******'

# ctx.file_property_setters and ctx.revision_property_setters contain
# rules used to set the svn properties on files in the converted
# archive.  For each file, the rules are tried one by one.  Any rule
# can add or suppress one or more svn properties.  Typically the rules
# will not overwrite properties set by a previous rule (though they
# are free to do so).  ctx.file_property_setters should be used for
# properties that remain the same for the life of the file; these
Ejemplo n.º 3
0
        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))

        if mime_types_file:
            ctx.svn_property_setters.append(MimeMapper(mime_types_file))

        ctx.svn_property_setters.append(CVSBinaryFileEOLStyleSetter())

        ctx.svn_property_setters.append(CVSBinaryFileDefaultMimeTypeSetter())

        if eol_from_mime_type:
            ctx.svn_property_setters.append(EOLStyleFromMimeTypeSetter())