Exemplo n.º 1
0
  def add_project(
        self,
        project_cvs_repos_path,
        trunk_path=None, branches_path=None, tags_path=None,
        initial_directories=[],
        symbol_transforms=None,
        symbol_strategy_rules=[],
        exclude_paths=[],
        ):
    """Add a project to be converted.

    Most arguments are passed straight through to the Project
    constructor.  SYMBOL_STRATEGY_RULES is an iterable of
    SymbolStrategyRules that will be applied to symbols in this
    project."""

    if trunk_path is not None:
      trunk_path = normalize_svn_path(trunk_path, allow_empty=True)
    if branches_path is not None:
      branches_path = normalize_svn_path(branches_path, allow_empty=False)
    if tags_path is not None:
      tags_path = normalize_svn_path(tags_path, allow_empty=False)

    initial_directories = [
        path
        for path in [trunk_path, branches_path, tags_path]
        if path
        ] + [
        normalize_svn_path(path)
        for path in initial_directories
        ]

    symbol_strategy_rules = list(symbol_strategy_rules)

    # Add rules to set the SVN paths for LODs depending on whether
    # they are the trunk, tags, or branches:
    if trunk_path is not None:
      symbol_strategy_rules.append(TrunkPathRule(trunk_path))
    if branches_path is not None:
      symbol_strategy_rules.append(BranchesPathRule(branches_path))
    if tags_path is not None:
      symbol_strategy_rules.append(TagsPathRule(tags_path))

    id = len(self.projects)
    project = Project(
        id,
        project_cvs_repos_path,
        initial_directories=initial_directories,
        symbol_transforms=symbol_transforms,
        exclude_paths=exclude_paths,
        )

    self.projects.append(project)
    self.project_symbol_strategy_rules.append(symbol_strategy_rules)
Exemplo n.º 2
0
    def add_project(
        self,
        project_cvs_repos_path,
        trunk_path=None,
        branches_path=None,
        tags_path=None,
        initial_directories=[],
        symbol_transforms=None,
        symbol_strategy_rules=[],
        exclude_paths=[],
    ):
        """Add a project to be converted.

    Most arguments are passed straight through to the Project
    constructor.  SYMBOL_STRATEGY_RULES is an iterable of
    SymbolStrategyRules that will be applied to symbols in this
    project."""

        if trunk_path is not None:
            trunk_path = normalize_svn_path(trunk_path, allow_empty=True)
        if branches_path is not None:
            branches_path = normalize_svn_path(branches_path,
                                               allow_empty=False)
        if tags_path is not None:
            tags_path = normalize_svn_path(tags_path, allow_empty=False)

        initial_directories = [
            path for path in [trunk_path, branches_path, tags_path] if path
        ] + [normalize_svn_path(path) for path in initial_directories]

        symbol_strategy_rules = list(symbol_strategy_rules)

        # Add rules to set the SVN paths for LODs depending on whether
        # they are the trunk, tags, or branches:
        if trunk_path is not None:
            symbol_strategy_rules.append(TrunkPathRule(trunk_path))
        if branches_path is not None:
            symbol_strategy_rules.append(BranchesPathRule(branches_path))
        if tags_path is not None:
            symbol_strategy_rules.append(TagsPathRule(tags_path))

        id = len(self.projects)
        project = Project(
            id,
            project_cvs_repos_path,
            initial_directories=initial_directories,
            symbol_transforms=symbol_transforms,
            exclude_paths=exclude_paths,
        )

        self.projects.append(project)
        self.project_symbol_strategy_rules.append(symbol_strategy_rules)
Exemplo n.º 3
0
def normalize_ttb_path(opt, path, allow_empty=False):
    try:
        return normalize_svn_path(path, allow_empty)
    except IllegalSVNPathError, e:
        raise FatalError('Problem with %s: %s' % (
            opt,
            e,
        ))
Exemplo n.º 4
0
 def transform(self, cvs_file, symbol_name, revision):
     try:
         return normalize_svn_path(symbol_name)
     except IllegalSVNPathError, e:
         raise FatalError('Problem with %s: %s' % (
             symbol_name,
             e,
         ))
Exemplo n.º 5
0
 def __init__(self, project_id, symbol_name, conversion, svn_path,
              parent_lod_name):
     self.project_id = project_id
     self.symbol_name = symbol_name
     self.conversion = conversion
     if svn_path is None:
         self.svn_path = None
     else:
         self.svn_path = normalize_svn_path(svn_path, allow_empty=True)
     self.parent_lod_name = parent_lod_name
Exemplo n.º 6
0
 def __init__(
       self, project_id, symbol_name, conversion, svn_path, parent_lod_name
       ):
   self.project_id = project_id
   self.symbol_name = symbol_name
   self.conversion = conversion
   if svn_path is None:
     self.svn_path = None
   else:
     self.svn_path = normalize_svn_path(svn_path, allow_empty=True)
   self.parent_lod_name = parent_lod_name
Exemplo n.º 7
0
    def __init__(
        self,
        id,
        project_cvs_repos_path,
        initial_directories=[],
        symbol_transforms=None,
        exclude_paths=[],
    ):
        """Create a new Project record.

    ID is a unique id for this project.  PROJECT_CVS_REPOS_PATH is the
    main CVS directory for this project (within the filesystem).

    INITIAL_DIRECTORIES is an iterable of all SVN directories that
    should be created when the project is first created.  Normally,
    this should include the trunk, branches, and tags directory.

    SYMBOL_TRANSFORMS is an iterable of SymbolTransform instances
    which will be used to transform any symbol names within this
    project.

    EXCLUDE_PATHS is an iterable of paths that should be excluded from
    the conversion.  The paths should be relative to
    PROJECT_CVS_REPOS_PATH and use slashes ('/').  Paths for
    individual files should include the ',v' extension.
    """

        self.id = id

        self.project_cvs_repos_path = os.path.normpath(project_cvs_repos_path)
        if not os.path.isdir(self.project_cvs_repos_path):
            raise FatalError(
                "The specified CVS repository path '%s' is not an "
                "existing directory." % self.project_cvs_repos_path)

        self.cvs_repository_root, self.cvs_module = \
            self.determine_repository_root(
                os.path.abspath(self.project_cvs_repos_path))

        # The SVN directories to add when the project is first created:
        self._initial_directories = []

        for path in initial_directories:
            try:
                path = normalize_svn_path(path, False)
            except IllegalSVNPathError, e:
                raise FatalError(
                    'Initial directory %r is not a legal SVN path: %s' % (
                        path,
                        e,
                    ))
            self._initial_directories.append(path)
Exemplo n.º 8
0
    def __init__(
        self,
        id,
        project_cvs_repos_path,
        initial_directories=[],
        symbol_transforms=None,
    ):
        """Create a new Project record.

    ID is a unique id for this project.  PROJECT_CVS_REPOS_PATH is the
    main CVS directory for this project (within the filesystem).

    INITIAL_DIRECTORIES is an iterable of all SVN directories that
    should be created when the project is first created.  Normally,
    this should include the trunk, branches, and tags directory.

    SYMBOL_TRANSFORMS is an iterable of SymbolTransform instances
    which will be used to transform any symbol names within this
    project."""

        self.id = id

        self.project_cvs_repos_path = os.path.normpath(project_cvs_repos_path)
        if not os.path.isdir(self.project_cvs_repos_path):
            raise FatalError(
                "The specified CVS repository path '%s' is not an "
                "existing directory." % self.project_cvs_repos_path)

        self.cvs_repository_root, self.cvs_module = \
            self.determine_repository_root(
                os.path.abspath(self.project_cvs_repos_path))

        # A regexp matching project_cvs_repos_path plus an optional separator:
        self.project_prefix_re = re.compile(
            r'^' + re.escape(self.project_cvs_repos_path) + r'(' +
            re.escape(os.sep) + r'|$)')

        # The SVN directories to add when the project is first created:
        self._initial_directories = []

        for path in initial_directories:
            try:
                path = normalize_svn_path(path, False)
            except IllegalSVNPathError, e:
                raise FatalError(
                    'Initial directory %r is not a legal SVN path: %s' % (
                        path,
                        e,
                    ))
            self._initial_directories.append(path)
Exemplo n.º 9
0
  def __init__(
        self, id, project_cvs_repos_path,
        initial_directories=[],
        symbol_transforms=None,
        exclude_paths=[],
        ):
    """Create a new Project record.

    ID is a unique id for this project.  PROJECT_CVS_REPOS_PATH is the
    main CVS directory for this project (within the filesystem).

    INITIAL_DIRECTORIES is an iterable of all SVN directories that
    should be created when the project is first created.  Normally,
    this should include the trunk, branches, and tags directory.

    SYMBOL_TRANSFORMS is an iterable of SymbolTransform instances
    which will be used to transform any symbol names within this
    project.

    EXCLUDE_PATHS is an iterable of paths that should be excluded from
    the conversion.  The paths should be relative to
    PROJECT_CVS_REPOS_PATH and use slashes ('/').  Paths for
    individual files should include the ',v' extension.
    """

    self.id = id

    self.project_cvs_repos_path = os.path.normpath(project_cvs_repos_path)
    if not os.path.isdir(self.project_cvs_repos_path):
      raise FatalError("The specified CVS repository path '%s' is not an "
                       "existing directory." % self.project_cvs_repos_path)

    self.cvs_repository_root, self.cvs_module = \
        self.determine_repository_root(
            os.path.abspath(self.project_cvs_repos_path))

    # The SVN directories to add when the project is first created:
    self._initial_directories = []

    for path in initial_directories:
      try:
        path = normalize_svn_path(path, False)
      except IllegalSVNPathError, e:
        raise FatalError(
            'Initial directory %r is not a legal SVN path: %s'
            % (path, e,)
            )
      self._initial_directories.append(path)
Exemplo n.º 10
0
 def __init__(self, project_id, svn_path):
   self.project_id = project_id
   self.svn_path = normalize_svn_path(svn_path, allow_empty=True)
Exemplo n.º 11
0
 def transform(self, cvs_file, symbol_name, revision):
   try:
     return normalize_svn_path(symbol_name)
   except IllegalSVNPathError, e:
     raise FatalError('Problem with %s: %s' % (symbol_name, e,))
Exemplo n.º 12
0
def normalize_ttb_path(opt, path, allow_empty=False):
    try:
        return normalize_svn_path(path, allow_empty)
    except IllegalSVNPathError, e:
        raise FatalError("Problem with %s: %s" % (opt, e))
Exemplo n.º 13
0
 def __init__(self, project_id, svn_path):
     self.project_id = project_id
     self.svn_path = normalize_svn_path(svn_path, allow_empty=True)