/// <summary> /// Removes all files that were deleted and are no longer available /// </summary> private void CleanupHistory(ChangeSetHistory history) { var deletedIds = history.ChangeSets .SelectMany(set => set.Items) .Where(item => item.IsDelete()) .Select(item => item.Id); var deletedIdsHash = new HashSet <string>(deletedIds); foreach (var set in history.ChangeSets) { set.Items.RemoveAll(item => deletedIdsHash.Contains(item.Id)); } // Delete empty commits var changeSetsCopy = history.ChangeSets.ToList(); foreach (var changeSet in changeSetsCopy) { if (!changeSet.Items.Any()) { history.ChangeSets.Remove(changeSet); } } }
private static void ClearEmptyCommits(ChangeSetHistory history) { // Delete empty commits var changeSetsCopy = history.ChangeSets.ToList(); foreach (var changeSet in changeSetsCopy) { if (!changeSet.Items.Any()) { history.ChangeSets.Remove(changeSet); } } }
/// <summary> /// Removes all files that were deleted and are no longer available /// </summary> private void CleanupHistory(ChangeSetHistory history) { var deletedIdsHash = history.ChangeSets .SelectMany(set => set.Items) .Where(item => item.IsDelete()) .Select(item => item.Id).ToHashSet(); foreach (var set in history.ChangeSets) { set.Items.RemoveAll(item => deletedIdsHash.Contains(item.Id)); } ClearEmptyCommits(history); }