Skip to content

Commit d36251a

Browse files
authored
Merge pull request #8 from Techsola/updates
Miscellaneous updates
2 parents e99b09d + 0683929 commit d36251a

13 files changed

+33
-123
lines changed

Readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ Options:
4949
--root-path-changes <root-path-changes> Followed by one or more arguments with the format
5050
CS1234:$/New/Path. Changes the path that is mapped as the Git
5151
repository root to a new path during a specified changeset.
52-
--pat <pat> Optional PAT, required to access TFVC repositories hosted on
53-
Azure DevOps Services. If not provided Default Client
54-
Credentials will be used, these are only suitable for
55-
on-premise TFS/Azure DevOps Server.
52+
--pat <pat> Personal access token, required to access TFVC repositories
53+
hosted on Azure DevOps Services. If not provided, default
54+
client credentials will be used which are only suitable for
55+
repositories hosted on Azure DevOps Server on-premises.
5656
--version Show version information
5757
-?, -h, --help Show help and usage information
5858
```

src/Directory.Build.props

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
<Project>
22

33
<PropertyGroup>
4-
<TreatWarningsAsErrors Condition="'$(Configuration)' == 'Release'">true</TreatWarningsAsErrors>
4+
<TreatWarningsAsErrors Condition="'$(Configuration)' == 'Release'">true</TreatWarningsAsErrors>
55
</PropertyGroup>
66

77
<ItemGroup>
8-
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.406" PrivateAssets="all" />
8+
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.435" PrivateAssets="all" />
99
</ItemGroup>
1010

1111
<PropertyGroup>
12-
<ImplicitUsings>enable</ImplicitUsings>
12+
<ImplicitUsings>enable</ImplicitUsings>
1313
</PropertyGroup>
1414
<ItemGroup>
1515
<Using Include="System.Collections.Immutable" />
1616
<Using Include="System.Diagnostics" />
17-
<Using Include="System.Diagnostics.CodeAnalysis" />
17+
<Using Include="System.Diagnostics.CodeAnalysis" />
1818
</ItemGroup>
1919

2020
</Project>

src/TfvcMigrator.Tests/ReadmeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public static async Task Command_line_arguments_section_is_up_to_date()
1818

1919
if (Normalize(actualReadmeCodeBlock) != Normalize(expectedReadmeCodeBlock))
2020
{
21-
Assert.Fail("Update the ‘Command-line arguments’ section in Readme.md using the program output for the --help.");
21+
Assert.Fail("Update the ‘Command-line arguments’ section in Readme.md using the program output for --help.");
2222
}
2323
}
2424

src/TfvcMigrator.Tests/TfvcMigrator.Tests.csproj

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,19 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="NSubstitute" Version="4.3.0" />
11-
<PackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.15">
10+
<PackageReference Include="NSubstitute" Version="5.0.0" />
11+
<PackageReference Include="NSubstitute.Analyzers.CSharp" Version="1.0.16">
1212
<PrivateAssets>all</PrivateAssets>
1313
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1414
</PackageReference>
15-
<PackageReference Include="NUnit" Version="3.13.2" />
16-
<PackageReference Include="NUnit.Analyzers" Version="3.3.0" />
17-
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
18-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
19-
<PackageReference Include="Shouldly" Version="4.0.3" />
15+
<PackageReference Include="NUnit" Version="3.13.3" />
16+
<PackageReference Include="NUnit.Analyzers" Version="3.6.1">
17+
<PrivateAssets>all</PrivateAssets>
18+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
19+
</PackageReference>
20+
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
21+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
22+
<PackageReference Include="Shouldly" Version="4.1.0" />
2023
</ItemGroup>
2124

2225
<ItemGroup>

src/TfvcMigrator/BranchIdentity.cs

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace TfvcMigrator;
22

33
[DebuggerDisplay("{ToString(),nq}")]
4-
public readonly struct BranchIdentity : IEquatable<BranchIdentity>
4+
public readonly record struct BranchIdentity
55
{
66
public BranchIdentity(int creationChangeset, string path)
77
{
@@ -32,11 +32,6 @@ public override string ToString()
3232
return $"CS{CreationChangeset}:{Path}";
3333
}
3434

35-
public override bool Equals(object? obj)
36-
{
37-
return obj is BranchIdentity identity && Equals(identity);
38-
}
39-
4035
public bool Equals(BranchIdentity other)
4136
{
4237
return CreationChangeset == other.CreationChangeset
@@ -47,14 +42,4 @@ public override int GetHashCode()
4742
{
4843
return HashCode.Combine(CreationChangeset, Path.GetHashCode(StringComparison.OrdinalIgnoreCase));
4944
}
50-
51-
public static bool operator ==(BranchIdentity left, BranchIdentity right)
52-
{
53-
return left.Equals(right);
54-
}
55-
56-
public static bool operator !=(BranchIdentity left, BranchIdentity right)
57-
{
58-
return !(left == right);
59-
}
6045
}

src/TfvcMigrator/Operations/BranchOperation.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace TfvcMigrator.Operations;
22

33
[DebuggerDisplay("{ToString(),nq}")]
4-
public sealed class BranchOperation : TopologicalOperation, IEquatable<BranchOperation?>
4+
public sealed record BranchOperation : TopologicalOperation
55
{
66
public BranchOperation(BranchIdentity sourceBranch, int sourceBranchChangeset, string sourceBranchPath, BranchIdentity newBranch)
77
{
@@ -27,11 +27,6 @@ public BranchOperation(BranchIdentity sourceBranch, int sourceBranchChangeset, s
2727

2828
public override string ToString() => $"CS{Changeset}: Branch {SourceBranchPath} at CS{SourceBranchChangeset} to {NewBranch.Path}";
2929

30-
public override bool Equals(object? obj)
31-
{
32-
return Equals(obj as BranchOperation);
33-
}
34-
3530
public bool Equals(BranchOperation? other)
3631
{
3732
return other != null &&
Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,9 @@
11
namespace TfvcMigrator.Operations;
22

33
[DebuggerDisplay("{ToString(),nq}")]
4-
public sealed class DeleteOperation : TopologicalOperation, IEquatable<DeleteOperation?>
4+
public sealed record DeleteOperation(int Changeset, BranchIdentity Branch) : TopologicalOperation
55
{
6-
public DeleteOperation(int changeset, BranchIdentity branch)
7-
{
8-
Changeset = changeset;
9-
Branch = branch;
10-
}
11-
12-
public override int Changeset { get; }
13-
public BranchIdentity Branch { get; }
14-
15-
public override bool Equals(object? obj)
16-
{
17-
return Equals(obj as DeleteOperation);
18-
}
19-
20-
public bool Equals(DeleteOperation? other)
21-
{
22-
return other != null &&
23-
Changeset == other.Changeset &&
24-
Branch.Equals(other.Branch);
25-
}
26-
27-
public override int GetHashCode()
28-
{
29-
return HashCode.Combine(Changeset, Branch);
30-
}
6+
public override int Changeset { get; } = Changeset;
317

328
public override string ToString() => $"CS{Changeset}: Delete {Branch.Path}";
339
}

src/TfvcMigrator/Operations/MergeOperation.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
namespace TfvcMigrator.Operations;
22

33
[DebuggerDisplay("{ToString(),nq}")]
4-
public sealed class MergeOperation : TopologicalOperation, IEquatable<MergeOperation?>
4+
public sealed record MergeOperation : TopologicalOperation
55
{
66
public MergeOperation(int changeset, BranchIdentity sourceBranch, int sourceBranchChangeset, string sourceBranchPath, BranchIdentity targetBranch, string targetBranchPath)
77
{
@@ -31,11 +31,6 @@ public MergeOperation(int changeset, BranchIdentity sourceBranch, int sourceBran
3131

3232
public override string ToString() => $"CS{Changeset}: Merge {SourceBranchPath} at {SourceBranchChangeset} to {TargetBranchPath}";
3333

34-
public override bool Equals(object? obj)
35-
{
36-
return Equals(obj as MergeOperation);
37-
}
38-
3934
public bool Equals(MergeOperation? other)
4035
{
4136
return other != null &&
Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,9 @@
11
namespace TfvcMigrator.Operations;
22

33
[DebuggerDisplay("{ToString(),nq}")]
4-
public sealed class RenameOperation : TopologicalOperation, IEquatable<RenameOperation?>
4+
public sealed record RenameOperation(BranchIdentity OldIdentity, BranchIdentity NewIdentity) : TopologicalOperation
55
{
6-
public RenameOperation(BranchIdentity oldIdentity, BranchIdentity newIdentity)
7-
{
8-
OldIdentity = oldIdentity;
9-
NewIdentity = newIdentity;
10-
}
11-
126
public override int Changeset => NewIdentity.CreationChangeset;
13-
public BranchIdentity OldIdentity { get; }
14-
public BranchIdentity NewIdentity { get; }
157

168
public override string ToString() => $"CS{Changeset}: Rename {OldIdentity.Path} to {NewIdentity.Path}";
17-
18-
public override bool Equals(object? obj)
19-
{
20-
return Equals(obj as RenameOperation);
21-
}
22-
23-
public bool Equals(RenameOperation? other)
24-
{
25-
return other != null &&
26-
OldIdentity.Equals(other.OldIdentity) &&
27-
NewIdentity.Equals(other.NewIdentity);
28-
}
29-
30-
public override int GetHashCode()
31-
{
32-
return HashCode.Combine(OldIdentity, NewIdentity);
33-
}
349
}
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
namespace TfvcMigrator.Operations;
22

3-
public abstract class TopologicalOperation
3+
public abstract record TopologicalOperation
44
{
55
public abstract int Changeset { get; }
66

77
public abstract override string ToString();
8-
public abstract override bool Equals(object? obj);
9-
public abstract override int GetHashCode();
108
}

0 commit comments

Comments
 (0)