コード例 #1
0
        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");
        }
コード例 #2
0
ファイル: PushPullDialog.cs プロジェクト: pvginkel/VisualGit
        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();
        }
コード例 #3
0
        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();
        }