public void CreateMergeRequest(string title, string description, string user, string sourceBranch, string targetBranch) { var mergeRequest = this.gitLabWrapper.CreateMergeRequest(Repository.Origin, Repository.Upstream, title, description, user, sourceBranch, targetBranch); MergeRequest = new MergeRequestViewModel(this, mergeRequest); RepositoriesViewModel.RaiseRefreshSelectedBranch(); }
void PerformApply() { if (Repositories.Config.AlwaysSure || MessageBoxService.Show("Are you sure?", "Update merge request", MessageBoxButton.OKCancel) == MessageBoxResult.OK) { Branch.UpdateMergeRequest(CalcMergeRequestTitle(Comment), CalcMergeRequestDescription(Comment), CalcServiceName()); Branch.AddMergeRequestSyncInfo(PerformTesting, AssignedToService); IsModified = false; RepositoriesViewModel.RaiseRefreshSelectedBranch(); } }
public RepositoryViewModel(string name, TrackRepository trackRepository, RepositoriesViewModel repositories) { TrackRepository = trackRepository; GitLabWrapper = new GitLabWrapper(TrackRepository.Server, TrackRepository.Token); HasAdminPrivileges = GitLabWrapper.IsAdmin(); GitReader = new GitReaderWrapper(trackRepository.LocalPath); UpdateConfigs(trackRepository, repositories); Repositories = repositories; Origin = GitLabWrapper.FindProject(GitReader.GetOriginRepoPath()); Upstream = GitLabWrapper.FindProject(GitReader.GetUpstreamRepoPath()); Name = name; Update(); }
public void CreateMergeRequest(string title, string description, string user, string sourceBranch, string targetBranch) { var mergeRequest = this.gitLabWrapper.CreateMergeRequest(Repository.Origin, Repository.Upstream, title, description, user, sourceBranch, targetBranch); MergeRequest = new MergeRequestViewModel(this, mergeRequest); if (SupportsTesting && Repositories.Config.TestByDefault) { AddMergeRequestSyncInfo(true, false); mergeRequest = this.gitLabWrapper.UpdateMergeRequestAssignee(mergeRequest, Repository.RepoConfig.TestServiceName); MergeRequest = new MergeRequestViewModel(this, mergeRequest); } RepositoriesViewModel.RaiseRefreshSelectedBranch(); }
void PerformActivate() { var selectedBranch = Repositories.SelectedBranch; if (selectedBranch == null) { return; } if (sw.ElapsedMilliseconds < 5000) { return; } selectedBranch.RefreshMergeRequest(); RepositoriesViewModel.RaiseRefreshSelectedBranch(); sw.Restart(); }
void ProcessBuildHook(BuildHookClient hook) { var selectedBranch = Repositories?.SelectedBranch; var mergeRequest = selectedBranch?.MergeRequest; if (mergeRequest == null) { return; } if (mergeRequest.SourceBranch != hook.Branch) { return; } if (selectedBranch.Repository?.Origin?.Id != hook.ProjectId) { return; } selectedBranch.RefreshMergeRequest(); RepositoriesViewModel.RaiseRefreshSelectedBranch(); }
void ProcessMergeRequestHook(MergeRequestHookClient hook) { if (Repositories == null) { return; } int mergeRequestId = hook.Attributes.Id; var selectedBranch = Repositories.SelectedBranch; if (selectedBranch != null) { var mergeRequest = selectedBranch.MergeRequest; if (mergeRequest != null) { if (mergeRequest.MergeRequestId == mergeRequestId) { selectedBranch.RefreshMergeRequest(); RepositoriesViewModel.RaiseRefreshSelectedBranch(); Log.Message("Selected branch refreshed."); } } } if (Repositories.Repositories == null) { return; } foreach (var repo in Repositories.Repositories) { var branch = repo.Branches.Where(x => x.MergeRequest != null).FirstOrDefault(x => x.MergeRequest.MergeRequestId == mergeRequestId); if (branch != null) { ShowMergeRequestNotification(branch, hook); } break; } }
public void CloseMergeRequest() { this.gitLabWrapper.CloseMergeRequest(MergeRequest.MergeRequest); MergeRequest = null; RepositoriesViewModel.RaiseRefreshSelectedBranch(); }
void UpdateConfigs(TrackRepository trackRepository, RepositoriesViewModel repositories) { RepoConfig = repositories.RepoConfigs[trackRepository.ConfigName]; }
void UseCommitDescription(CommitViewModel commit) { BranchViewModel.UpdateMergeRequest(commit.Title, BranchViewModel.MergeRequest.MergeRequest.Description, BranchViewModel.MergeRequest.Assignee); RepositoriesViewModel.RaiseRefreshSelectedBranch(); }