public override ReadOnlyObservableCollection <ICommitItem> GetLog(Repository repo, int limit = 30, string startRevision = null, string endRevision = null) { if (repo == null) { return(null); } var allItems = new List <ICommitItem>(); using (var localRepo = new LibGit2Sharp.Repository(repo.Path.LocalPath)) { // per http://stackoverflow.com/questions/10470838/looping-through-every-commit-in-git-repository-with-libgit2sharp var commits = localRepo.Commits.QueryBy(new Filter { Since = localRepo.Refs }); allItems.AddRange(commits.ToCommitItems(repo.Path, _mediator, repo.SecondsToTimeoutDownload, OnViewChangeDetails, repo.Name)); } return(new ReadOnlyObservableCollection <ICommitItem>(new ObservableCollection <ICommitItem>(allItems))); }
public override void GetLogAsync(Repository repo, Action <ReadOnlyObservableCollection <ICommitItem> > onComplete, int limit = 30, string startRevision = null, string endRevision = null) { Task.Factory.StartNew(() => { try { onComplete(GetLog(repo, limit, startRevision, endRevision)); } catch (Exception ex) { _messageBoxService.ShowError(string.Format("Unable to get the log from '{0}'.\n\n{1}", repo.Path, ex.Message), "Error Downloading Log"); onComplete(null); } }); // TODO: either cleanly handle a cancel or just let it go forever... //if(!task.Wait(new TimeSpan(0, 0, 0, repo.SecondsToTimeoutDownload))) //{ // token.Cancel(); // _messageBoxService.ShowError(string.Format("Unable to get the log from '{0}'.", repo.Path), "Error Downloading Log"); // onComplete(null); //} }