Skip to content

Commit 1b0323b

Browse files
committed
Some initial cleanup of stuff which isn't used
1 parent 227804e commit 1b0323b

20 files changed

+16
-143
lines changed

src/GitVersionCore.Tests/IntegrationTests/RemoteRepositoryScenarios.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.ComponentModel;
23
using GitTools.Testing;
34
using GitVersion;
45
using GitVersionCore.Tests;

src/GitVersionCore/BuildServers/GitHelper.cs

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@ namespace GitVersion
33
using System;
44
using LibGit2Sharp;
55
using System.Collections.Generic;
6+
using System.ComponentModel;
67
using System.Linq;
7-
using System.Text.RegularExpressions;
88

99
public static class GitHelper
1010
{
11-
const string MergeMessageRegexPattern = "refs/heads/(pr|pull(-requests)?/(?<issuenumber>[0-9]*)/(merge|head))";
12-
1311
public static void NormalizeGitDirectory(string gitDirectory, Authentication authentication, bool noFetch, string currentBranch)
1412
{
1513
using (var repo = new Repository(gitDirectory))
@@ -127,31 +125,6 @@ static void EnsureLocalBranchExistsForCurrentBranch(Repository repo, string curr
127125
repo.Checkout(localCanonicalName);
128126
}
129127

130-
public static bool LooksLikeAValidPullRequestNumber(string issueNumber)
131-
{
132-
if (string.IsNullOrEmpty(issueNumber))
133-
{
134-
return false;
135-
}
136-
137-
uint res;
138-
return uint.TryParse(issueNumber, out res);
139-
}
140-
141-
public static string ExtractIssueNumber(string mergeMessage)
142-
{
143-
// Dynamic: refs/heads/pr/5
144-
// Github Message: refs/heads/pull/5/merge
145-
// Stash Message: refs/heads/pull-requests/5/merge
146-
// refs/heads/pull/5/head
147-
var regex = new Regex(MergeMessageRegexPattern);
148-
var match = regex.Match(mergeMessage);
149-
150-
var issueNumber = match.Groups["issuenumber"].Value;
151-
152-
return issueNumber;
153-
}
154-
155128
static void AddMissingRefSpecs(Repository repo, Remote remote)
156129
{
157130
if (remote.FetchRefSpecs.Any(r => r.Source == "refs/heads/*"))
@@ -228,20 +201,6 @@ static void CreateFakeBranchPointingAtThePullRequestTip(Repository repo, Authent
228201
repo.Checkout(fakeBranchName);
229202
}
230203

231-
internal static IEnumerable<DirectReference> GetRemoteTipsUsingUsernamePasswordCredentials(Repository repo, string repoUrl, string username, string password)
232-
{
233-
// This is a work-around as long as https://github.com/libgit2/libgit2sharp/issues/1099 is not fixed
234-
var remote = repo.Network.Remotes.Add(Guid.NewGuid().ToString(), repoUrl);
235-
try
236-
{
237-
return GetRemoteTipsUsingUsernamePasswordCredentials(repo, remote, username, password);
238-
}
239-
finally
240-
{
241-
repo.Network.Remotes.Remove(remote.Name);
242-
}
243-
}
244-
245204
static IEnumerable<DirectReference> GetRemoteTipsUsingUsernamePasswordCredentials(Repository repo, Remote remote, string username, string password)
246205
{
247206
return repo.Network.ListReferences(remote, (url, fromUrl, types) => new UsernamePasswordCredentials

src/GitVersionCore/Extensions/ExtensionMethods.cs

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -6,57 +6,15 @@ namespace GitVersion
66
using System.Text.RegularExpressions;
77
using JetBrains.Annotations;
88

9-
static partial class ExtensionMethods
9+
static class ExtensionMethods
1010
{
11-
public static bool IsOdd(this int number)
12-
{
13-
return number % 2 != 0;
14-
}
15-
16-
public static string TrimToFirstLine(this string s)
17-
{
18-
var firstLine = s.Split(new[]
19-
{
20-
"\r\n",
21-
"\n"
22-
}, StringSplitOptions.None)[0];
23-
return firstLine.Trim();
24-
}
25-
26-
2711
[StringFormatMethod("format")]
2812
public static void AppendLineFormat(this StringBuilder stringBuilder, string format, params object[] args)
2913
{
3014
stringBuilder.AppendFormat(format, args);
3115
stringBuilder.AppendLine();
3216
}
3317

34-
public static string TrimStart(this string value, string toTrim)
35-
{
36-
if (!value.StartsWith(toTrim, StringComparison.InvariantCultureIgnoreCase))
37-
{
38-
return value;
39-
}
40-
var startIndex = toTrim.Length;
41-
return value.Substring(startIndex);
42-
}
43-
44-
public static string JsonEncode(this string value)
45-
{
46-
if (value != null)
47-
{
48-
return value
49-
.Replace("\"", "\\\"")
50-
.Replace("\\", "\\\\")
51-
.Replace("\b", "\\b")
52-
.Replace("\f", "\\f")
53-
.Replace("\n", "\\n")
54-
.Replace("\t", "\\t")
55-
.Replace("\r", "\\r");
56-
}
57-
return null;
58-
}
59-
6018
public static string RegexReplace(this string input, string pattern, string replace, RegexOptions options = RegexOptions.None)
6119
{
6220
return Regex.Replace(input, pattern, replace, options);

src/GitVersionCore/Extensions/ExtensionMethods.git.cs

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

src/GitVersionCore/GitVersionCore.csproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@
114114
<Compile Include="Helpers\ServiceMessageEscapeHelper.cs" />
115115
<Compile Include="IncrementStrategyFinder.cs" />
116116
<Compile Include="OutputVariables\VersionVariables.cs" />
117-
<Compile Include="Extensions\ExtensionMethods.git.cs" />
118117
<Compile Include="SemanticVersionExtensions.cs" />
119118
<Compile Include="VersionCalculation\BaseVersionCalculator.cs" />
120119
<Compile Include="VersionCalculation\BaseVersionCalculators\BaseVersion.cs" />
@@ -134,7 +133,6 @@
134133
<Compile Include="VersioningModes\VersioningMode.cs" />
135134
<Compile Include="VersioningModes\VersioningModeBase.cs" />
136135
<Compile Include="VersioningModes\VersioningModeExtension.cs" />
137-
<Compile Include="WarningException.cs" />
138136
<Compile Include="Extensions\ExtensionMethods.cs" />
139137
<Compile Include="GitDirFinder.cs" />
140138
<Compile Include="GitVersionContext.cs" />

src/GitVersionCore/GitVersionFinder.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
namespace GitVersion
22
{
3+
using System.ComponentModel;
34
using System.IO;
45
using System.Linq;
56
using GitVersion.VersionCalculation;

src/GitVersionCore/RepositoryLoader.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
namespace GitVersion
22
{
33
using System;
4+
using System.ComponentModel;
45
using LibGit2Sharp;
56

67
public class RepositoryLoader

src/GitVersionCore/SemanticVersion.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
namespace GitVersion
22
{
33
using System;
4+
using System.ComponentModel;
45
using System.Text.RegularExpressions;
56

67
public class SemanticVersion : IFormattable, IComparable<SemanticVersion>

src/GitVersionCore/WarningException.cs

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

src/GitVersionExe.Tests/ArgumentParserTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.ComponentModel;
34
using GitVersion;
45
using NUnit.Framework;
56
using Shouldly;

src/GitVersionExe/ArgumentParser.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ namespace GitVersion
33
using System;
44
using System.Collections.Generic;
55
using System.Collections.Specialized;
6+
using System.ComponentModel;
67
using System.Linq;
78
using System.Text.RegularExpressions;
89

@@ -77,7 +78,7 @@ public static Arguments ParseArguments(List<string> commandLineArguments)
7778
if (values.Length > 1) throw new WarningException(string.Format("Could not parse command line parameter '{0}'.", values[1]));
7879

7980
value = values.FirstOrDefault();
80-
}
81+
}
8182

8283
if (IsSwitch("l", name))
8384
{

src/GitVersionExe/ExtensionMethods.cs

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

src/GitVersionExe/GitVersionExe.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@
5858
<ItemGroup>
5959
<Compile Include="ArgumentParser.cs" />
6060
<Compile Include="Arguments.cs" />
61-
<Compile Include="ExtensionMethods.cs" />
6261
<Compile Include="HelpWriter.cs" />
6362
<Compile Include="Program.cs" />
6463
<Compile Include="AssemblyInfo.cs" />

src/GitVersionExe/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ namespace GitVersion
22
{
33
using System;
44
using System.Collections.Generic;
5+
using System.ComponentModel;
56
using System.Diagnostics;
67
using System.IO;
78
using System.Linq;

src/GitVersionExe/SpecifiedArgumentRunner.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ namespace GitVersion
22
{
33
using System;
44
using System.Collections.Generic;
5+
using System.ComponentModel;
56
using System.Linq;
67
using GitVersion.Helpers;
78

src/GitVersionTask.Tests/InvalidFileCheckerTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
2+
using System.ComponentModel;
23
using System.IO;
3-
using GitVersion;
44
using GitVersionTask.Tests.Mocks;
55
using Microsoft.Build.Framework;
66
using NUnit.Framework;

src/GitVersionTask/AssemblyInfoBuilder/UpdateAssemblyInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
namespace GitVersionTask
22
{
33
using System;
4+
using System.ComponentModel;
45
using System.IO;
56
using System.Text;
67
using GitVersion;

src/GitVersionTask/GetVersion.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
namespace GitVersionTask
22
{
33
using System;
4+
using System.ComponentModel;
45
using GitVersion;
56
using GitVersion.Helpers;
67
using Microsoft.Build.Framework;

src/GitVersionTask/InvalidFileChecker.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.ComponentModel;
34
using System.IO;
45
using System.Linq;
56
using System.Text.RegularExpressions;
6-
using GitVersion;
77
using Microsoft.Build.Framework;
88

99
public static class InvalidFileChecker

src/GitVersionTask/WriteVersionInfoToBuildLog.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using Microsoft.Build.Utilities;
77
using System;
88
using System.Collections.Generic;
9+
using System.ComponentModel;
910
using Logger = GitVersion.Logger;
1011

1112
public class WriteVersionInfoToBuildLog : Task

0 commit comments

Comments
 (0)