public IList<FileChangeInfo> QueryHistory(QueryParameters parameters) { var queryPath = parameters.Path; var queryDateFrom = new DateVersionSpec(parameters.From); var queryDateTo = new DateVersionSpec(parameters.To); var query = versionControl.QueryHistory(queryPath, VersionSpec.Latest, 0, RecursionType.Full, null, queryDateFrom, queryDateTo, int.MaxValue, true, false, false, true); var changesetsInChronologicalOrder = query.OfType<Changeset>().OrderBy(cs => cs.ChangesetId).ToList(); var fileChanges = this.GetFileChanges(changesetsInChronologicalOrder, parameters); return fileChanges; }
private Func<Change, bool> GetChangeFilter(QueryParameters parameters) { if (string.IsNullOrEmpty(parameters.FileExtension)) { return (Change a) => a.Item.ItemType != ItemType.Folder; } else { return (Change a) => a.Item.ItemType != ItemType.Folder && a.Item.ServerItem.EndsWith(parameters.FileExtension); } }
private IList<FileChangeInfo> GetFileChanges(List<Changeset> changesets, QueryParameters parameters) { var fileChanges = new List<FileChangeInfo>(); foreach (var changesetItem in changesets) { var filterPredicate = this.GetChangeFilter(parameters); var validItemChanges = changesetItem.Changes.Where(filterPredicate); foreach (var changeItem in validItemChanges) { var newInfo = CreateFileChange(changesetItem, changeItem); fileChanges.Add(newInfo); } } return fileChanges; }
private IList<FileChangeInfo> GetFileChanges() { var parameters = new QueryParameters(this.pathTextBox.Text, this.pickerFrom.SelectedDate.Value, this.pickerTo.SelectedDate.Value); parameters.FileExtension = ".cs"; var fileChanges = this.sourceControlProxy.QueryHistory(parameters); return fileChanges; }