示例#1
0
        public IList <CommitItem> MergeCommits(IList <CommitItem> commits)
        {
            var        result     = new List <CommitItem>();
            CommitItem prevCommit = null;

            foreach (var commit in commits)
            {
                var canMerge =
                    prevCommit != null &&
                    commit.Items[0].User == prevCommit.Items[0].User &&
                    commit.Items[0].Comment == prevCommit.Items[0].Comment &&
                    (commit.Items[0].ActionDate - prevCommit.Items[0].ActionDate).TotalSeconds < 20;
                if (canMerge)
                {
                    foreach (var item in commit.Items)
                    {
                        prevCommit.Items.Add(item);
                    }
                    prevCommit.TimeStamp = commit.Items[0].ActionDate;
                    continue;
                }
                result.Add(commit);
                prevCommit = commit;
            }
            return(result);
        }
 private void ReloadCommits()
 {
     comboBoxRevision.Items.Clear();
     if (comboBoxBranch.SelectedItem != null)
     {
         var commits = _adapter.GetCommits(_adapter.CurrentRepo, comboBoxBranch.SelectedItem.ToString());
         foreach (var item in commits)
         {
             CommitItem ci = new CommitItem()
             {
                 value = item
             };
             comboBoxRevision.Items.Add(ci);
         }
         comboBoxRevision.SelectedIndex = 1;
     }
 }
示例#3
0
        public IEnumerable <CommitItem> GetCommits(DateTime timeStamp, IList <HistoryItem> items)
        {
            var changedProjects = items.GroupBy(x => x.Track.Path);

            foreach (var project in changedProjects)
            {
                var changeSet = project.GroupBy(x => x.User);
                foreach (var changeItem in changeSet)
                {
                    CommitItem item = new CommitItem();
                    var        last = changeItem.Last();
                    item.Author    = last.User;
                    item.Items     = changeItem.ToList();
                    item.Track     = last.Track;
                    item.TimeStamp = timeStamp;
                    yield return(item);
                }
            }
        }
        public static List <ICommitItem> ToCommitItems(this Collection <SvnLogEventArgs> list, Uri repoPath, IMediatorService mediator, int secondsToTimeout,
                                                       Action <SvnRevision, Uri, SvnChangeItem, int> onViewChangeDetails, string repoName)
        {
            var result = new List <ICommitItem>();

            list.ToList().ForEach(i =>
            {
                var svnItem = new CommitItem()
                {
                    Author         = i.Author,
                    Date           = i.Time,
                    LogMessage     = i.LogMessage,
                    Revision       = i.Revision.ToString(),
                    ItemChanges    = i.ChangedPaths != null ? i.ChangedPaths.ToItemsChanged(i.Revision, repoPath, mediator, secondsToTimeout, onViewChangeDetails) : null,
                    RepoPath       = repoPath,
                    RepositoryName = repoName
                };
                result.Add(svnItem);
            });
            return(result);
        }
        public static List <ICommitItem> ToCommitItems(this ICommitCollection list, Uri path, IMediatorService mediator, int secondsToTimeout,
                                                       Action <Commit, ObjectId, int> onViewChangeDetails, string repoName)
        {
            var result = new List <ICommitItem>();

            list.ToList().ForEach(i =>
            {
                var gitItem = new CommitItem()
                {
                    Author     = string.Format("{0} <{1}>", i.Committer.Name, i.Committer.Email),
                    Date       = i.Committer.When.DateTime,
                    LogMessage = i.Message,
                    Revision   = i.Id.ToString(),
                    // TODO: Need to provide the user a way to see the list of changes, change types, and when they click, a diff
                    ItemChanges    = null,                 // i.Tree != null ? i.Tree.ToItemsChanged(i, path, mediator, secondsToTimeout, onViewChangeDetails) : null,
                    RepoPath       = path,
                    RepositoryName = repoName
                };
                result.Add(gitItem);
            });
            return(result);
        }