Пример #1
0
        private static async Task RunAsync(Options opts)
        {
            Tracer.SetVerbosity(opts.Verbose);
            var prOptions = new PullRequestOptions
            {
                Title       = opts.Title,
                Description = opts.Description
            };

            string gitRepoPath = opts.GitRepositoryPath;

            if (string.IsNullOrWhiteSpace(gitRepoPath))
            {
                gitRepoPath = Directory.GetCurrentDirectory();
            }

            Tracer.LogVerbose($"Running PR creator with options {prOptions} on repo {gitRepoPath}");


            var gitClient         = new GitClient(gitRepoPath);
            var vstsClient        = new VstsClient();
            var repoInfoRetreiver = new RepoitoryInfoRetriever(gitClient, vstsClient);

            var    prCreator = new PullRequestCreator(repoInfoRetreiver, vstsClient, gitClient);
            string prUrl     = await prCreator.RunAsync(prOptions);

            Tracer.LogInfo($"PR created succesffully! PR url was copied to clipboard: {prUrl}");
            Clipboard.Copy(prUrl);
        }
Пример #2
0
 public PullRequestCreator(RepoitoryInfoRetriever repoitoryInfoRetriever, VstsClient vstsClient, GitClient gitClient)
 {
     _repoitoryInfoRetriever = repoitoryInfoRetriever;
     _vstsClient             = vstsClient;
     _gitClient = gitClient;
 }