From 007a17197708f78234c35e36c2bb8b80e5ec4b7b Mon Sep 17 00:00:00 2001 From: Fabrizio Steiner Date: Wed, 20 Dec 2017 08:30:21 +0100 Subject: [PATCH 1/5] New alias TfsPullRequestLastSourceCommit to retrieve the latest commit of the source branch of the pull request. Fixes #8 --- .../TfsPullRequestSystem.cs | 17 +++++++++ .../TfsPullRequestSystemAliases.cs | 37 +++++++++++++++++++ 2 files changed, 54 insertions(+) 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; + } } } From 0785db4dd7db069f3b8e3bbc62bd9151388c93f4 Mon Sep 17 00:00:00 2001 From: Fabrizio Steiner Date: Wed, 20 Dec 2017 10:12:19 +0100 Subject: [PATCH 2/5] Cake update to 0.23.0 --- tools/packages.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 @@ - + From a2add9a7063988337f6f44cc5befec358dd695d8 Mon Sep 17 00:00:00 2001 From: Fabrizio Steiner Date: Wed, 20 Dec 2017 10:33:24 +0100 Subject: [PATCH 3/5] Use nuget in process client because some packages have very long file paths causing installation to fail. --- cake.config | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 cake.config 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 From dce9c71e45af0666fe8fe34d0becd8025fe1b098 Mon Sep 17 00:00:00 2001 From: Fabrizio Steiner Date: Wed, 20 Dec 2017 10:39:50 +0100 Subject: [PATCH 4/5] Disable Codecov for the time being, Cake.Recipe has some problem currently. --- setup.cake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); From df5aec3cc1d431bd09b38a76c21976921b31d6de Mon Sep 17 00:00:00 2001 From: Pascal Berger Date: Wed, 20 Dec 2017 10:54:10 +0100 Subject: [PATCH 5/5] Update version number --- nuspec/nuget/Cake.Issues.PullRequests.Tfs.nuspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nuspec/nuget/Cake.Issues.PullRequests.Tfs.nuspec b/nuspec/nuget/Cake.Issues.PullRequests.Tfs.nuspec index 3459523..e34b4bc 100644 --- a/nuspec/nuget/Cake.Issues.PullRequests.Tfs.nuspec +++ b/nuspec/nuget/Cake.Issues.PullRequests.Tfs.nuspec @@ -22,7 +22,7 @@ See the Project Site for an overview of the whole ecosystem of addins for workin false Copyright © 2017 BBT Software AG and contributors Cake Script Cake-Issues Cake-PullRequestSystem Issues PullRequest TFS VSTS - https://github.com/cake-contrib/Cake.Issues.PullRequests.Tfs/releases/tag/0.1.0 + https://github.com/cake-contrib/Cake.Issues.PullRequests.Tfs/releases/tag/0.1.1