Skip to content

Commit

Permalink
indent base version calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
arturcic committed Nov 14, 2024
1 parent e9f553c commit d44fb2d
Showing 1 changed file with 25 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,35 +244,36 @@ IEnumerable<NextVersion> GetNextVersionsInternal()
var effectiveBranchConfigurations = this.effectiveBranchConfigurationFinder.GetConfigurations(branch, configuration).ToArray();
foreach (var effectiveBranchConfiguration in effectiveBranchConfigurations)
{
this.log.Info($"Calculating base versions for '{effectiveBranchConfiguration.Branch.Name}'");

var strategies = this.versionStrategies.ToList();
var fallbackVersionStrategy = strategies.Find(element => element is FallbackVersionStrategy);
if (fallbackVersionStrategy is not null)
{
strategies.Remove(fallbackVersionStrategy);
strategies.Add(fallbackVersionStrategy);
}

var atLeastOneBaseVersionReturned = false;
foreach (var versionStrategy in strategies)
using (this.log.IndentLog($"Calculating base versions for '{effectiveBranchConfiguration.Branch.Name}'"))
{
if (atLeastOneBaseVersionReturned && versionStrategy is FallbackVersionStrategy) continue;
var strategies = this.versionStrategies.ToList();
var fallbackVersionStrategy = strategies.Find(element => element is FallbackVersionStrategy);
if (fallbackVersionStrategy is not null)
{
strategies.Remove(fallbackVersionStrategy);
strategies.Add(fallbackVersionStrategy);
}

using (this.log.IndentLog($"[Using '{versionStrategy.GetType().Name}' strategy]"))
var atLeastOneBaseVersionReturned = false;
foreach (var versionStrategy in strategies)
{
foreach (var baseVersion in versionStrategy.GetBaseVersions(effectiveBranchConfiguration))
if (atLeastOneBaseVersionReturned && versionStrategy is FallbackVersionStrategy) continue;

using (this.log.IndentLog($"[Using '{versionStrategy.GetType().Name}' strategy]"))
{
log.Info(baseVersion.ToString());
if (IncludeVersion(baseVersion, configuration.Ignore))
foreach (var baseVersion in versionStrategy.GetBaseVersions(effectiveBranchConfiguration))
{
atLeastOneBaseVersionReturned = true;

yield return new NextVersion(
incrementedVersion: baseVersion.GetIncrementedVersion(),
baseVersion: baseVersion,
configuration: effectiveBranchConfiguration
);
log.Info(baseVersion.ToString());
if (IncludeVersion(baseVersion, configuration.Ignore))
{
atLeastOneBaseVersionReturned = true;

yield return new NextVersion(
incrementedVersion: baseVersion.GetIncrementedVersion(),
baseVersion: baseVersion,
configuration: effectiveBranchConfiguration
);
}
}
}
}
Expand Down

0 comments on commit d44fb2d

Please sign in to comment.