Skip to content

Update refs #824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/GitVersionCore.Tests/GitVersionCore.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<ItemGroup>
<Reference Include="FluentDateTime, Version=1.12.0.0, Culture=neutral, PublicKeyToken=6ccbc613702e6c71, processorArchitecture=MSIL">
<HintPath>..\packages\FluentDateTime.1.12.0\Lib\NET35\FluentDateTime.dll</HintPath>
<Reference Include="FluentDateTime, Version=1.13.0.0, Culture=neutral, PublicKeyToken=6ccbc613702e6c71, processorArchitecture=MSIL">
<HintPath>..\packages\FluentDateTime.1.13.0\lib\NET35\FluentDateTime.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="GitTools.Core, Version=0.4.0.0, Culture=neutral, processorArchitecture=MSIL">
Expand Down Expand Up @@ -193,8 +193,8 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Fody.1.29.3\build\portable-net+sl+win+wpa+wp\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.29.3\build\portable-net+sl+win+wpa+wp\Fody.targets'))" />
<Error Condition="!Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props'))" />
<Error Condition="!Exists('..\packages\Fody.1.29.4\build\dotnet\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.29.4\build\dotnet\Fody.targets'))" />
</Target>
<Import Project="..\packages\Fody.1.29.3\build\portable-net+sl+win+wpa+wp\Fody.targets" Condition="Exists('..\packages\Fody.1.29.3\build\portable-net+sl+win+wpa+wp\Fody.targets')" />
<Import Project="..\packages\Fody.1.29.4\build\dotnet\Fody.targets" Condition="Exists('..\packages\Fody.1.29.4\build\dotnet\Fody.targets')" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void CanTakeVersionFromHotfixesBranch()

// Merge hotfix branch to support
fixture.Repository.Checkout("master");
fixture.Repository.Checkout(fixture.Repository.CreateBranch("support-1.1", (Commit)fixture.Repository.Tags.Single(t => t.Name == "1.1.0").Target));
fixture.Repository.Checkout(fixture.Repository.CreateBranch("support-1.1", (Commit)fixture.Repository.Tags.Single(t => t.FriendlyName == "1.1.0").Target));
fixture.AssertFullSemver("1.1.0");

// create hotfix branch
Expand Down
2 changes: 1 addition & 1 deletion src/GitVersionCore.Tests/Mocks/MockBranch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public MockBranch()
MockCommitLog commits = new MockCommitLog();
string name;
string canonicalName;
public override string Name { get { return name; } }
public override string FriendlyName { get { return name; } }
public override ICommitLog Commits { get { return commits; } }
public override Commit Tip { get { return commits.First(); } }
public override bool IsTracking { get { return true; } }
Expand Down
2 changes: 1 addition & 1 deletion src/GitVersionCore.Tests/Mocks/MockBranchCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public override IEnumerator<Branch> GetEnumerator()

public override Branch this[string name]
{
get { return Branches.FirstOrDefault(x => x.Name == name); }
get { return Branches.FirstOrDefault(x => x.FriendlyName == name); }
}

public void Add(Branch item)
Expand Down
2 changes: 1 addition & 1 deletion src/GitVersionCore.Tests/Mocks/MockTag.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class MockTag : Tag
{

public string NameEx;
public override string Name
public override string FriendlyName
{
get { return NameEx; }
}
Expand Down
6 changes: 3 additions & 3 deletions src/GitVersionCore.Tests/packages.config
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="FluentDateTime" version="1.12.0" targetFramework="net45" />
<package id="Fody" version="1.29.3" targetFramework="net45" developmentDependency="true" />
<package id="FluentDateTime" version="1.13.0" targetFramework="net45" />
<package id="Fody" version="1.29.4" targetFramework="net45" developmentDependency="true" />
<package id="GitTools.Core" version="0.4.0-beta0004" targetFramework="net45" />
<package id="GitTools.Testing" version="1.1.0" targetFramework="net45" />
<package id="LibGit2Sharp" version="0.22.0" targetFramework="net45" />
<package id="LibGit2Sharp.NativeBinaries" version="1.0.129" targetFramework="net45" />
<package id="ModuleInit.Fody" version="1.5.8.0" targetFramework="net45" developmentDependency="true" />
<package id="ModuleInit.Fody" version="1.5.9.0" targetFramework="net45" developmentDependency="true" />
<package id="NSubstitute" version="1.10.0.0" targetFramework="net45" />
<package id="NUnit" version="2.6.4" targetFramework="net45" />
<package id="NUnitTestAdapter" version="2.0.0" targetFramework="net45" />
Expand Down
20 changes: 10 additions & 10 deletions src/GitVersionCore/BranchConfigurationCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static KeyValuePair<string, BranchConfig> GetBranchConfiguration(Commit c
}

const string format = "Multiple branch configurations match the current branch branchName of '{0}'. Matching configurations: '{1}'";
throw new Exception(string.Format(format, currentBranch.Name, string.Join(", ", matchingBranches.Select(b => b.Key))));
throw new Exception(string.Format(format, currentBranch.FriendlyName, string.Join(", ", matchingBranches.Select(b => b.Key))));
}

static KeyValuePair<string, BranchConfig>[] LookupBranchConfiguration([NotNull] Config config, [NotNull] Branch currentBranch)
Expand All @@ -50,7 +50,7 @@ static KeyValuePair<string, BranchConfig>[] LookupBranchConfiguration([NotNull]
throw new ArgumentNullException("currentBranch");
}

return config.Branches.Where(b => Regex.IsMatch(currentBranch.Name, "^" + b.Key, RegexOptions.IgnoreCase)).ToArray();
return config.Branches.Where(b => Regex.IsMatch(currentBranch.FriendlyName, "^" + b.Key, RegexOptions.IgnoreCase)).ToArray();
}


Expand Down Expand Up @@ -104,7 +104,7 @@ static KeyValuePair<string, BranchConfig> InheritBranchConfiguration(bool onlyEv
}
}

Logger.WriteInfo("Found possible parent branches: " + string.Join(", ", possibleParents.Select(p => p.Name)));
Logger.WriteInfo("Found possible parent branches: " + string.Join(", ", possibleParents.Select(p => p.FriendlyName)));

if (possibleParents.Count == 1)
{
Expand All @@ -124,14 +124,14 @@ static KeyValuePair<string, BranchConfig> InheritBranchConfiguration(bool onlyEv
if (possibleParents.Count == 0)
errorMessage = "Failed to inherit Increment branch configuration, no branches found.";
else
errorMessage = "Failed to inherit Increment branch configuration, ended up with: " + string.Join(", ", possibleParents.Select(p => p.Name));
errorMessage = "Failed to inherit Increment branch configuration, ended up with: " + string.Join(", ", possibleParents.Select(p => p.FriendlyName));

var chosenBranch = repository.Branches.FirstOrDefault(b => Regex.IsMatch(b.Name, "^develop", RegexOptions.IgnoreCase)
|| Regex.IsMatch(b.Name, "master$", RegexOptions.IgnoreCase));
var chosenBranch = repository.Branches.FirstOrDefault(b => Regex.IsMatch(b.FriendlyName, "^develop", RegexOptions.IgnoreCase)
|| Regex.IsMatch(b.FriendlyName, "master$", RegexOptions.IgnoreCase));
if (chosenBranch == null)
throw new InvalidOperationException("Could not find a 'develop' or 'master' branch, neither locally nor remotely.");

var branchName = chosenBranch.Name;
var branchName = chosenBranch.FriendlyName;
Logger.WriteWarning(errorMessage + Environment.NewLine + Environment.NewLine + "Falling back to " + branchName + " branch config");

var value = GetBranchConfiguration(currentCommit, repository, onlyEvaluateTrackedBranches, config, chosenBranch).Value;
Expand Down Expand Up @@ -161,22 +161,22 @@ static Branch[] CalculateWhenMultipleParents(IRepository repository, Commit curr
}
else if (branches.Count > 1)
{
currentBranch = branches.FirstOrDefault(b => b.Name == "master") ?? branches.First();
currentBranch = branches.FirstOrDefault(b => b.FriendlyName == "master") ?? branches.First();
}
else
{
var possibleTargetBranches = repository.Branches.Where(b => !b.IsRemote && b.Tip == parents[0]).ToList();
if (possibleTargetBranches.Count > 1)
{
currentBranch = possibleTargetBranches.FirstOrDefault(b => b.Name == "master") ?? possibleTargetBranches.First();
currentBranch = possibleTargetBranches.FirstOrDefault(b => b.FriendlyName == "master") ?? possibleTargetBranches.First();
}
else
{
currentBranch = possibleTargetBranches.FirstOrDefault() ?? currentBranch;
}
}

Logger.WriteInfo("HEAD is merge commit, this is likely a pull request using " + currentBranch.Name + " as base");
Logger.WriteInfo("HEAD is merge commit, this is likely a pull request using " + currentBranch.FriendlyName + " as base");

return excludedBranches;
}
Expand Down
2 changes: 1 addition & 1 deletion src/GitVersionCore/GitVersionContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public GitVersionContext(IRepository repository, Branch currentBranch, Config co
.SelectMany(t =>
{
SemanticVersion version;
if (t.PeeledTarget() == CurrentCommit && SemanticVersion.TryParse(t.Name, Configuration.GitTagPrefix, out version))
if (t.PeeledTarget() == CurrentCommit && SemanticVersion.TryParse(t.FriendlyName, Configuration.GitTagPrefix, out version))
return new[] { version };
return new SemanticVersion[0];
})
Expand Down
8 changes: 4 additions & 4 deletions src/GitVersionCore/GitVersionCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="Visualize, Version=0.4.4.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Visualize.Fody.0.4.4.0\lib\portable-net4+sl4+wp7+win8+MonoAndroid16+MonoTouch40\Visualize.dll</HintPath>
<Reference Include="Visualize, Version=0.4.5.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Visualize.Fody.0.4.5.0\lib\portable-net4+sl4+wp7+win8+MonoAndroid16+MonoTouch40\Visualize.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="YamlDotNet, Version=3.8.0.0, Culture=neutral, processorArchitecture=MSIL">
Expand Down Expand Up @@ -183,8 +183,8 @@
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\PepitaPackage.1.21.4\build\PepitaPackage.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\PepitaPackage.1.21.4\build\PepitaPackage.targets'))" />
<Error Condition="!Exists('..\packages\Fody.1.29.3\build\portable-net+sl+win+wpa+wp\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.29.3\build\portable-net+sl+win+wpa+wp\Fody.targets'))" />
<Error Condition="!Exists('..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\LibGit2Sharp.NativeBinaries.1.0.129\build\LibGit2Sharp.NativeBinaries.props'))" />
<Error Condition="!Exists('..\packages\Fody.1.29.4\build\portable-net+sl+win+wpa+wp\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.29.4\build\portable-net+sl+win+wpa+wp\Fody.targets'))" />
</Target>
<PropertyGroup>
<PostBuildEvent>
Expand All @@ -207,5 +207,5 @@
<PepitaPackage.CreatePackageTask NuGetBuildDirectory="$(BuildDir)NuGetRefBuild" MetadataAssembly="$(OutputPath)GitVersionCore.dll" Version="$(GitVersion_NuGetVersion)" />
</Target>
<Import Project="..\packages\PepitaPackage.1.21.4\build\PepitaPackage.targets" Condition="Exists('..\packages\PepitaPackage.1.21.4\build\PepitaPackage.targets')" />
<Import Project="..\packages\Fody.1.29.3\build\portable-net+sl+win+wpa+wp\Fody.targets" Condition="Exists('..\packages\Fody.1.29.3\build\portable-net+sl+win+wpa+wp\Fody.targets')" />
<Import Project="..\packages\Fody.1.29.4\build\portable-net+sl+win+wpa+wp\Fody.targets" Condition="Exists('..\packages\Fody.1.29.4\build\portable-net+sl+win+wpa+wp\Fody.targets')" />
</Project>
2 changes: 1 addition & 1 deletion src/GitVersionCore/GitVersionFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class GitVersionFinder
{
public SemanticVersion FindVersion(GitVersionContext context)
{
Logger.WriteInfo(string.Format("Running against branch: {0} ({1})", context.CurrentBranch.Name, context.CurrentCommit.Sha));
Logger.WriteInfo(string.Format("Running against branch: {0} ({1})", context.CurrentBranch.FriendlyName, context.CurrentCommit.Sha));
EnsureMainTopologyConstraints(context);

var filePath = Path.Combine(context.Repository.GetRepositoryDirectory(), "NextVersion.txt");
Expand Down
2 changes: 1 addition & 1 deletion src/GitVersionCore/IncrementStrategyFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ private static IEnumerable<Commit> GetIntermediateCommits(IRepository repo, Comm
{
var filter = new CommitFilter
{
Since = headCommit,
IncludeReachableFrom = headCommit,
SortBy = CommitSortStrategies.Topological | CommitSortStrategies.Reverse
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ public override IEnumerable<BaseVersion> GetVersions(GitVersionContext context)
.Select(t =>
{
SemanticVersion version;
if (SemanticVersion.TryParse(t.Name, context.Configuration.GitTagPrefix, out version))
if (SemanticVersion.TryParse(t.FriendlyName, context.Configuration.GitTagPrefix, out version))
{
var commit = t.PeeledTarget() as Commit;
if (commit != null)
return new VersionTaggedCommit(commit, version, t.Name);
return new VersionTaggedCommit(commit, version, t.FriendlyName);
}
return null;
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ public override IEnumerable<BaseVersion> GetVersions(GitVersionContext context)
if (versionInBranch != null)
{
var commitBranchWasBranchedFrom = context.CurrentBranch.FindCommitBranchWasBranchedFrom(context.Repository);
var branchNameOverride = context.CurrentBranch.Name.RegexReplace("[-/]" + versionInBranch.Item1, string.Empty);
var branchNameOverride = context.CurrentBranch.FriendlyName.RegexReplace("[-/]" + versionInBranch.Item1, string.Empty);
yield return new BaseVersion("Version in branch name", false, versionInBranch.Item2, commitBranchWasBranchedFrom, branchNameOverride);
}
}

Tuple<string, SemanticVersion> GetVersionInBranch(GitVersionContext context)
{
var branchParts = context.CurrentBranch.Name.Split('/', '-');
var branchParts = context.CurrentBranch.FriendlyName.Split('/', '-');
foreach (var part in branchParts)
{
SemanticVersion semanticVersion;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public override IEnumerable<BaseVersion> GetVersions(GitVersionContext context)
{
var baseVersionSource = context.Repository.Commits.QueryBy(new CommitFilter
{
Since = context.CurrentBranch.Tip
IncludeReachableFrom = context.CurrentBranch.Tip
}).First(c => !c.Parents.Any());
yield return new BaseVersion("Fallback base version", false, new SemanticVersion(minor: 1), baseVersionSource, null);
}
Expand Down
6 changes: 3 additions & 3 deletions src/GitVersionCore/VersionCalculation/MetaDataCalculator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ public SemanticVersionBuildMetaData Create(Commit baseVersionSource, GitVersionC
{
var qf = new CommitFilter
{
Since = context.CurrentCommit,
Until = baseVersionSource,
IncludeReachableFrom = context.CurrentCommit,
ExcludeReachableFrom = baseVersionSource,
SortBy = CommitSortStrategies.Topological | CommitSortStrategies.Time
};

Expand All @@ -20,7 +20,7 @@ public SemanticVersionBuildMetaData Create(Commit baseVersionSource, GitVersionC

return new SemanticVersionBuildMetaData(
commitsSinceTag,
context.CurrentBranch.Name,
context.CurrentBranch.FriendlyName,
context.CurrentCommit.Sha,
context.CurrentCommit.When());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void UpdatePreReleaseTag(GitVersionContext context, SemanticVersion semanticVers
{
Logger.WriteInfo("Using branch name to calculate version tag");

var branchName = branchNameOverride ?? context.CurrentBranch.Name;
var branchName = branchNameOverride ?? context.CurrentBranch.FriendlyName;
if (!string.IsNullOrWhiteSpace(context.Configuration.BranchPrefixToTrim))
{
branchName = branchName.RegexReplace(context.Configuration.BranchPrefixToTrim, string.Empty, RegexOptions.IgnoreCase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ static SemanticVersionPreReleaseTag RetrieveMostRecentOptionalTagVersion(GitVers
if (applicableTagsInDescendingOrder.Any())
{
var taggedCommit = applicableTagsInDescendingOrder.First().PeeledTarget();
var preReleaseVersion = applicableTagsInDescendingOrder.Select(tag => SemanticVersion.Parse(tag.Name, context.Configuration.GitTagPrefix)).FirstOrDefault();
var preReleaseVersion = applicableTagsInDescendingOrder.Select(tag => SemanticVersion.Parse(tag.FriendlyName, context.Configuration.GitTagPrefix)).FirstOrDefault();
if (preReleaseVersion != null)
{
if (taggedCommit != context.CurrentCommit)
Expand Down
6 changes: 3 additions & 3 deletions src/GitVersionCore/packages.config
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Caseless.Fody" version="1.3.7" targetFramework="net4" developmentDependency="true" />
<package id="Fody" version="1.29.3" targetFramework="net4" developmentDependency="true" />
<package id="Caseless.Fody" version="1.4.1" targetFramework="net40" developmentDependency="true" />
<package id="Fody" version="1.29.4" targetFramework="net40" developmentDependency="true" />
<package id="GitTools.Core" version="0.4.0-beta0004" targetFramework="net40" />
<package id="JetBrainsAnnotations.Fody" version="1.0.4.0" targetFramework="net4" developmentDependency="true" />
<package id="LibGit2Sharp" version="0.22.0" targetFramework="net40" />
<package id="LibGit2Sharp.NativeBinaries" version="1.0.129" targetFramework="net40" />
<package id="PepitaPackage" version="1.21.4" targetFramework="net4" developmentDependency="true" />
<package id="Visualize.Fody" version="0.4.4.0" targetFramework="net4" developmentDependency="true" />
<package id="Visualize.Fody" version="0.4.5.0" targetFramework="net40" developmentDependency="true" />
<package id="YamlDotNet" version="3.8.0" targetFramework="net40" />
</packages>
Loading