상속: ViewModelBase
예제 #1
0
        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();
     }
 }
예제 #3
0
 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();
 }
예제 #4
0
 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();
 }
예제 #5
0
        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();
        }
예제 #6
0
        void PerformActivate()
        {
            var selectedBranch = Repositories.SelectedBranch;

            if (selectedBranch == null)
            {
                return;
            }
            if (sw.ElapsedMilliseconds < 5000)
            {
                return;
            }
            selectedBranch.RefreshMergeRequest();
            RepositoriesViewModel.RaiseRefreshSelectedBranch();
            sw.Restart();
        }
예제 #7
0
        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();
        }
예제 #8
0
        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;
            }
        }
예제 #9
0
 public void CloseMergeRequest()
 {
     this.gitLabWrapper.CloseMergeRequest(MergeRequest.MergeRequest);
     MergeRequest = null;
     RepositoriesViewModel.RaiseRefreshSelectedBranch();
 }
예제 #10
0
 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();
 }
예제 #12
0
 void UpdateConfigs(TrackRepository trackRepository, RepositoriesViewModel repositories)
 {
     RepoConfig = repositories.RepoConfigs[trackRepository.ConfigName];
 }