public IObservable <Octokit.Repository> PublishRepository(
     Octokit.NewRepository newRepository,
     IAccount account,
     IApiClient apiClient)
 {
     return(Observable.Defer(() => apiClient.CreateRepository(newRepository, account.Login, account.IsUser)
                             .Select(remoteRepo => new { RemoteRepo = remoteRepo, LocalRepo = activeRepository }))
            .SelectMany(repo => gitClient.SetRemote(repo.LocalRepo, "origin", new Uri(repo.RemoteRepo.CloneUrl)).Select(_ => repo))
            .SelectMany(repo => gitClient.Push(repo.LocalRepo, "master", "origin").Select(_ => repo))
            .SelectMany(repo => gitClient.Fetch(repo.LocalRepo, "origin").Select(_ => repo))
            .SelectMany(repo => gitClient.SetTrackingBranch(repo.LocalRepo, "master", "origin").Select(_ => repo.RemoteRepo)));
 }
Exemplo n.º 2
0
 public IObservable <Octokit.Repository> PublishRepository(
     Octokit.NewRepository newRepository,
     IAccount account,
     IApiClient apiClient)
 {
     return(Observable.Defer(() => Observable.Return(activeRepository))
            .SelectMany(r => apiClient.CreateRepository(newRepository, account.Login, account.IsUser)
                        .Select(gitHubRepo => Tuple.Create(gitHubRepo, r)))
            .SelectMany(repo => gitClient.SetRemote(repo.Item2, "origin", new Uri(repo.Item1.CloneUrl)).Select(_ => repo))
            .SelectMany(repo => gitClient.Push(repo.Item2, "master", "origin").Select(_ => repo))
            .SelectMany(repo => gitClient.Fetch(repo.Item2, "origin").Select(_ => repo))
            .SelectMany(repo => gitClient.SetTrackingBranch(repo.Item2, "master", "origin").Select(_ => repo.Item1)));
 }
Exemplo n.º 3
0
 public IObservable <Octokit.Repository> PublishRepository(
     Octokit.NewRepository newRepository,
     IAccount account,
     IApiClient apiClient)
 {
     return(Observable.Defer(() => apiClient.CreateRepository(newRepository, account.Login, account.IsUser)
                             .ObserveOn(RxApp.MainThreadScheduler)
                             .Select(remoteRepo => new { RemoteRepo = remoteRepo, LocalRepo = vsGitServices.GetActiveRepo() }))
            .SelectMany(async repo =>
     {
         await gitClient.SetRemote(repo.LocalRepo, "origin", new Uri(repo.RemoteRepo.CloneUrl));
         await gitClient.Push(repo.LocalRepo, "master", "origin");
         await gitClient.Fetch(repo.LocalRepo, "origin");
         await gitClient.SetTrackingBranch(repo.LocalRepo, "master", "origin");
         return repo.RemoteRepo;
     }));
 }