コード例 #1
0
ファイル: GitManager.cs プロジェクト: vaskiv99/git-client
 public async Task GitCheckoutAsync(Guid repositoryId, Guid branchId)
 {
     await Task.Run(async() =>
     {
         var repository = await _repositoriesService.GetRepositoryAsync(repositoryId).ConfigureAwait(false);
         var branch     = await _branchService.GetBranchFromRepositoryAsync(repositoryId, branchId).ConfigureAwait(false);
         await _gitService.CheckoutAsync(repository.Path, branch.Name);
     });
 }
コード例 #2
0
ファイル: CommitService.cs プロジェクト: vaskiv99/git-client
        public async Task AddCommitAsync(Guid repositoryId, Guid branchId, Models.Commit commit)
        {
            var branches = await _branchService.GetBranchFromRepositoryAsync(repositoryId);

            branches.FirstOrDefault(b => b.Id == branchId).Commits.Add(commit);
            var repo = await _repositoriesService.GetRepositoryAsync(repositoryId).ConfigureAwait(false);

            repo.Branches = branches;
            await _context.Repositories.ReplaceOneAsync(r => r.Id == repositoryId, repo);
        }