Esempio n. 1
0
 /// <summary>
 /// Votes the roll back.
 /// </summary>
 public void VoteRollBack()
 {
     if (Transaction != null)
     {
         Commits.Add(false);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Votes the commit.
 /// </summary>
 public void VoteCommit()
 {
     if (Transaction != null)
     {
         Commits.Add(true);
     }
 }
Esempio n. 3
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;
 }
Esempio n. 4
0
 GitCommitInfo EnsureCommit(GitId id)
 {
     if (!Commits.TryGetValue(id, out var v))
     {
         Commits.Add(id, v = new GitCommitInfo(id, Repository));
     }
     return(v);
 }
Esempio n. 5
0
 private void StoreNewCommits(IEnumerable <Commit> loadedCommits)
 {
     //This has quadratic runtime, O(commits.Count * newlist.Count),
     //but thats ok as long as newlist.Count is limited to 10
     foreach (var commit in loadedCommits)
     {
         if (!Enumerable.Contains(Commits, commit))
         {
             Commits.Add(commit);
         }
     }
 }
Esempio n. 6
0
        private void AddCommits(IEnumerable <GitCommit> commits)
        {
            foreach (var v in commits)
            {
                if (v == null)
                {
                    return;
                }

                if (Commits.ContainsKey(v.Id))
                {
                    return;
                }

                Commits.Add(v.Id, new GitCommitInfo(v.Id, Repository));
            }
        }
        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);
            }
        }
Esempio n. 8
0
        public string Commit(string message)
        {
            if (string.IsNullOrWhiteSpace(message))
            {
                throw new ArgumentNullException();
            }
            var newObj = new HashSet <T>(this.Select(item => (T)item.Clone()));
            var commit = new Commit <T>(message, newObj);
            var key    = $"{commit.HashSet.GetHashCode()}-{EpochTime}";

            Histories.Add(key);
            Commits.Add(key, commit);
            if (Commits.Count > MaxHistory)
            {
                var old = Histories.Last();
                Commits.Remove(old);
                Histories.Remove(old);
            }
            return(key);
        }
Esempio n. 9
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);
            }
        }
Esempio n. 10
0
 public virtual void AddCommit(Commit commit)
 {
     commit.Branches.Add(this);
     Commits.Add(commit);
 }
Esempio n. 11
0
        void UpdateContent(Tuple <double, double, double, double> screenBoundaries)
        {
            if (Model.Commits.Count == 0)
            {
                return;
            }
            List <CommitNodeViewModel>  badCommits  = Commits.Where(commit => commit.Location.X > screenBoundaries.Item3 || commit.Location.X + 251 < screenBoundaries.Item1).ToList();
            List <BranchLabelViewModel> badBranches = Branches.Where(branch => branch.Location.X > screenBoundaries.Item3 || branch.Location.X + 251 < screenBoundaries.Item1 && branch.HitTestVisible).ToList();
            List <Edge> badEdges = Edges.Where(edge => (edge.Sink.X < screenBoundaries.Item1 - 251 && edge.Source.X < screenBoundaries.Item1 - 251) || (edge.Sink.X > screenBoundaries.Item3 + 300 && edge.Source.X > screenBoundaries.Item3 + 300)).ToList();

            foreach (var edge in badEdges)
            {
                Edges.Remove(edge); View.Children.Remove(edge);
            }
            foreach (var bb in badBranches)
            {
                View.Children.Remove(bb.Control); Branches.Remove(bb); bb.UnsubscribeModel();
            }
            List <Point> badCommitLocations = badCommits.Select(commit => commit.Location).ToList();

            foreach (var bc in badCommits)
            {
                View.Children.Remove(bc.Control); Commits.Remove(bc); bc.UnsubscribeModel();
            }
            List <Point>            commitLocations = Commits.Select(commit => commit.Location).ToList();
            List <Point>            branchLocations = Branches.Select(branch => branch.Location).ToList();
            List <CommitNodeModel>  newCommits = new List <CommitNodeModel>();
            List <BranchLabelModel> newBranches = new List <BranchLabelModel>();
            int f, c;

            for (f = 0; f < Model.Commits.Count; f++)
            {
                if (Model.Commits[f].Location.X + 251 >= screenBoundaries.Item1)
                {
                    break;
                }
            }
            for (c = f; c < Model.Commits.Count; c++)
            {
                if (Model.Commits[c].Location.X <= screenBoundaries.Item3)
                {
                    if (!commitLocations.Contains(Model.Commits[c].Location))
                    {
                        newCommits.Add(Model.Commits[c]);
                    }
                }
                else
                {
                    break;
                }
            }
            foreach (CommitNodeModel m in newCommits)
            {
                CommitNodeView      v  = new CommitNodeView();
                CommitNodeViewModel vm = new CommitNodeViewModel(m, v);
                v.Update();
                Commits.Add(vm);
                View.Children.Add(v);
            }
            for (c = 0; c < Model.Branches.Count; c++)
            {
                if (!branchLocations.Contains(Model.Branches[c].Location) && newCommits.Any(commit => commit.Commit == Model.Branches[c].Branch.Tip))
                {
                    newBranches.Add(Model.Branches[c]);
                }
            }
            foreach (BranchLabelModel m in newBranches)
            {
                BranchLabelView      v  = new BranchLabelView();
                BranchLabelViewModel vm = new BranchLabelViewModel(m, v);
                View.Children.Add(v);
                Branches.Add(vm);
            }
            foreach (var m in newCommits)
            {
                foreach (var pair in Model.Edges[m])
                {
                    Point source = new Point(pair.Item2.Location.X, pair.Item2.Location.Y + 20);
                    Point sink   = new Point(pair.Item1.Location.X + pair.Item1.MaxWidth, pair.Item1.Location.Y + 20);
                    if (!Edges.Any(edge => edge.Source == source && edge.Sink == sink))
                    {
                        Edge edge = new Edge()
                        {
                            Source = source, Sink = sink, StrokeThickness = 2, Stroke = new SolidColorBrush(Colors.Gray)
                        };
                        Edges.Add(edge);
                        View.Children.Add(edge);
                    }
                }
            }
        }
Esempio n. 12
0
 internal void ForceDispose()
 {
     Commits.Add(false);
     this.InternalDispose();
 }