Пример #1
0
        public async Task FetchAsync(params RemoteBranch[] branches)
        {
            RemoteBranch other = branches.FirstOrDefault(b => b.Remote.Name != this.Name);

            if (other != null)
            {
                throw new InvalidOperationException($"Branch {other} is not from current remote");
            }

            await this.Repository.ShellAsync("fetch", this.Name, string.Join(' ', branches.Select(b => $"refs/heads/{b.Name}")));
        }
Пример #2
0
 public async Task CheckoutAsync(RemoteBranch originBranch, bool force = false) =>
 await this.ShellAsync("checkout", originBranch.FullName, force? "--force" : null);
Пример #3
0
 public async Task PushAsync(Remote remote, RemoteBranch branch) =>
 await this.ShellAsync("push", remote.Name, $"refs/remotes/{branch.Remote.Name}/{branch.Name}:refs/heads/{branch.Name}");
Пример #4
0
 public async Task MergeAsync(RemoteBranch remoteBranch, bool allowUnrelatedHistories = false) =>
 await this.ShellAsync("merge",
                       allowUnrelatedHistories? "--allow-unrelated-histories" : "--no-allow-unrelated-histories",
                       $"remotes/{remoteBranch.Remote.Name}/{remoteBranch.Name}");