Example #1
0
 void CleareContent()
 {
     Commits.Clear();
     Branches.Clear();
     Edges.Clear();
     View.Children.Clear();
 }
        private void ComboBoxUser_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            SelectedFilters.SelectedTask = "";

            Commits.Clear();
            UserTasks.Clear();

            List <string> listTask = new List <string>();

            if (SelectedFilters.SelectedUser != null)
            {
                if (_dictionaryUserTasks.ContainsKey(SelectedFilters.SelectedUser))
                {
                    foreach (Models.Commit item in _dictionaryUserTasks[SelectedFilters.SelectedUser])
                    {
                        if (listTask.FirstOrDefault(f => f == item.Task) == null)
                        {
                            listTask.Add(item.Task);
                        }
                    }
                }
            }
            listTask.Sort();

            foreach (string item in listTask)
            {
                UserTasks.Add(item);
            }
        }
 private void ClearProperties()
 {
     Commits.Clear();
     Users.Clear();
     UserTasks.Clear();
     SelectedFilters.ClearFilter();
     _dictionaryUserTasks.Clear();
 }
Example #4
0
 private void UpdateCommitsRange(PullRequest pr)
 {
     Commits.Clear();
     Commits.Add(new CommitVm(pr.Base.Label, pr.Base.Sha));
     Commits.Add(new CommitVm(pr.Head.Label, pr.Head.Sha));
     BaseCommit = pr.Base.Sha;
     HeadCommit = pr.Head.Sha;
 }
Example #5
0
 public void Clear()
 {
     Commits?.Clear();
     Branches?.Clear();
     Edges?.Clear();
     CommitToModel?.Clear();
     ContentCleared?.Invoke();
 }
        private void FillTableCommits()
        {
            Commits.Clear();
            SelectedFilters.ClearDateTaskChanged();
            CalendarViewDateTaskChanged.SelectedDates.Clear();

            if (SelectedFilters.SelectedTask != null)
            {
                if (_dictionaryUserTasks.ContainsKey(SelectedFilters.SelectedUser))
                {
                    foreach (Models.Commit item in _dictionaryUserTasks[SelectedFilters.SelectedUser])
                    {
                        if (SelectedFilters.SelectedTask == item.Task)
                        {
                            if (DateIncludedInFilterPeriod(item.Date))
                            {
                                Commits.Add(item);

                                if (SelectedFilters.DateTaskChangedMin > item.Date ||
                                    SelectedFilters.DateTaskChangedMin == DateTime.MinValue)
                                {
                                    SelectedFilters.DateTaskChangedMin = item.Date;
                                }
                                if (SelectedFilters.DateTaskChangedMax < item.Date ||
                                    SelectedFilters.DateTaskChangedMax == DateTime.MaxValue)
                                {
                                    SelectedFilters.DateTaskChangedMax = item.Date;
                                }

                                CalendarViewDateTaskChanged.SelectedDates.Add(item.Date);
                            }
                        }
                    }
                }
            }

            if (SelectedFilters.DateTaskChangedMax == DateTime.MaxValue)
            {
                SetDisplayDateCalendatView(DateTime.Now);
            }
            else
            {
                SetDisplayDateCalendatView(SelectedFilters.DateTaskChangedMax);
            }
        }
Example #7
0
        public void FetchCommitData()
        {
            Commits.Clear();

            var logs = _gitDataProvider.Log;

            foreach (var log in logs)
            {
                var commit = new Commit();
                var author = new Author
                {
                    Name  = Author.ExtractName(log.Author),
                    Email = Author.ExtractEmail(log.Author)
                };
                commit.Author   = author;
                commit.Message  = log.CommitMsg;
                commit.DateTime = log.DateTime;

                Commits.Add(commit);
            }
        }
 public void Reset()
 {
     Commits.Clear();
     Records.Clear();
 }
Example #9
0
        /// <summary>
        /// Loads branches and commits.
        /// </summary>
        /// <param name="repo"></param>
        private void LoadBranchesAndCommits(LibGit2Sharp.Repository repo)
        {
            var dispose = false;

            if (repo == null)
            {
                repo    = new LibGit2Sharp.Repository(RepositoryFullPath);
                dispose = true;
            }

            // Small performance boosts.
            Commits.DisableNotifications();
            Branches.DisableNotifications();

            // Create commits.
            Commits.Clear();
            List <Commit> commitList = new List <Commit>();

            foreach (LibGit2Sharp.Commit commit in repo.Commits.QueryBy(new LibGit2Sharp.Filter {
                Since = repo.Branches
            }).Take(CommitsPerPage))
            {
                commitList.Add(Commit.Create(repo, commit, Tags));
            }
            Commits.AddRange(commitList);

            // Create branches.
            Branches.Clear();
            foreach (LibGit2Sharp.Branch branch in repo.Branches)
            {
                Branch b = Branch.Create(this, repo, branch);
                Branches.Add(b);
            }

            // Post-process branches (tips and tracking branches).
            foreach (Branch branch in Branches)
            {
                // Set the HEAD property if it matches.
                if (repo.Head.Name == branch.Name)
                {
                    Head = branch;
                    branch.Tip.IsHead = true;
                }

                branch.PostProcess(Branches, Commits);
            }

            // Post-process commits (commit parents).
            foreach (Commit commit in Commits)
            {
                // Set the HEAD property to a DetachedHead branch if the HEAD matched and it was null.
                if (Head == null && repo.Head.Tip.Sha == commit.Hash)
                {
                    Head = new DetachedHead
                    {
                        Tip = commit
                    };

                    commit.IsHead = true;
                }

                commit.PostProcess(Commits, Branches);
            }

            // Calculate commit visual positions for each branch tree.
            foreach (Branch branch in Branches)
            {
                RepoUtil.IncrementCommitTreeVisualPositionsRecursively(branch.Tip);
            }

            Commits.EnableNotifications();
            Branches.EnableNotifications();

            if (dispose)
            {
                repo.Dispose();
            }
        }
Example #10
0
 public void ClearHistories()
 {
     Commits.Clear();
     Histories.Clear();
 }
        /// <summary>
        /// Loads branches and commits.
        /// </summary>
        /// <param name="repo"></param>
        private void LoadBranchesAndCommits(LibGit2Sharp.Repository repo = null)
        {
            var dispose = false;

            if (repo == null)
            {
                repo    = new LibGit2Sharp.Repository(RepositoryFullPath);
                dispose = true;
            }

            // Small performance boosts.
            Commits.DisableNotifications();
            Branches.DisableNotifications();

            // Create commits.
            Commits.Clear();
            var commitList = new List <Commit>();

            foreach (var commit in repo.Commits.QueryBy(new LibGit2Sharp.Filter {
                Since = repo.Branches
            }).Take(CommitsPerPage))
            {
                commitList.Add(Commit.Create(repo, commit, Tags));
            }
            Commits.AddRange(commitList);

            // Create branches.
            Branches.Clear();
            foreach (var branch in repo.Branches)
            {
                var b = Branch.Create(this, repo, branch);
                Branches.Add(b);
            }

            // Post-process branches (tips and tracking branches).
            foreach (var branch in Branches)
            {
                // Set the HEAD property if it matches.
                if (repo.Head.Name == branch.Name)
                {
                    Head = branch;
                    branch.Tip.IsHead = true;
                }

                branch.PostProcess(Branches, Commits);
            }

            // Post-process commits (commit parents).
            foreach (var commit in Commits)
            {
                // Set the HEAD property to a DetachedHead branch if the HEAD matched and it was null.
                if (Head == null && repo.Head.Tip.Sha == commit.Hash)
                {
                    Head = new DetachedHead
                    {
                        Tip = commit
                    };

                    commit.IsHead = true;
                }

                commit.PostProcess(Commits, Branches);
            }

            // Calculate commit visual positions for each branch tree.
            foreach (var branch in Branches)
            {
                RepoUtil.IncrementCommitTreeVisualPositionsRecursively(branch.Tip);
            }

            // Fire notifications for the collections on the UI thread.
            Application.Current.Dispatcher.Invoke(
                DispatcherPriority.Normal,
                (Action)(() =>
            {
                Commits.EnableNotifications(true);
                Branches.EnableNotifications(true);

                var tabControl = UIHelper.FindChild <TabControl>(Application.Current.MainWindow, "RepositoryTabs");
                var changesetHistory = UIHelper.FindChild <ChangesetHistory>(tabControl);

                if (changesetHistory != null)
                {
                    changesetHistory.RedrawGraph();
                }
            })
                );

            if (dispose)
            {
                repo.Dispose();
            }
        }