public bool PerformExtraction() { if (index >= this.commits.Count) { return(false); } CommitItem commitItem = this.commits[this.index]; extractHandler(commitItem); index++; return(true); }
static string CalcAuthor(CommitItem localCommit, User defaultUser) { string author = localCommit.Author; if (string.IsNullOrEmpty(author)) author = localCommit.Items.FirstOrDefault(x => !string.IsNullOrEmpty(x.User))?.User; if (!IsServiceUser(author, defaultUser.UserName)) return author; var comment = localCommit.Items.FirstOrDefault(x => CommentWrapper.IsAutoSyncComment(x.Comment)); if (comment == null) return author; var commentWrapper = CommentWrapper.Parse(comment.Comment); return commentWrapper.Author; }
static bool IsLabel(CommitItem item) { return item.Items.Any(x => !string.IsNullOrEmpty(x.Label)); }
static CommentWrapper CalcComment(CommitItem item, string author, string token) { CommentWrapper comment = new CommentWrapper(); comment.TimeStamp = item.TimeStamp.Ticks.ToString(); comment.Author = author; comment.Branch = item.Track.Branch; comment.Token = token; if (item.Items.Any(x => !string.IsNullOrEmpty(x.Comment) && CommentWrapper.IsAutoSyncComment(x.Comment))) comment.Comment = item.Items.Select(x => CommentWrapper.Parse(x.Comment ?? x.Message).Comment).FirstOrDefault(x => !string.IsNullOrEmpty(x)); else comment.Comment = item.Items.FirstOrDefault(x => !string.IsNullOrEmpty(x.Comment))?.Comment; return comment; }
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; } } }