示例#1
0
        public override async 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(await tcs.Task.ConfigureAwait(continueOnCapturedContext : false));
            }
            else
            {
                var parameters = options.GetLogParameters();
                parameters.References = new[] { Revision.Pointer };
                parameters.Paths      = new[] { Path };
                parameters.Follow     = FollowRenames;

                progress?.Report(new OperationProgress(Resources.StrsFetchingLog.AddEllipsis()));
                var revisionData = await Repository
                                   .Accessor
                                   .QueryRevisions
                                   .InvokeAsync(parameters, progress, cancellationToken)
                                   .ConfigureAwait(continueOnCapturedContext: false);

                progress?.Report(OperationProgress.Completed);
                var revisions = Repository.Revisions.Resolve(revisionData);
                return(new RevisionLog(Repository, revisions));
            }
        }
示例#2
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));
            }
        }
示例#3
0
        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
        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));
            }
        }
示例#5
0
        public override async Task <RevisionLog> GetRevisionLogAsync(LogOptions options, IProgress <OperationProgress> progress, CancellationToken cancellationToken)
        {
            Verify.Argument.IsNotNull(options, nameof(options));

            if (Repository.IsEmpty)
            {
                return(await TaskUtility
                       .TaskFromResult(new RevisionLog(Repository, new Revision[0]))
                       .ConfigureAwait(continueOnCapturedContext: false));
            }
            else
            {
                progress?.Report(new OperationProgress(Resources.StrsFetchingLog.AddEllipsis()));
                var parameters   = options.GetLogParameters();
                var revisionData = await Repository
                                   .Accessor
                                   .QueryRevisions
                                   .InvokeAsync(parameters, progress, cancellationToken)
                                   .ConfigureAwait(continueOnCapturedContext: false);

                var revisions = Repository.Revisions.Resolve(revisionData);
                return(new RevisionLog(Repository, revisions));
            }
        }
示例#6
0
 public abstract Task<RevisionLog> GetRevisionLogAsync(LogOptions options, IProgress<OperationProgress> progress, CancellationToken cancellationToken);
示例#7
0
 public abstract Task <RevisionLog> GetRevisionLogAsync(LogOptions options, IProgress <OperationProgress> progress, CancellationToken cancellationToken);
示例#8
0
        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);
            }
        }