Skip to content

Commit 97d719e

Browse files
committed
remove obsolete configs
1 parent 229a08e commit 97d719e

File tree

8 files changed

+1
-257
lines changed

8 files changed

+1
-257
lines changed

src/GitVersionCore.Tests/ConfigProviderTests.cs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -42,34 +42,6 @@ public void Setup()
4242
ShouldlyConfiguration.ShouldMatchApprovedDefaults.LocateTestMethodUsingAttribute<TestAttribute>();
4343
}
4444

45-
[Test]
46-
public void CanReadOldDocument()
47-
{
48-
const string text = @"
49-
assemblyVersioningScheme: MajorMinor
50-
develop-branch-tag: alpha
51-
release-branch-tag: rc
52-
branches:
53-
master:
54-
mode: ContinuousDeployment
55-
dev(elop)?(ment)?$:
56-
mode: ContinuousDeployment
57-
tag: dev
58-
release[/-]:
59-
mode: continuousDeployment
60-
tag: rc
61-
";
62-
SetupConfigFileContent(text);
63-
var error = Should.Throw<OldConfigurationException>(() => configProvider.Provide(repoPath));
64-
error.Message.ShouldContainWithoutWhitespace(@"GitVersion configuration file contains old configuration, please fix the following errors:
65-
GitVersion branch configs no longer are keyed by regexes, update:
66-
dev(elop)?(ment)?$ -> develop
67-
release[/-] -> release
68-
assemblyVersioningScheme has been replaced by assembly-versioning-scheme
69-
develop-branch-tag has been replaced by branch specific configuration.See https://gitversion.net/docs/configuration/#branch-configuration
70-
release-branch-tag has been replaced by branch specific configuration.See https://gitversion.net/docs/configuration/#branch-configuration");
71-
}
72-
7345
[Test]
7446
public void OverwritesDefaultsWithProvidedConfig()
7547
{

src/GitVersionCore.Tests/DefaultConfigFileLocatorTests.cs

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -41,41 +41,7 @@ public void Setup()
4141
ShouldlyConfiguration.ShouldMatchApprovedDefaults.LocateTestMethodUsingAttribute<TestAttribute>();
4242
}
4343

44-
[TestCase(DefaultRepoPath)]
45-
[TestCase(DefaultWorkingPath)]
46-
public void WarnOnExistingGitVersionConfigYamlFile(string path)
47-
{
48-
SetupConfigFileContent(string.Empty, DefaultConfigFileLocator.ObsoleteFileName, path);
49-
50-
var output = WithDefaultConfigFileLocator(configFileLocator =>
51-
{
52-
configFileLocator.Verify(workingPath, repoPath);
53-
});
54-
55-
var configFileDeprecatedWarning = $"{DefaultConfigFileLocator.ObsoleteFileName}' is deprecated, use '{DefaultConfigFileLocator.DefaultFileName}' instead";
56-
output.Contains(configFileDeprecatedWarning).ShouldBe(true);
57-
}
58-
59-
[TestCase(DefaultRepoPath)]
60-
[TestCase(DefaultWorkingPath)]
61-
public void WarnOnAmbiguousConfigFilesAtTheSameProjectRootDirectory(string path)
62-
{
63-
SetupConfigFileContent(string.Empty, DefaultConfigFileLocator.ObsoleteFileName, path);
64-
SetupConfigFileContent(string.Empty, DefaultConfigFileLocator.DefaultFileName, path);
65-
66-
var output = WithDefaultConfigFileLocator(configFileLocator =>
67-
{
68-
configFileLocator.Verify(workingPath, repoPath);
69-
});
70-
71-
var configFileDeprecatedWarning = $"Ambiguous config files at '{path}'";
72-
output.Contains(configFileDeprecatedWarning).ShouldBe(true);
73-
}
74-
7544
[TestCase(DefaultConfigFileLocator.DefaultFileName, DefaultConfigFileLocator.DefaultFileName)]
76-
[TestCase(DefaultConfigFileLocator.DefaultFileName, DefaultConfigFileLocator.ObsoleteFileName)]
77-
[TestCase(DefaultConfigFileLocator.ObsoleteFileName, DefaultConfigFileLocator.DefaultFileName)]
78-
[TestCase(DefaultConfigFileLocator.ObsoleteFileName, DefaultConfigFileLocator.ObsoleteFileName)]
7945
public void ThrowsExceptionOnAmbiguousConfigFileLocation(string repoConfigFile, string workingConfigFile)
8046
{
8147
var repositoryConfigFilePath = SetupConfigFileContent(string.Empty, repoConfigFile, repoPath);
@@ -106,25 +72,6 @@ public void NoWarnOnGitVersionYmlFile()
10672
output.Length.ShouldBe(0);
10773
}
10874

109-
[Test]
110-
public void WarnOnObsoleteIsDevelopBranchConfigurationSetting()
111-
{
112-
const string text = @"
113-
assembly-versioning-scheme: MajorMinorPatch
114-
branches:
115-
master:
116-
tag: beta
117-
is-develop: true";
118-
119-
var exception = Should.Throw<OldConfigurationException>(() =>
120-
{
121-
LegacyConfigNotifier.Notify(new StringReader(text));
122-
});
123-
124-
const string expectedMessage = "'is-develop' is deprecated, use 'tracks-release-branches' instead.";
125-
exception.Message.ShouldContain(expectedMessage);
126-
}
127-
12875
private string SetupConfigFileContent(string text, string fileName, string path)
12976
{
13077
var fullPath = Path.Combine(path, fileName);

src/GitVersionCore.Tests/GitVersionExecutorTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public void ConfigChangeInvalidatesCache()
297297
versionVariables = gitVersionCalculator.CalculateVersionVariables();
298298
versionVariables.AssemblySemVer.ShouldBe("4.10.3.0");
299299

300-
var configPath = Path.Combine(fixture.RepositoryPath, "GitVersionConfig.yaml");
300+
var configPath = Path.Combine(fixture.RepositoryPath, DefaultConfigFileLocator.DefaultFileName);
301301
fileSystem.WriteAllText(configPath, "next-version: 5.0");
302302

303303
versionVariables = gitVersionCalculator.CalculateVersionVariables();

src/GitVersionCore/Configuration/ConfigFileLocator.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ public Config ReadConfig(string workingDirectory)
4141
if (FileSystem.Exists(configFilePath))
4242
{
4343
var readAllText = FileSystem.ReadAllText(configFilePath);
44-
LegacyConfigNotifier.Notify(new StringReader(readAllText));
4544
return ConfigSerializer.Read(new StringReader(readAllText));
4645
}
4746

src/GitVersionCore/Configuration/DefaultConfigFileLocator.cs

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@ public class DefaultConfigFileLocator : ConfigFileLocator
88
{
99
public DefaultConfigFileLocator(IFileSystem fileSystem, ILog log) : base(fileSystem, log)
1010
{
11-
1211
}
1312

1413
public const string DefaultFileName = "GitVersion.yml";
1514

16-
public const string ObsoleteFileName = "GitVersionConfig.yaml";
17-
1815
public override bool HasConfigFileAt(string workingDirectory)
1916
{
2017
var defaultConfigFilePath = Path.Combine(workingDirectory, DefaultFileName);
@@ -23,12 +20,6 @@ public override bool HasConfigFileAt(string workingDirectory)
2320
return true;
2421
}
2522

26-
var deprecatedConfigFilePath = Path.Combine(workingDirectory, ObsoleteFileName);
27-
if (FileSystem.Exists(deprecatedConfigFilePath))
28-
{
29-
return true;
30-
}
31-
3223
return false;
3324
}
3425

@@ -40,26 +31,16 @@ public override string GetConfigFilePath(string workingDirectory)
4031
return ymlPath;
4132
}
4233

43-
var deprecatedPath = Path.Combine(workingDirectory, ObsoleteFileName);
44-
if (FileSystem.Exists(deprecatedPath))
45-
{
46-
return deprecatedPath;
47-
}
48-
4934
return ymlPath;
5035
}
5136

5237
public override void Verify(string workingDirectory, string projectRootDirectory)
5338
{
5439
if (FileSystem.PathsEqual(workingDirectory, projectRootDirectory))
5540
{
56-
WarnAboutObsoleteConfigFile(workingDirectory);
5741
return;
5842
}
5943

60-
WarnAboutObsoleteConfigFile(workingDirectory);
61-
WarnAboutObsoleteConfigFile(projectRootDirectory);
62-
6344
WarnAboutAmbiguousConfigFileSelection(workingDirectory, projectRootDirectory);
6445
}
6546

@@ -75,25 +56,5 @@ private void WarnAboutAmbiguousConfigFileSelection(string workingDirectory, stri
7556
throw new WarningException($"Ambiguous config file selection from '{workingConfigFile}' and '{projectRootConfigFile}'");
7657
}
7758
}
78-
79-
private void WarnAboutObsoleteConfigFile(string workingDirectory)
80-
{
81-
var deprecatedConfigFilePath = Path.Combine(workingDirectory, ObsoleteFileName);
82-
if (!FileSystem.Exists(deprecatedConfigFilePath))
83-
{
84-
return;
85-
}
86-
87-
var defaultConfigFilePath = Path.Combine(workingDirectory, DefaultFileName);
88-
if (FileSystem.Exists(defaultConfigFilePath))
89-
{
90-
Log.Warning(string.Format("Ambiguous config files at '{0}': '{1}' (deprecated) and '{2}'. Will be used '{2}'", workingDirectory, ObsoleteFileName, DefaultFileName));
91-
return;
92-
}
93-
94-
Log.Warning($"'{deprecatedConfigFilePath}' is deprecated, use '{DefaultFileName}' instead.");
95-
}
96-
9759
}
98-
9960
}

src/GitVersionCore/Configuration/LegacyBranchConfig.cs

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/GitVersionCore/Configuration/LegacyConfig.cs

Lines changed: 0 additions & 56 deletions
This file was deleted.

src/GitVersionCore/Configuration/LegacyConfigNotifier.cs

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)