diff --git a/cake.config b/cake.config new file mode 100644 index 0000000..652d5e8 --- /dev/null +++ b/cake.config @@ -0,0 +1,3 @@ +[Nuget] +; Use the new InProcess client, because some packages have long file paths. +UseInProcessClient=true \ No newline at end of file diff --git a/setup.cake b/setup.cake index ffa4d4f..fc50ab8 100644 --- a/setup.cake +++ b/setup.cake @@ -9,7 +9,8 @@ BuildParameters.SetParameters( title: "Cake.Issues.PullRequests.Tfs", repositoryOwner: "cake-contrib", repositoryName: "Cake.Issues.PullRequests.Tfs", - appVeyorAccountName: "cakecontrib"); + appVeyorAccountName: "cakecontrib", + shouldRunCodecov: false); BuildParameters.PrintParameters(Context); diff --git a/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystem.cs b/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystem.cs index 5f3f40e..3755fe0 100644 --- a/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystem.cs +++ b/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystem.cs @@ -103,6 +103,23 @@ public TfsPullRequestSystem(ICakeLog log, TfsPullRequestSettings settings) this.pullRequest.SourceRefName); } + /// + /// Gets the hash of the latest commit on the source branch. + /// Returns if no pull request could be found. + /// + public string LastSourceCommitId + { + get + { + if (!this.ValidatePullRequest()) + { + return string.Empty; + } + + return this.pullRequest.LastMergeSourceCommit.CommitId; + } + } + /// /// Votes for the pullrequest. /// diff --git a/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystemAliases.cs b/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystemAliases.cs index d92ea30..e85ff90 100644 --- a/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystemAliases.cs +++ b/src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystemAliases.cs @@ -273,5 +273,42 @@ public static void TfsVotePullRequest( var pullRequest = new TfsPullRequestSystem(context.Log, settings); pullRequest.Vote(vote); } + + /// + /// Gets the last commit hash on the source branch of the Team Foundation Server or + /// Visual Studio Team Services pull request using the specified settings. + /// + /// The context. + /// Settings for accessing the pull request system. + /// + /// Get the hash of the last commit: + /// + /// + /// + /// + /// The hash of the last commit on the source branch or + /// if no pull request could be found. + [CakeMethodAlias] + [CakeAliasCategory(PullRequestsAliasConstants.PullRequestSystemCakeAliasCategory)] + public static string TfsPullRequestLastSourceCommit( + this ICakeContext context, + TfsPullRequestSettings settings) + { + context.NotNull(nameof(context)); + settings.NotNull(nameof(settings)); + + var pullRequest = new TfsPullRequestSystem(context.Log, settings); + return pullRequest.LastSourceCommitId; + } } } diff --git a/tools/packages.config b/tools/packages.config index ba021c5..747e13e 100644 --- a/tools/packages.config +++ b/tools/packages.config @@ -1,4 +1,4 @@ - +