public GitPath(IGitSourceControlProvider provider, string sourcePath) { if (provider == null) throw new ArgumentNullException("provider"); if (string.IsNullOrEmpty(sourcePath)) return; // pathParts => [repoName][repoPath] var pathParts = (sourcePath ?? "").Split(new[] { GitPath.RepositorySeparatorChar }, 2); if (pathParts.Length != 2) pathParts = new[] { pathParts[0], "" }; this.Repository = provider.Repositories.SingleOrDefault(repo => repo.RepositoryName == pathParts[0]); // now split out the branch var relativePathParts = pathParts[1].Split(new[] { GitPath.BranchSeparatorChar }, 2); if (relativePathParts.Length == 2) { this.PathSpecifiedBranch = relativePathParts[0]; this.RelativePath = relativePathParts[1]; } else { this.RelativePath = pathParts[1]; } var agent = provider.Agent; this.PathOnDisk = agent.CombinePath(this.Repository.GetFullRepositoryPath(agent), this.RelativePath); this.Branch = this.PathSpecifiedBranch; if (string.IsNullOrEmpty(this.Branch)) this.Branch = "master"; }
public GitPath(IGitSourceControlProvider provider, string sourcePath) { if (provider == null) { throw new ArgumentNullException("provider"); } if (string.IsNullOrEmpty(sourcePath)) { return; } var match = GitPathRegex.Match(sourcePath); if (!match.Success) { throw new ArgumentException("Invalid source path (missing repository name)."); } var repositoryName = match.Groups[1].Value; var branchName = match.Groups[2].Value; var repositoryPath = (match.Groups[3].Value ?? string.Empty).TrimStart('/'); IGitRepository repository; if (string.IsNullOrEmpty(branchName)) { branchName = "master"; } else { this.PathSpecifiedBranch = branchName; } if (!string.IsNullOrEmpty(repositoryName)) { repository = provider.Repositories.FirstOrDefault(r => r.RepositoryName == repositoryName); if (repository == null) { throw new ArgumentException("Invalid repository: " + repositoryName); } } else { repository = provider.Repositories.FirstOrDefault(); if (repository == null) { throw new InvalidOperationException("No repositories are defined in this provider."); } } this.Branch = branchName; this.Repository = repository; this.RelativePath = repositoryPath; this.PathOnDisk = provider.Agent.CombinePath(repository.GetFullRepositoryPath(provider.Agent), repositoryPath); }
public GitSourceControlProviderCommon(IGitSourceControlProvider ownerProvider, string gitExePath) { this.owner = ownerProvider; this.gitClient = new Lazy<GitClientBase>( () => { if (string.IsNullOrEmpty(gitExePath)) return new LilGitClient(this); else return new StandardGitClient(this, gitExePath); } ); }
public GitSourceControlProviderCommon(IGitSourceControlProvider ownerProvider, string gitExePath) { this.owner = ownerProvider; this.gitClient = new Lazy <GitClientBase>( () => { if (string.IsNullOrEmpty(gitExePath)) { return(new LilGitClient(this)); } else { return(new StandardGitClient(this, gitExePath)); } } ); }
public GitPath(IGitSourceControlProvider provider, string sourcePath) { if (provider == null) { throw new ArgumentNullException("provider"); } if (string.IsNullOrEmpty(sourcePath)) { return; } // pathParts => [repoName][repoPath] var pathParts = (sourcePath ?? "").Split(new[] { GitPath.RepositorySeparatorChar }, 2); if (pathParts.Length != 2) { pathParts = new[] { pathParts[0], "" } } ; this.Repository = provider.Repositories.SingleOrDefault(repo => repo.RepositoryName == pathParts[0]); // now split out the branch var relativePathParts = pathParts[1].Split(new[] { GitPath.BranchSeparatorChar }, 2); if (relativePathParts.Length == 2) { this.PathSpecifiedBranch = relativePathParts[0]; this.RelativePath = relativePathParts[1]; } else { this.RelativePath = pathParts[1]; } var agent = provider.Agent; this.PathOnDisk = agent.CombinePath(this.Repository.GetFullRepositoryPath(agent), this.RelativePath); this.Branch = this.PathSpecifiedBranch; if (string.IsNullOrEmpty(this.Branch)) { this.Branch = "master"; } }
public GitPath(IGitSourceControlProvider provider, string sourcePath) { if (provider == null) throw new ArgumentNullException("provider"); if (string.IsNullOrEmpty(sourcePath)) return; var match = GitPathRegex.Match(sourcePath); if (!match.Success) throw new ArgumentException("Invalid source path (missing repository name)."); var repositoryName = match.Groups[1].Value; var branchName = match.Groups[2].Value; var repositoryPath = (match.Groups[3].Value ?? string.Empty).TrimStart('/'); SourceRepository repository; if (string.IsNullOrEmpty(branchName)) branchName = "master"; else this.PathSpecifiedBranch = branchName; if (!string.IsNullOrEmpty(repositoryName)) { repository = provider.Repositories.FirstOrDefault(r => r.Name == repositoryName); if (repository == null) throw new ArgumentException("Invalid repository: " + repositoryName); } else { repository = provider.Repositories.FirstOrDefault(); if (repository == null) throw new InvalidOperationException("No repositories are defined in this provider."); } this.Branch = branchName; this.Repository = repository; this.RepositoryRelativePath = repositoryPath; this.WorkspaceDiskPath = provider.Agent.CombinePath(repository.GetDiskPath(provider.Agent), repositoryPath); }
public StandardGitClient(IGitSourceControlProvider provider, string gitExePath) : base(provider) { this.gitExePath = gitExePath; }
protected GitClientBase(IGitSourceControlProvider provider) { this.Provider = provider; }
public StandardGitClient(IGitSourceControlProvider provider, string gitExePath) : base(provider) { this.gitExePath = gitExePath; }
public LilGitClient(IGitSourceControlProvider provider) : base(provider) { }
public LilGitClient(IGitSourceControlProvider provider) : base(provider) { }
protected GitClientBase(IGitSourceControlProvider provider) { this.Provider = provider; }