static GitPullRequestService CreateGitPullRequestService()
    {
        var gitService = new LibGitService();
        var factory    = new RemoteRepositoryFactory(gitService);

        return(new GitPullRequestService(factory));
    }
Ejemplo n.º 2
0
        void OnExecute()
        {
            var repoPath = Repository.Discover(TargetDir);

            if (repoPath == null)
            {
                Console.WriteLine("Couldn't find Git repository");
                return;
            }

            Action <Exception> exceptionLogger = e => Console.WriteLine(e);
            var gitService = new DynamicGitService(new LibGitService(), new ShellGitService(), Shell);
            var factory    = new RemoteRepositoryFactory(gitService);
            var service    = new GitPullRequestService(factory);

            using (var repo = new Repository(repoPath))
            {
                if (Prune)
                {
                    PruneBranches(service, repo, exceptionLogger);
                    return;
                }

                try
                {
                    if (List || Remote != null)
                    {
                        ListBranches(service, repo, Remote, exceptionLogger);
                        return;
                    }

                    BrowsePullRequest(service, repo, exceptionLogger);
                }
                catch (LibGit2SharpException e)
                {
                    Console.WriteLine($"{e.GetType()}: {e.Message}");
                    Console.WriteLine("Please try again using the --shell option to use native git authentication");
                }
            }
        }