コード例 #1
0
        public override Task <RevisionLog> GetRevisionLogAsync(LogOptions options, IProgress <OperationProgress> progress, CancellationToken cancellationToken)
        {
            Verify.Argument.IsNotNull(options, nameof(options));

            if (Repository.IsEmpty)
            {
                return(TaskUtility.TaskFromResult(new RevisionLog(Repository, new Revision[0])));
            }
            else
            {
                progress?.Report(new OperationProgress(Resources.StrsFetchingLog.AddEllipsis()));
                var parameters = options.GetLogParameters();
                return(Repository
                       .Accessor
                       .QueryRevisions.InvokeAsync(parameters, progress, cancellationToken)
                       .ContinueWith(
                           t =>
                {
                    progress?.Report(OperationProgress.Completed);
                    var revisionData = TaskUtility.UnwrapResult(t);
                    var revisions = Repository.Revisions.Resolve(revisionData);
                    var revisionLog = new RevisionLog(Repository, revisions);

                    return revisionLog;
                },
                           cancellationToken,
                           TaskContinuationOptions.ExecuteSynchronously,
                           TaskScheduler.Default));
            }
        }
コード例 #2
0
ファイル: PathLogSource.cs プロジェクト: egortech/gitter
        public override Task <RevisionLog> GetRevisionLogAsync(LogOptions options, IProgress <OperationProgress> progress, CancellationToken cancellationToken)
        {
            if (Repository.IsEmpty)
            {
                var tcs = new TaskCompletionSource <RevisionLog>();
                if (cancellationToken.IsCancellationRequested)
                {
                    tcs.SetCanceled();
                }
                else
                {
                    tcs.SetResult(new RevisionLog(Repository, new Revision[0]));
                }
                return(tcs.Task);
            }
            else
            {
                var parameters = options.GetLogParameters();
                parameters.References = new[] { Revision.Pointer };
                parameters.Paths      = new[] { Path };
                parameters.Follow     = FollowRenames;

                if (progress != null)
                {
                    progress.Report(new OperationProgress(Resources.StrsFetchingLog.AddEllipsis()));
                }
                return(Repository.Accessor
                       .QueryRevisions.InvokeAsync(parameters, progress, cancellationToken)
                       .ContinueWith(
                           t =>
                {
                    if (progress != null)
                    {
                        progress.Report(OperationProgress.Completed);
                    }
                    var revisionData = TaskUtility.UnwrapResult(t);
                    var revisions = Repository.Revisions.Resolve(revisionData);
                    var revisionLog = new RevisionLog(Repository, revisions);

                    return revisionLog;
                },
                           cancellationToken,
                           TaskContinuationOptions.ExecuteSynchronously,
                           TaskScheduler.Default));
            }
        }
コード例 #3
0
ファイル: RepositoryLogSource.cs プロジェクト: Kuzq/gitter
        public override Task<RevisionLog> GetRevisionLogAsync(LogOptions options, IProgress<OperationProgress> progress, CancellationToken cancellationToken)
        {
            Verify.Argument.IsNotNull(options, "options");

            if(Repository.IsEmpty)
            {
                return TaskUtility.TaskFromResult(new RevisionLog(Repository, new Revision[0]));
            }
            else
            {
                if(progress != null)
                {
                    progress.Report(new OperationProgress(Resources.StrsFetchingLog.AddEllipsis()));
                }
                var parameters = options.GetLogParameters();
                return Repository.Accessor
                                 .QueryRevisions.InvokeAsync(parameters, progress, cancellationToken)
                                 .ContinueWith(
                                    t =>
                                    {
                                        if(progress != null)
                                        {
                                            progress.Report(OperationProgress.Completed);
                                        }
                                        var revisionData = TaskUtility.UnwrapResult(t);
                                        var revisions    = Repository.Revisions.Resolve(revisionData);
                                        var revisionLog  = new RevisionLog(Repository, revisions);

                                        return revisionLog;
                                    },
                                    cancellationToken,
                                    TaskContinuationOptions.ExecuteSynchronously,
                                    TaskScheduler.Default);
            }
        }
コード例 #4
0
ファイル: PathLogSource.cs プロジェクト: Kuzq/gitter
        public override Task<RevisionLog> GetRevisionLogAsync(LogOptions options, IProgress<OperationProgress> progress, CancellationToken cancellationToken)
        {
            if(Repository.IsEmpty)
            {
                var tcs = new TaskCompletionSource<RevisionLog>();
                if(cancellationToken.IsCancellationRequested)
                {
                    tcs.SetCanceled();
                }
                else
                {
                    tcs.SetResult(new RevisionLog(Repository, new Revision[0]));
                }
                return tcs.Task;
            }
            else
            {
                var parameters = options.GetLogParameters();
                parameters.References = new[] { Revision.Pointer };
                parameters.Paths = new[] { Path };
                parameters.Follow = FollowRenames;

                if(progress != null)
                {
                    progress.Report(new OperationProgress(Resources.StrsFetchingLog.AddEllipsis()));
                }
                return Repository.Accessor
                                 .QueryRevisions.InvokeAsync(parameters, progress, cancellationToken)
                                 .ContinueWith(
                                    t =>
                                    {
                                        if(progress != null)
                                        {
                                            progress.Report(OperationProgress.Completed);
                                        }
                                        var revisionData = TaskUtility.UnwrapResult(t);
                                        var revisions    = Repository.Revisions.Resolve(revisionData);
                                        var revisionLog  = new RevisionLog(Repository, revisions);

                                        return revisionLog;
                                    },
                                    cancellationToken,
                                    TaskContinuationOptions.ExecuteSynchronously,
                                    TaskScheduler.Default);
            }
        }