Skip to content
This repository has been archived by the owner on Apr 6, 2024. It is now read-only.

Commit

Permalink
Merge branch 'release/0.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed Dec 20, 2017
2 parents 82568dd + df5aec3 commit a506090
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 3 deletions.
3 changes: 3 additions & 0 deletions cake.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[Nuget]
; Use the new InProcess client, because some packages have long file paths.
UseInProcessClient=true
2 changes: 1 addition & 1 deletion nuspec/nuget/Cake.Issues.PullRequests.Tfs.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ See the Project Site for an overview of the whole ecosystem of addins for workin
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<copyright>Copyright © 2017 BBT Software AG and contributors</copyright>
<tags>Cake Script Cake-Issues Cake-PullRequestSystem Issues PullRequest TFS VSTS</tags>
<releaseNotes>https://github.com/cake-contrib/Cake.Issues.PullRequests.Tfs/releases/tag/0.1.0</releaseNotes>
<releaseNotes>https://github.com/cake-contrib/Cake.Issues.PullRequests.Tfs/releases/tag/0.1.1</releaseNotes>
</metadata>
<files>
<file src="Cake.Issues.PullRequests.Tfs.dll" target="lib\net45" />
Expand Down
3 changes: 2 additions & 1 deletion setup.cake
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
17 changes: 17 additions & 0 deletions src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,23 @@ public TfsPullRequestSystem(ICakeLog log, TfsPullRequestSettings settings)
this.pullRequest.SourceRefName);
}

/// <summary>
/// Gets the hash of the latest commit on the source branch.
/// Returns <see cref="string.Empty"/> if no pull request could be found.
/// </summary>
public string LastSourceCommitId
{
get
{
if (!this.ValidatePullRequest())
{
return string.Empty;
}

return this.pullRequest.LastMergeSourceCommit.CommitId;
}
}

/// <summary>
/// Votes for the pullrequest.
/// </summary>
Expand Down
37 changes: 37 additions & 0 deletions src/Cake.Issues.PullRequests.Tfs/TfsPullRequestSystemAliases.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,5 +273,42 @@ public static void TfsVotePullRequest(
var pullRequest = new TfsPullRequestSystem(context.Log, settings);
pullRequest.Vote(vote);
}

/// <summary>
/// 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.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="settings">Settings for accessing the pull request system.</param>
/// <example>
/// <para>Get the hash of the last commit:</para>
/// <code>
/// <![CDATA[
/// var pullRequestSettings =
/// new TfsPullRequestSettings(
/// new Uri("http://myserver:8080/tfs/defaultcollection/myproject/_git/myrepository"),
/// "refs/heads/feature/myfeature",
/// TfsAuthenticationNtlm());
///
/// var hash =
/// TfsPullRequestLastSourceCommit(
/// pullRequestSettings);
/// ]]>
/// </code>
/// </example>
/// <returns>The hash of the last commit on the source branch or <see cref="string.Empty"/>
/// if no pull request could be found.</returns>
[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;
}
}
}
2 changes: 1 addition & 1 deletion tools/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake" version="0.21.1" />
<package id="Cake" version="0.23.0" />
</packages>

0 comments on commit a506090

Please sign in to comment.