Skip to content

Commit

Permalink
(cake-buildGH-2657) Rename TFBuildRepositoryInfo.Branch to TFBuildRep…
Browse files Browse the repository at this point in the history
…ositoryInfo.SourceBranchName
  • Loading branch information
pascalberger committed Nov 20, 2019
1 parent 7494c7e commit bc0dee7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,25 @@ public void Should_Return_Correct_Value()
var info = new TFBuildInfoFixture().CreateRepositoryInfo();

// When
#pragma warning disable 618
var result = info.Branch;
#pragma warning restore 618

// Then
Assert.Equal("develop", result);
}
}

public sealed class TheSourceBranchNameProperty
{
[Fact]
public void Should_Return_Correct_Value()
{
// Given
var info = new TFBuildInfoFixture().CreateRepositoryInfo();

// When
var result = info.SourceBranchName;

// Then
Assert.Equal("develop", result);
Expand Down
12 changes: 11 additions & 1 deletion src/Cake.Common/Build/TFBuild/Data/TFBuildRepositoryInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using Cake.Core;

namespace Cake.Common.Build.TFBuild.Data
Expand Down Expand Up @@ -34,7 +35,16 @@ public TFBuildRepositoryInfo(ICakeEnvironment environment)
/// <value>
/// The SCM branch name
/// </value>
public string Branch => GetEnvironmentString("BUILD_SOURCEBRANCHNAME");
public string SourceBranchName => GetEnvironmentString("BUILD_SOURCEBRANCHNAME");

/// <summary>
/// Gets name of the branch the build was queued for.
/// </summary>
/// <value>
/// The SCM branch name
/// </value>
[Obsolete("Please use TFBuildRepositoryInfo.SourceBranchName instead")]
public string Branch => SourceBranchName;

/// <summary>
/// Gets the latest version control change that is included in this build.
Expand Down

0 comments on commit bc0dee7

Please sign in to comment.