8000 Merge pull request #1310 from Aimeast/master · cczinski/libgit2sharp@70ad4a5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 70ad4a5

Browse files
author
Edward Thomson
authored
Merge pull request libgit2#1310 from Aimeast/master
Remove FollowFilter for add an override of QueryBy
2 parents c27925b + b1a1806 commit 70ad4a5

File tree

4 files changed

+34
-8
lines changed

4 files changed

+34
-8
lines changed

LibGit2Sharp.Tests/FileHistoryFixture.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void CanFollowBranches(string specificRepoPath)
9898

9999
// Test --date-order.
100100
var timeHistory = repo.Commits.QueryBy(path,
101-
new FollowFilter { SortBy = CommitSortStrategies.Time });
101+
new CommitFilter { SortBy = CommitSortStrategies.Time });
102102
var timeCommits = new List<Commit>
103103
{
104104
master10, // master
@@ -117,7 +117,7 @@ public void CanFollowBranches(string specificRepoPath)
117117

118118
// Test --topo-order.
119119
var topoHistory = repo.Commits.QueryBy(path,
120-
new FollowFilter { SortBy = CommitSortStrategies.Topological });
120+
new CommitFilter { SortBy = CommitSortStrategies.Topological });
121121
var topoCommits = new List<Commit>
122122
{
123123
master10, // master
@@ -255,33 +255,33 @@ public void UnsupportedSortStrategyThrows()
255255
MakeAndCommitChange(repo, repoPath, path, "Hello World");
256256

257257
Assert.Throws<ArgumentException>(() =>
258-
repo.Commits.QueryBy(path, new FollowFilter
258+
repo.Commits.QueryBy(path, new CommitFilter
259259
{
260260
SortBy = CommitSortStrategies.None
261261
}));
262262

263263
Assert.Throws<ArgumentException>(() =>
264-
repo.Commits.QueryBy(path, new FollowFilter
264+
repo.Commits.QueryBy(path, new CommitFilter
265265
{
266266
SortBy = CommitSortStrategies.Reverse
267267
}));
268268

269269
Assert.Throws<ArgumentException>(() =>
270-
repo.Commits.QueryBy(path, new FollowFilter
270+
repo.Commits.QueryBy(path, new CommitFilter
271271
{
272272
SortBy = CommitSortStrategies.Reverse |
273273
CommitSortStrategies.Topological
274274
}));
275275

276276
Assert.Throws<ArgumentException>(() =>
277-
repo.Commits.QueryBy(path, new FollowFilter
277+
repo.Commits.QueryBy(path, new CommitFilter
278278
{
279279
SortBy = CommitSortStrategies.Reverse |
280280
CommitSortStrategies.Time
281281
}));
282282

283283
Assert.Throws<ArgumentException>(() =>
284-
repo.Commits.QueryBy(path, new FollowFilter
284+
repo.Commits.QueryBy(path, new CommitFilter
285285
{
286286
SortBy = CommitSortStrategies.Reverse |
287287
CommitSortStrategies.Topological |

LibGit2Sharp/CommitLog.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,27 @@ public IEnumerable<LogEntry> QueryBy(string path)
9797
/// <param name="path">The file's path.</param>
9898
/// <param name="filter">The options used to control which commits will be returned.</param>
9999
/// <returns>A list of file history entries, ready to be enumerated.</returns>
100+
[Obsolete("This method is deprecated. Please use the overload which take LibGit2Sharp.CommitFilter")]
100101
public IEnumerable<LogEntry> QueryBy(string path, FollowFilter filter)
101102
{
102103
Ensure.ArgumentNotNull(path, "path");
103104
Ensure.ArgumentNotNull(filter, "filter");
104105

105-
return new FileHistory(repo, path, new CommitFilter { SortBy = filter.SortBy });
106+
return QueryBy(path, new CommitFilter { SortBy = filter.SortBy });
107+
}
108+
109+
/// <summary>
110+
/// Returns the list of commits of the repository representing the history of a file beyond renames.
111+
/// </summary>
112+
/// <param name="path">The file's path.</param>
113+
/// <param name="filter">The options used to control which commits will be returned.</param>
114+
/// <returns>A list of file history entries, ready to be enumerated.</returns>
115+
public IEnumerable<LogEntry> QueryBy(string path, CommitFilter filter)
116+
{
117+
Ensure.ArgumentNotNull(path, "path");
118+
Ensure.ArgumentNotNull(filter, "filter");
119+
120+
return new FileHistory(repo, path, filter);
106121
}
107122

108123
private class CommitEnumerator : IEnumerator<Commit>

LibGit2Sharp/FollowFilter.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ namespace LibGit2Sharp
99
/// The commits will be enumerated from the current HEAD of the repository.
1010
/// </para>
1111
/// </summary>
12+
[Obsolete("This type is deprecated. Please use LibGit2Sharp.CommitFilter")]
1213
public sealed class FollowFilter
1314
{
1415
private static readonly List<CommitSortStrategies> AllowedSortStrategies = new List<CommitSortStrategies>

LibGit2Sharp/IQueryableCommitLog.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,16 @@ public interface IQueryableCommitLog : ICommitLog
2828
/// <param name="path">The file's path.</param>
2929
/// <param name="filter">The options used to control which commits will be returned.</param>
3030
/// <returns>A list of file history entries, ready to be enumerated.</returns>
31+
[Obsolete("This method is deprecated. Please use the overload which take LibGit2Sharp.CommitFilter")]
3132
IEnumerable<LogEntry> QueryBy(string path, FollowFilter filter);
33+
34+
/// <summary>
35+
/// Returns the list of commits of the repository representing the history of a file beyond renames.
36+
/// </summary>
37+
/// <param name="path">The file's path.</param>
38+
/// <param name="filter">The options used to control which commits will be returned.</param>
39+
/// <returns>A list of file history entries, ready to be enumerated.</returns>
40+
IEnumerable<LogEntry> QueryBy(string path, CommitFilter filter);
41+
3242
}
3343
}

0 commit comments

Comments
 (0)
0