diff --git a/LibGit2Sharp.Tests/FileHistoryFixture.cs b/LibGit2Sharp.Tests/FileHistoryFixture.cs index ae2f48bb6..c74165fcf 100644 --- a/LibGit2Sharp.Tests/FileHistoryFixture.cs +++ b/LibGit2Sharp.Tests/FileHistoryFixture.cs @@ -98,7 +98,7 @@ public void CanFollowBranches(string specificRepoPath) // Test --date-order. var timeHistory = repo.Commits.QueryBy(path, - new FollowFilter { SortBy = CommitSortStrategies.Time }); + new CommitFilter { SortBy = CommitSortStrategies.Time }); var timeCommits = new List { master10, // master @@ -117,7 +117,7 @@ public void CanFollowBranches(string specificRepoPath) // Test --topo-order. var topoHistory = repo.Commits.QueryBy(path, - new FollowFilter { SortBy = CommitSortStrategies.Topological }); + new CommitFilter { SortBy = CommitSortStrategies.Topological }); var topoCommits = new List { master10, // master @@ -255,33 +255,33 @@ public void UnsupportedSortStrategyThrows() MakeAndCommitChange(repo, repoPath, path, "Hello World"); Assert.Throws(() => - repo.Commits.QueryBy(path, new FollowFilter + repo.Commits.QueryBy(path, new CommitFilter { SortBy = CommitSortStrategies.None })); Assert.Throws(() => - repo.Commits.QueryBy(path, new FollowFilter + repo.Commits.QueryBy(path, new CommitFilter { SortBy = CommitSortStrategies.Reverse })); Assert.Throws(() => - repo.Commits.QueryBy(path, new FollowFilter + repo.Commits.QueryBy(path, new CommitFilter { SortBy = CommitSortStrategies.Reverse | CommitSortStrategies.Topological })); Assert.Throws(() => - repo.Commits.QueryBy(path, new FollowFilter + repo.Commits.QueryBy(path, new CommitFilter { SortBy = CommitSortStrategies.Reverse | CommitSortStrategies.Time })); Assert.Throws(() => - repo.Commits.QueryBy(path, new FollowFilter + repo.Commits.QueryBy(path, new CommitFilter { SortBy = CommitSortStrategies.Reverse | CommitSortStrategies.Topological | diff --git a/LibGit2Sharp/CommitLog.cs b/LibGit2Sharp/CommitLog.cs index 3f9567745..06cb1b9ea 100644 --- a/LibGit2Sharp/CommitLog.cs +++ b/LibGit2Sharp/CommitLog.cs @@ -97,12 +97,27 @@ public IEnumerable QueryBy(string path) /// The file's path. /// The options used to control which commits will be returned. /// A list of file history entries, ready to be enumerated. + [Obsolete("This method is deprecated. Please use the overload which take LibGit2Sharp.CommitFilter")] public IEnumerable QueryBy(string path, FollowFilter filter) { Ensure.ArgumentNotNull(path, "path"); Ensure.ArgumentNotNull(filter, "filter"); - return new FileHistory(repo, path, new CommitFilter { SortBy = filter.SortBy }); + return QueryBy(path, new CommitFilter { SortBy = filter.SortBy }); + } + + /// + /// Returns the list of commits of the repository representing the history of a file beyond renames. + /// + /// The file's path. + /// The options used to control which commits will be returned. + /// A list of file history entries, ready to be enumerated. + public IEnumerable QueryBy(string path, CommitFilter filter) + { + Ensure.ArgumentNotNull(path, "path"); + Ensure.ArgumentNotNull(filter, "filter"); + + return new FileHistory(repo, path, filter); } private class CommitEnumerator : IEnumerator diff --git a/LibGit2Sharp/FollowFilter.cs b/LibGit2Sharp/FollowFilter.cs index 22681ed18..e4665ed45 100644 --- a/LibGit2Sharp/FollowFilter.cs +++ b/LibGit2Sharp/FollowFilter.cs @@ -9,6 +9,7 @@ namespace LibGit2Sharp /// The commits will be enumerated from the current HEAD of the repository. /// /// + [Obsolete("This type is deprecated. Please use LibGit2Sharp.CommitFilter")] public sealed class FollowFilter { private static readonly List AllowedSortStrategies = new List diff --git a/LibGit2Sharp/IQueryableCommitLog.cs b/LibGit2Sharp/IQueryableCommitLog.cs index 4a57dd3b3..76ea49172 100644 --- a/LibGit2Sharp/IQueryableCommitLog.cs +++ b/LibGit2Sharp/IQueryableCommitLog.cs @@ -28,6 +28,16 @@ public interface IQueryableCommitLog : ICommitLog /// The file's path. /// The options used to control which commits will be returned. /// A list of file history entries, ready to be enumerated. + [Obsolete("This method is deprecated. Please use the overload which take LibGit2Sharp.CommitFilter")] IEnumerable QueryBy(string path, FollowFilter filter); + + /// + /// Returns the list of commits of the repository representing the history of a file beyond renames. + /// + /// The file's path. + /// The options used to control which commits will be returned. + /// A list of file history entries, ready to be enumerated. + IEnumerable QueryBy(string path, CommitFilter filter); + } }