public async Task <string> RunAsync(PullRequestOptions options) { RepositoryInfo repoInfo = await _repoitoryInfoRetriever.GetAsync(); Tracer.LogInfo($"Found the following repo info: Base url {repoInfo.BaseUrl}, Name: {repoInfo.RepositoryName}"); string currentBranch = _gitClient.GetCurrentBranch(); Tracer.LogVerbose($"Current branch: {currentBranch}"); string title = string.IsNullOrWhiteSpace(options.Title) ? $"Merge {currentBranch} to {repoInfo.DefaultBranchRef}" : options.Title; var prRequestMessage = new PrRequestMessage { Title = title, Description = string.IsNullOrWhiteSpace(options.Description) ? title : options.Description, SourceRefName = $"refs/heads/{currentBranch}", TargetRefName = repoInfo.DefaultBranchRef }; Tracer.LogInfo($"Creating PR with title '{title}'"); string pullRequestId = await _vstsClient.CreatePullRequestAsync(repoInfo, prRequestMessage); return($"{repoInfo.BaseUrl}/_git/{repoInfo.RepositoryName}/pullrequest/{pullRequestId}?_a=overview"); }
protected void LoadRemotes(GitClient client, ComboBox remoteBox) { var config = client.GetConfig(RepositoryPath); var currentBranch = client.GetCurrentBranch(RepositoryPath); string currentBranchRemote = config.GetString("branch", currentBranch.ShortName, "remote"); remoteBox.BeginUpdate(); remoteBox.Items.Clear(); foreach (string remote in config.GetSubsections("remote")) { remoteBox.Items.Add(remote); if (remote == currentBranchRemote) remoteBox.SelectedIndex = remoteBox.Items.Count - 1; } remoteBox.EndUpdate(); }
public void LoadFromClient(GitClient client) { localBox.BeginUpdate(); remoteBox.BeginUpdate(); localBox.Items.Clear(); remoteBox.Items.Clear(); var currentBranch = client.GetCurrentBranch(RepositoryPath); foreach (var @ref in client.GetRefs(RepositoryPath)) { if (@ref.Type == GitRefType.Branch) { remoteBox.Items.Add(@ref.ShortName); localBox.Items.Add(@ref.ShortName); if (@ref == currentBranch) { remoteBox.SelectedIndex = remoteBox.Items.Count - 1; localBox.SelectedIndex = remoteBox.Items.Count - 1; } } } localBox.EndUpdate(); remoteBox.EndUpdate(); }