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
    # only existed as a vendor branch with a single import (leaving
    # only the 1.1 revision).  If you want to retain such branches,
    # comment out the following line.  (Please note that this rule
    # does not exclude vendor *tags*, as they are not so easy to
    # identify.)
    ExcludeTrivialImportBranchRule(),

    # To exclude all vendor branches (branches that had "cvs import"s
    # on them but no other kinds of commits), uncomment the following
    # line:
    #ExcludeVendorBranchRule(),

    # Usually you want this rule, to convert unambiguous symbols
    # (symbols that were only ever used as tags or only ever used as
    # branches in CVS) the same way they were used in CVS:
    UnambiguousUsageRule(),

    # If there was ever a commit on a symbol, then it cannot be
    # converted as a tag.  This rule causes all such symbols to be
    # 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:
Ejemplo n.º 3
0
            ctx.cvs_author_decoder = CVSTextDecoder(encodings,
                                                    fallback_encoding)
            ctx.cvs_log_decoder = CVSTextDecoder(encodings, fallback_encoding)
            # Don't use fallback_encoding for filenames:
            ctx.cvs_filename_decoder = CVSTextDecoder(encodings)
        except LookupError, e:
            raise FatalError(str(e))

        # Add the standard symbol name cleanup rules:
        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())