Skip to content

Commit 4113cc4

Browse files
authored
Remove further obsolete stuff (#992)
* Remove further Obsolete stuff As we are about to bump the major version anyway, let's clean up things a bit. * take 2
1 parent aeb2638 commit 4113cc4

File tree

10 files changed

+20
-168
lines changed

10 files changed

+20
-168
lines changed

.github/dependabot.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,6 @@ updates:
5454
- "*NUnit*"
5555
exclude-patterns:
5656
- "NUnit.Analyzers"
57+
misc-dependencies:
58+
patterns:
59+
- "*"

NGitLab.Mock/Clients/LabelClient.cs

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,6 @@ public Models.Label CreateProjectLabel(long projectId, ProjectLabelCreate label)
2323
}
2424
}
2525

26-
[Obsolete("Use CreateProjectLabel instead")]
27-
public Models.Label Create(LabelCreate label)
28-
{
29-
return CreateProjectLabel(label.Id, new ProjectLabelCreate
30-
{
31-
Name = label.Name,
32-
Color = label.Color,
33-
Description = label.Description,
34-
});
35-
}
36-
3726
public Models.Label CreateGroupLabel(long groupId, GroupLabelCreate label)
3827
{
3928
using (Context.BeginOperationScope())
@@ -66,16 +55,6 @@ public Models.Label DeleteProjectLabel(long projectId, ProjectLabelDelete label)
6655
}
6756
}
6857

69-
[Obsolete("Use DeleteProjectLabelAsync instead")]
70-
public Models.Label Delete(LabelDelete label)
71-
{
72-
return DeleteProjectLabel(label.Id, new ProjectLabelDelete
73-
{
74-
Id = label.Id,
75-
Name = label.Name,
76-
});
77-
}
78-
7958
public Models.Label EditProjectLabel(long projectId, ProjectLabelEdit label)
8059
{
8160
using (Context.BeginOperationScope())
@@ -102,18 +81,6 @@ public Models.Label EditProjectLabel(long projectId, ProjectLabelEdit label)
10281
}
10382
}
10483

105-
[Obsolete("Use EditProjectLabel instead")]
106-
public Models.Label Edit(LabelEdit label)
107-
{
108-
return EditProjectLabel(label.Id, new ProjectLabelEdit
109-
{
110-
Name = label.Name,
111-
NewName = label.NewName,
112-
Color = label.Color,
113-
Description = label.Description,
114-
});
115-
}
116-
11784
public Models.Label EditGroupLabel(long groupId, GroupLabelEdit label)
11885
{
11986
using (Context.BeginOperationScope())
@@ -198,12 +165,6 @@ public Models.Label GetProjectLabel(long projectId, string name)
198165
}
199166
}
200167

201-
[Obsolete("Use GetProjectLabel instead")]
202-
public Models.Label GetLabel(long projectId, string name)
203-
{
204-
return GetProjectLabel(projectId, name);
205-
}
206-
207168
private static Label FindLabel(LabelsCollection collection, string name)
208169
{
209170
return collection.FirstOrDefault(x => x.Name.Equals(name, StringComparison.Ordinal));
Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
1+
using System.Collections.Generic;
32
using System.Threading;
43
using System.Threading.Tasks;
54
using NGitLab.Models;
@@ -8,19 +7,19 @@ namespace NGitLab.Mock.Clients;
87

98
internal sealed class ProjectJobTokenScopeClient : ClientBase, IProjectJobTokenScopeClient
109
{
11-
private static Dictionary<long, JobTokenScope> _projectScopes = [];
10+
private static readonly Dictionary<long, JobTokenScope> s_projectScopes = [];
1211

1312
private readonly long _projectId;
1413

1514
public ProjectJobTokenScopeClient(ClientContext context, ProjectId projectId)
1615
: base(context)
1716
{
1817
_projectId = Server.AllProjects.FindProject(projectId.ValueAsString()).Id;
19-
lock (_projectScopes)
18+
lock (s_projectScopes)
2019
{
21-
if (!_projectScopes.ContainsKey(_projectId))
20+
if (!s_projectScopes.ContainsKey(_projectId))
2221
{
23-
_projectScopes[_projectId] = new JobTokenScope
22+
s_projectScopes[_projectId] = new JobTokenScope
2423
{
2524
InboundEnabled = true,
2625
};
@@ -31,18 +30,18 @@ public ProjectJobTokenScopeClient(ClientContext context, ProjectId projectId)
3130
public async Task<JobTokenScope> GetProjectJobTokenScopeAsync(CancellationToken cancellationToken = default)
3231
{
3332
await Task.Yield();
34-
lock (_projectScopes)
33+
lock (s_projectScopes)
3534
{
36-
return _projectScopes[_projectId];
35+
return s_projectScopes[_projectId];
3736
}
3837
}
3938

4039
public async Task UpdateProjectJobTokenScopeAsync(JobTokenScope scope, CancellationToken cancellationToken = default)
4140
{
4241
await Task.Yield();
43-
lock (_projectScopes)
42+
lock (s_projectScopes)
4443
{
45-
_projectScopes[_projectId] = scope;
44+
s_projectScopes[_projectId] = scope;
4645
}
4746
}
4847
}

NGitLab/ILabelClient.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ public interface ILabelClient
4545
/// <returns></returns>
4646
Label GetProjectLabel(long projectId, string name);
4747

48-
[Obsolete("Use GetProjectLabel instead")]
49-
Label GetLabel(long projectId, string name);
50-
5148
/// <summary>
5249
/// Return a specified label from the group or null;
5350
/// </summary>
@@ -64,9 +61,6 @@ public interface ILabelClient
6461
/// <returns></returns>
6562
Label CreateProjectLabel(long projectId, ProjectLabelCreate label);
6663

67-
[Obsolete("Use CreateProjectLabel instead")]
68-
Label Create(LabelCreate label);
69-
7064
/// <summary>
7165
/// Create a new label for a group.
7266
/// </summary>
@@ -86,9 +80,6 @@ public interface ILabelClient
8680
/// <returns></returns>
8781
Label EditProjectLabel(long projectId, ProjectLabelEdit label);
8882

89-
[Obsolete("Use EditProjectLabel instead")]
90-
Label Edit(LabelEdit label);
91-
9283
/// <summary>
9384
/// Edit the contents of an existing label.
9485
/// </summary>
@@ -118,7 +109,4 @@ public interface ILabelClient
118109
/// <param name="labelName">Label Name</param>
119110
[SuppressMessage("ApiDesign", "RS0026:Do not add multiple public overloads with optional parameters", Justification = "Internal requirement to have the CancellationToken optional")]
120111
Task DeleteProjectLabelAsync(long projectId, string labelName, CancellationToken cancellationToken = default);
121-
122-
[Obsolete("Use DeleteProjectLabelAsync instead")]
123-
Label Delete(LabelDelete label);
124112
}

NGitLab/Impl/LabelClient.cs

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,6 @@ public Label GetProjectLabel(long projectId, string name)
5151
return ForProject(projectId, new LabelQuery() { Search = name }).FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.Ordinal));
5252
}
5353

54-
[Obsolete("Use GetProjectLabel instead")]
55-
public Label GetLabel(long projectId, string name)
56-
{
57-
return GetProjectLabel(projectId, name);
58-
}
59-
6054
public Label GetGroupLabel(long groupId, string name)
6155
{
6256
return ForGroup(groupId, new LabelQuery() { Search = name }).FirstOrDefault(x => string.Equals(x.Name, name, StringComparison.Ordinal));
@@ -67,17 +61,6 @@ public Label CreateProjectLabel(long projectId, ProjectLabelCreate label)
6761
return _api.Post().With(label).To<Label>(string.Format(CultureInfo.InvariantCulture, ProjectLabelUrl, projectId));
6862
}
6963

70-
[Obsolete("Use CreateProjectLabel instead")]
71-
public Label Create(LabelCreate label)
72-
{
73-
return CreateProjectLabel(label.Id, new ProjectLabelCreate
74-
{
75-
Name = label.Name,
76-
Color = label.Color,
77-
Description = label.Description,
78-
});
79-
}
80-
8164
public Label CreateGroupLabel(long groupId, GroupLabelCreate label)
8265
{
8366
return _api.Post().With(label).To<Label>(string.Format(CultureInfo.InvariantCulture, GroupLabelUrl, groupId));
@@ -99,18 +82,6 @@ public Label EditProjectLabel(long projectId, ProjectLabelEdit label)
9982
return _api.Put().With(label).To<Label>(string.Format(CultureInfo.InvariantCulture, ProjectLabelUrl, projectId));
10083
}
10184

102-
[Obsolete("Use EditProjectLabel instead")]
103-
public Label Edit(LabelEdit label)
104-
{
105-
return EditProjectLabel(label.Id, new ProjectLabelEdit
106-
{
107-
Name = label.Name,
108-
NewName = label.NewName,
109-
Color = label.Color,
110-
Description = label.Description,
111-
});
112-
}
113-
11485
public Label EditGroupLabel(long groupId, GroupLabelEdit label)
11586
{
11687
return _api.Put().With(label).To<Label>(string.Format(CultureInfo.InvariantCulture, GroupLabelUrl, groupId));
@@ -146,16 +117,6 @@ public Task DeleteProjectLabelAsync(long projectId, string labelName, Cancellati
146117
return _api.Delete().ExecuteAsync($"/projects/{projectId.ToStringInvariant()}/labels/{labelName}", cancellationToken);
147118
}
148119

149-
[Obsolete("Use DeleteProjectLabelAsync instead")]
150-
public Label Delete(LabelDelete label)
151-
{
152-
return DeleteProjectLabel(label.Id, new ProjectLabelDelete
153-
{
154-
Id = label.Id,
155-
Name = label.Name,
156-
});
157-
}
158-
159120
private static string AddLabelParameterQuery(string url, LabelQuery query)
160121
{
161122
if (query == null)

NGitLab/Impl/RepositoryClient.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,7 @@ private string BuildGetTreeUrl(RepositoryGetTreeOptions options)
150150

151151
private string BuildCompareUrl(CompareQuery query)
152152
{
153-
var from = query.From ?? query.Source;
154-
var to = query.To ?? query.Target;
155-
var url = _repoPath + $"/compare?from={from}&to={to}";
153+
var url = _repoPath + $"/compare?from={query.From}&to={query.To}";
156154
url = Utils.AddParameter(url, "from_project_id", query.FromProjectId);
157155
url = Utils.AddParameter(url, "straight", query.Straight);
158156
url = Utils.AddParameter(url, "unidiff", query.Unidiff);

NGitLab/Models/CompareQuery.cs

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,19 @@
1-
using System;
2-
3-
namespace NGitLab.Models;
1+
namespace NGitLab.Models;
42

53
/// <summary>
64
/// Query details for comparison of branches/tags/commit hashes
75
/// </summary>
8-
public class CompareQuery
6+
public class CompareQuery(string from, string to)
97
{
10-
/// <summary>
11-
/// The source for comparison, can be a branch, tag or a commit hash.
12-
/// </summary>
13-
[Obsolete("Use 'From' instead.")]
14-
public string Source { get; set; }
15-
168
/// <summary>
179
/// The most recent reference for comparison, can be a branch, tag or a commit hash.
1810
/// </summary>
19-
public string From { get; set; }
20-
21-
/// <summary>
22-
/// The target for comparison, can be a branch, tag or a commit hash.
23-
/// </summary>
24-
[Obsolete("Use 'To' instead.")]
25-
public string Target { get; set; }
11+
public string From { get; set; } = from;
2612

2713
/// <summary>
2814
/// The reference to compare against, can be a branch, tag or a commit hash.
2915
/// </summary>
30-
public string To { get; set; }
16+
public string To { get; set; } = to;
3117

3218
/// <summary>
3319
/// Comparison method: true for direct comparison between from and to (from..to), false to compare using merge base (from…to)’. Default is false.
@@ -43,12 +29,4 @@ public class CompareQuery
4329
/// The ID to compare from.
4430
/// </summary>
4531
public long? FromProjectId { get; set; }
46-
47-
public CompareQuery(string source, string target)
48-
{
49-
Source = source;
50-
Target = target;
51-
From = source;
52-
To = target;
53-
}
5432
}

NGitLab/PublicAPI/net472/PublicAPI.Unshipped.txt

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -350,15 +350,12 @@ NGitLab.IJobClient.GetTraceAsync(long jobId, System.Threading.CancellationToken
350350
NGitLab.IJobClient.RunAction(long jobId, NGitLab.Models.JobAction action) -> NGitLab.Models.Job
351351
NGitLab.IJobClient.RunActionAsync(long jobId, NGitLab.Models.JobAction action, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<NGitLab.Models.Job>
352352
NGitLab.ILabelClient
353-
NGitLab.ILabelClient.Create(NGitLab.Models.LabelCreate label) -> NGitLab.Models.Label
354353
NGitLab.ILabelClient.CreateGroupLabel(long groupId, NGitLab.Models.GroupLabelCreate label) -> NGitLab.Models.Label
355354
NGitLab.ILabelClient.CreateGroupLabel(NGitLab.Models.LabelCreate label) -> NGitLab.Models.Label
356355
NGitLab.ILabelClient.CreateProjectLabel(long projectId, NGitLab.Models.ProjectLabelCreate label) -> NGitLab.Models.Label
357-
NGitLab.ILabelClient.Delete(NGitLab.Models.LabelDelete label) -> NGitLab.Models.Label
358356
NGitLab.ILabelClient.DeleteProjectLabel(long projectId, NGitLab.Models.ProjectLabelDelete label) -> NGitLab.Models.Label
359357
NGitLab.ILabelClient.DeleteProjectLabelAsync(long projectId, long labelId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task
360358
NGitLab.ILabelClient.DeleteProjectLabelAsync(long projectId, string labelName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task
361-
NGitLab.ILabelClient.Edit(NGitLab.Models.LabelEdit label) -> NGitLab.Models.Label
362359
NGitLab.ILabelClient.EditGroupLabel(long groupId, NGitLab.Models.GroupLabelEdit label) -> NGitLab.Models.Label
363360
NGitLab.ILabelClient.EditGroupLabel(NGitLab.Models.LabelEdit label) -> NGitLab.Models.Label
364361
NGitLab.ILabelClient.EditProjectLabel(long projectId, NGitLab.Models.ProjectLabelEdit label) -> NGitLab.Models.Label
@@ -367,7 +364,6 @@ NGitLab.ILabelClient.ForGroup(long groupId, NGitLab.Models.LabelQuery labelQuery
367364
NGitLab.ILabelClient.ForProject(long projectId) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Label>
368365
NGitLab.ILabelClient.ForProject(long projectId, NGitLab.Models.LabelQuery labelQuery) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Label>
369366
NGitLab.ILabelClient.GetGroupLabel(long groupId, string name) -> NGitLab.Models.Label
370-
NGitLab.ILabelClient.GetLabel(long projectId, string name) -> NGitLab.Models.Label
371367
NGitLab.ILabelClient.GetProjectLabel(long projectId, string name) -> NGitLab.Models.Label
372368
NGitLab.ILintClient
373369
NGitLab.ILintClient.ValidateCIYamlContentAsync(string projectId, string yamlContent, NGitLab.Models.LintCIOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<NGitLab.Models.LintCI>
@@ -664,15 +660,12 @@ NGitLab.Impl.JobClient.JobClient(NGitLab.Impl.API api, NGitLab.Models.ProjectId
664660
NGitLab.Impl.JobClient.RunAction(long jobId, NGitLab.Models.JobAction action) -> NGitLab.Models.Job
665661
NGitLab.Impl.JobClient.RunActionAsync(long jobId, NGitLab.Models.JobAction action, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task<NGitLab.Models.Job>
666662
NGitLab.Impl.LabelClient
667-
NGitLab.Impl.LabelClient.Create(NGitLab.Models.LabelCreate label) -> NGitLab.Models.Label
668663
NGitLab.Impl.LabelClient.CreateGroupLabel(long groupId, NGitLab.Models.GroupLabelCreate label) -> NGitLab.Models.Label
669664
NGitLab.Impl.LabelClient.CreateGroupLabel(NGitLab.Models.LabelCreate label) -> NGitLab.Models.Label
670665
NGitLab.Impl.LabelClient.CreateProjectLabel(long projectId, NGitLab.Models.ProjectLabelCreate label) -> NGitLab.Models.Label
671-
NGitLab.Impl.LabelClient.Delete(NGitLab.Models.LabelDelete label) -> NGitLab.Models.Label
672666
NGitLab.Impl.LabelClient.DeleteProjectLabel(long projectId, NGitLab.Models.ProjectLabelDelete label) -> NGitLab.Models.Label
673667
NGitLab.Impl.LabelClient.DeleteProjectLabelAsync(long projectId, long labelId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task
674668
NGitLab.Impl.LabelClient.DeleteProjectLabelAsync(long projectId, string labelName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task
675-
NGitLab.Impl.LabelClient.Edit(NGitLab.Models.LabelEdit label) -> NGitLab.Models.Label
676669
NGitLab.Impl.LabelClient.EditGroupLabel(long groupId, NGitLab.Models.GroupLabelEdit label) -> NGitLab.Models.Label
677670
NGitLab.Impl.LabelClient.EditGroupLabel(NGitLab.Models.LabelEdit label) -> NGitLab.Models.Label
678671
NGitLab.Impl.LabelClient.EditProjectLabel(long projectId, NGitLab.Models.ProjectLabelEdit label) -> NGitLab.Models.Label
@@ -681,7 +674,6 @@ NGitLab.Impl.LabelClient.ForGroup(long groupId, NGitLab.Models.LabelQuery query)
681674
NGitLab.Impl.LabelClient.ForProject(long projectId) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Label>
682675
NGitLab.Impl.LabelClient.ForProject(long projectId, NGitLab.Models.LabelQuery query) -> System.Collections.Generic.IEnumerable<NGitLab.Models.Label>
683676
NGitLab.Impl.LabelClient.GetGroupLabel(long groupId, string name) -> NGitLab.Models.Label
684-
NGitLab.Impl.LabelClient.GetLabel(long projectId, string name) -> NGitLab.Models.Label
685677
NGitLab.Impl.LabelClient.GetProjectLabel(long projectId, string name) -> NGitLab.Models.Label
686678
NGitLab.Impl.LabelClient.LabelClient(NGitLab.Impl.API api) -> void
687679
NGitLab.Impl.LintClient
@@ -1686,17 +1678,13 @@ NGitLab.Models.CommitStatusQuery.Sort.init -> void
16861678
NGitLab.Models.CommitStatusQuery.Stage.get -> string
16871679
NGitLab.Models.CommitStatusQuery.Stage.init -> void
16881680
NGitLab.Models.CompareQuery
1689-
NGitLab.Models.CompareQuery.CompareQuery(string source, string target) -> void
1681+
NGitLab.Models.CompareQuery.CompareQuery(string from, string to) -> void
16901682
NGitLab.Models.CompareQuery.From.get -> string
16911683
NGitLab.Models.CompareQuery.From.set -> void
16921684
NGitLab.Models.CompareQuery.FromProjectId.get -> long?
16931685
NGitLab.Models.CompareQuery.FromProjectId.set -> void
1694-
NGitLab.Models.CompareQuery.Source.get -> string
1695-
NGitLab.Models.CompareQuery.Source.set -> void
16961686
NGitLab.Models.CompareQuery.Straight.get -> bool?
16971687
NGitLab.Models.CompareQuery.Straight.set -> void
1698-
NGitLab.Models.CompareQuery.Target.get -> string
1699-
NGitLab.Models.CompareQuery.Target.set -> void
17001688
NGitLab.Models.CompareQuery.To.get -> string
17011689
NGitLab.Models.CompareQuery.To.set -> void
17021690
NGitLab.Models.CompareQuery.Unidiff.get -> bool?

0 commit comments

Comments
 (0)