コード例 #1
0
        protected ISourceProvider GetSourceProvider(string repositoryType)
        {
            ISourceProvider sourceProvider = null;

            switch (repositoryType)
            {
            case RepositoryTypes.Bitbucket:
            case RepositoryTypes.GitHub:
            case RepositoryTypes.GitHubEnterprise:
                sourceProvider = new AuthenticatedGitSourceProvider();
                break;

            case RepositoryTypes.Git:
                sourceProvider = new ExternalGitSourceProvider();
                break;

            case RepositoryTypes.TfsGit:
                sourceProvider = new TfsGitSourceProvider();
                break;

            case RepositoryTypes.TfsVersionControl:
                sourceProvider = new TfsVCSourceProvider();
                break;

            case RepositoryTypes.Svn:
                sourceProvider = new SvnSourceProvider();
                break;

            default:
                throw new NotSupportedException(repositoryType);
            }

            return(sourceProvider);
        }
コード例 #2
0
        public ISourceProvider GetSourceProvider(string repositoryType)
        {
            ISourceProvider sourceProvider = null;

            if (string.Equals(repositoryType, Pipelines.RepositoryTypes.Bitbucket, StringComparison.OrdinalIgnoreCase) ||
                string.Equals(repositoryType, Pipelines.RepositoryTypes.GitHub, StringComparison.OrdinalIgnoreCase) ||
                string.Equals(repositoryType, Pipelines.RepositoryTypes.GitHubEnterprise, StringComparison.OrdinalIgnoreCase))
            {
                sourceProvider = new AuthenticatedGitSourceProvider();
            }
            else if (string.Equals(repositoryType, Pipelines.RepositoryTypes.ExternalGit, StringComparison.OrdinalIgnoreCase))
            {
                sourceProvider = new ExternalGitSourceProvider();
            }
            else if (string.Equals(repositoryType, Pipelines.RepositoryTypes.Git, StringComparison.OrdinalIgnoreCase))
            {
                sourceProvider = new TfsGitSourceProvider();
            }
            else if (string.Equals(repositoryType, Pipelines.RepositoryTypes.Tfvc, StringComparison.OrdinalIgnoreCase))
            {
                sourceProvider = new TfsVCSourceProvider();
            }
            else if (string.Equals(repositoryType, Pipelines.RepositoryTypes.Svn, StringComparison.OrdinalIgnoreCase))
            {
                sourceProvider = new SvnSourceProvider();
            }
            else
            {
                throw new NotSupportedException(repositoryType);
            }

            return(sourceProvider);
        }