private Svn CreateSvnSvc(ISvcRepository repo) { string repoPath = WorkspacePathProvider.SvnRepositoryPath(this.sync); var user = this.retriever.GetUser(repo.CheckoutUser.Id); string login = user.RepositoryCredentials.FirstOrDefault(c => c.RepositoryType == repo.Type)?.Login; if (login == null) { throw new InvalidOperationException($"User {repo.CheckoutUser.Name} does not have {repo.Type} credentials."); } string password = this.retriever.GetPassword(repo.CheckoutUser.Id, repo.Type); var svn = new Svn(this.sync, repo, repoPath, login, password, this.syncLogger); return(svn); }
private Git CreateGitSvc(ISvcRepository repo, string refspec) { string repoPath = WorkspacePathProvider.GitRepositoryPath(this.sync); var user = this.retriever.GetUser(repo.CheckoutUser.Id); string login = user.RepositoryCredentials.FirstOrDefault(c => c.RepositoryType == repo.Type)?.Login; if (login == null) { this.syncLogger.Log(this.sync, $"User {repo.CheckoutUser.Name} does not have {repo.Type} credentials. Trying with anonymous authentication."); } string password = login == null ? null : this.retriever.GetPassword(repo.CheckoutUser.Id, repo.Type); var git = new Git(this.sync, repo, repoPath, login, password, refspec, this.syncLogger); return(git); }