From c7d843f75ed49593ddeacdb4828af0135e7a06c9 Mon Sep 17 00:00:00 2001 From: nulltoken Date: Sun, 26 Jul 2015 19:43:36 +0200 Subject: [PATCH] Obsolete CommitFilter.Since and Until --- LibGit2Sharp.Tests/CommitFixture.cs | 56 +++++++++++------------ LibGit2Sharp.Tests/FilterBranchFixture.cs | 34 +++++++------- LibGit2Sharp.Tests/RebaseFixture.cs | 8 ++-- LibGit2Sharp.Tests/RepositoryFixture.cs | 8 ++-- LibGit2Sharp/Branch.cs | 2 +- LibGit2Sharp/CommitFilter.cs | 40 ++++++++++++++-- LibGit2Sharp/Core/HistoryRewriter.cs | 2 +- 7 files changed, 91 insertions(+), 59 deletions(-) diff --git a/LibGit2Sharp.Tests/CommitFixture.cs b/LibGit2Sharp.Tests/CommitFixture.cs index 46e800fd8..d2badd7b8 100644 --- a/LibGit2Sharp.Tests/CommitFixture.cs +++ b/LibGit2Sharp.Tests/CommitFixture.cs @@ -92,7 +92,7 @@ public void CanEnumerateCommitsFromSha() string path = SandboxBareTestRepo(); using (var repo = new Repository(path)) { - foreach (Commit commit in repo.Commits.QueryBy(new CommitFilter { Since = "a4a7dce85cf63874e984719f4fdd239f5145052f" })) + foreach (Commit commit in repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = "a4a7dce85cf63874e984719f4fdd239f5145052f" })) { Assert.NotNull(commit); count++; @@ -107,9 +107,9 @@ public void QueryingTheCommitHistoryWithUnknownShaOrInvalidEntryPointThrows() string path = SandboxBareTestRepo(); using (var repo = new Repository(path)) { - Assert.Throws(() => repo.Commits.QueryBy(new CommitFilter { Since = Constants.UnknownSha }).Count()); - Assert.Throws(() => repo.Commits.QueryBy(new CommitFilter { Since = "refs/heads/deadbeef" }).Count()); - Assert.Throws(() => repo.Commits.QueryBy(new CommitFilter { Since = null }).Count()); + Assert.Throws(() => repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = Constants.UnknownSha }).Count()); + Assert.Throws(() => repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = "refs/heads/deadbeef" }).Count()); + Assert.Throws(() => repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = null }).Count()); } } @@ -121,8 +121,8 @@ public void QueryingTheCommitHistoryFromACorruptedReferenceThrows() { CreateCorruptedDeadBeefHead(repo.Info.Path); - Assert.Throws(() => repo.Commits.QueryBy(new CommitFilter { Since = repo.Branches["deadbeef"] }).Count()); - Assert.Throws(() => repo.Commits.QueryBy(new CommitFilter { Since = repo.Refs["refs/heads/deadbeef"] }).Count()); + Assert.Throws(() => repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = repo.Branches["deadbeef"] }).Count()); + Assert.Throws(() => repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = repo.Refs["refs/heads/deadbeef"] }).Count()); } } @@ -132,8 +132,8 @@ public void QueryingTheCommitHistoryWithBadParamsThrows() string path = SandboxBareTestRepo(); using (var repo = new Repository(path)) { - Assert.Throws(() => repo.Commits.QueryBy(new CommitFilter { Since = string.Empty })); - Assert.Throws(() => repo.Commits.QueryBy(new CommitFilter { Since = null })); + Assert.Throws(() => repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = string.Empty })); + Assert.Throws(() => repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = null })); Assert.Throws(() => repo.Commits.QueryBy(default(CommitFilter))); } } @@ -150,7 +150,7 @@ public void CanEnumerateCommitsWithReverseTimeSorting() { foreach (Commit commit in repo.Commits.QueryBy(new CommitFilter { - Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", + IncludeReachableFrom = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = CommitSortStrategies.Time | CommitSortStrategies.Reverse })) { @@ -170,7 +170,7 @@ public void CanEnumerateCommitsWithReverseTopoSorting() { List commits = repo.Commits.QueryBy(new CommitFilter { - Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", + IncludeReachableFrom = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = CommitSortStrategies.Time | CommitSortStrategies.Reverse }).ToList(); foreach (Commit commit in commits) @@ -189,7 +189,7 @@ public void CanEnumerateCommitsWithReverseTopoSorting() public void CanSimplifyByFirstParent() { AssertEnumerationOfCommits( - repo => new CommitFilter { Since = repo.Head, FirstParentOnly = true }, + repo => new CommitFilter { IncludeReachableFrom = repo.Head, FirstParentOnly = true }, new[] { "4c062a6", "be3563a", "9fd738e", @@ -216,7 +216,7 @@ public void CanEnumerateCommitsWithTimeSorting() { foreach (Commit commit in repo.Commits.QueryBy(new CommitFilter { - Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", + IncludeReachableFrom = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = CommitSortStrategies.Time })) { @@ -236,7 +236,7 @@ public void CanEnumerateCommitsWithTopoSorting() { List commits = repo.Commits.QueryBy(new CommitFilter { - Since = "a4a7dce85cf63874e984719f4fdd239f5145052f", + IncludeReachableFrom = "a4a7dce85cf63874e984719f4fdd239f5145052f", SortBy = CommitSortStrategies.Topological }).ToList(); foreach (Commit commit in commits) @@ -255,7 +255,7 @@ public void CanEnumerateCommitsWithTopoSorting() public void CanEnumerateFromHead() { AssertEnumerationOfCommits( - repo => new CommitFilter { Since = repo.Head }, + repo => new CommitFilter { IncludeReachableFrom = repo.Head }, new[] { "4c062a6", "be3563a", "c47800c", "9fd738e", @@ -277,7 +277,7 @@ public void CanEnumerateFromDetachedHead() repoClone.Checkout(headSha); AssertEnumerationOfCommitsInRepo(repoClone, - repo => new CommitFilter { Since = repo.Head }, + repo => new CommitFilter { IncludeReachableFrom = repo.Head }, new[] { "32eab9c", "592d3c8", "4c062a6", @@ -291,7 +291,7 @@ public void CanEnumerateFromDetachedHead() public void CanEnumerateUsingTwoHeadsAsBoundaries() { AssertEnumerationOfCommits( - repo => new CommitFilter { Since = "HEAD", Until = "refs/heads/br2" }, + repo => new CommitFilter { IncludeReachableFrom = "HEAD", ExcludeReachableFrom = "refs/heads/br2" }, new[] { "4c062a6", "be3563a" } ); } @@ -300,7 +300,7 @@ public void CanEnumerateUsingTwoHeadsAsBoundaries() public void CanEnumerateUsingImplicitHeadAsSinceBoundary() { AssertEnumerationOfCommits( - repo => new CommitFilter { Until = "refs/heads/br2" }, + repo => new CommitFilter { ExcludeReachableFrom = "refs/heads/br2" }, new[] { "4c062a6", "be3563a" } ); } @@ -309,7 +309,7 @@ public void CanEnumerateUsingImplicitHeadAsSinceBoundary() public void CanEnumerateUsingTwoAbbreviatedShasAsBoundaries() { AssertEnumerationOfCommits( - repo => new CommitFilter { Since = "a4a7dce", Until = "4a202b3" }, + repo => new CommitFilter { IncludeReachableFrom = "a4a7dce", ExcludeReachableFrom = "4a202b3" }, new[] { "a4a7dce", "c47800c", "9fd738e" } ); } @@ -318,7 +318,7 @@ public void CanEnumerateUsingTwoAbbreviatedShasAsBoundaries() public void CanEnumerateCommitsFromTwoHeads() { AssertEnumerationOfCommits( - repo => new CommitFilter { Since = new[] { "refs/heads/br2", "refs/heads/master" } }, + repo => new CommitFilter { IncludeReachableFrom = new[] { "refs/heads/br2", "refs/heads/master" } }, new[] { "4c062a6", "a4a7dce", "be3563a", "c47800c", @@ -330,7 +330,7 @@ public void CanEnumerateCommitsFromTwoHeads() public void CanEnumerateCommitsFromMixedStartingPoints() { AssertEnumerationOfCommits( - repo => new CommitFilter { Since = new object[] { repo.Branches["br2"], + repo => new CommitFilter { IncludeReachableFrom = new object[] { repo.Branches["br2"], "refs/heads/master", new ObjectId("e90810b8df3e80c413d903f631643c716887138d") } }, new[] @@ -345,7 +345,7 @@ public void CanEnumerateCommitsFromMixedStartingPoints() public void CanEnumerateCommitsUsingGlob() { AssertEnumerationOfCommits( - repo => new CommitFilter { Since = repo.Refs.FromGlob("refs/heads/*") }, + repo => new CommitFilter { IncludeReachableFrom = repo.Refs.FromGlob("refs/heads/*") }, new[] { "4c062a6", "e90810b", "6dcf9bf", "a4a7dce", "be3563a", "c47800c", "9fd738e", "4a202b3", "41bc8c6", "5001298", "5b5b025", "8496071" @@ -356,7 +356,7 @@ public void CanEnumerateCommitsUsingGlob() public void CanHideCommitsUsingGlob() { AssertEnumerationOfCommits( - repo => new CommitFilter { Since = "refs/heads/packed-test", Until = repo.Refs.FromGlob("*/packed") }, + repo => new CommitFilter { IncludeReachableFrom = "refs/heads/packed-test", ExcludeReachableFrom = repo.Refs.FromGlob("*/packed") }, new[] { "4a202b3", "5b5b025", "8496071" @@ -378,7 +378,7 @@ public void CanEnumerateCommitsFromATagAnnotation() private void CanEnumerateCommitsFromATag(Func transformer) { AssertEnumerationOfCommits( - repo => new CommitFilter { Since = transformer(repo.Tags["test"]) }, + repo => new CommitFilter { IncludeReachableFrom = transformer(repo.Tags["test"]) }, new[] { "e90810b", "6dcf9bf", } ); } @@ -389,7 +389,7 @@ public void CanEnumerateAllCommits() AssertEnumerationOfCommits( repo => new CommitFilter { - Since = repo.Refs.OrderBy(r => r.CanonicalName, StringComparer.Ordinal), + IncludeReachableFrom = repo.Refs.OrderBy(r => r.CanonicalName, StringComparer.Ordinal), }, new[] { @@ -404,7 +404,7 @@ public void CanEnumerateAllCommits() public void CanEnumerateCommitsFromATagWhichPointsToABlob() { AssertEnumerationOfCommits( - repo => new CommitFilter { Since = repo.Tags["point_to_blob"] }, + repo => new CommitFilter { IncludeReachableFrom = repo.Tags["point_to_blob"] }, new string[] { }); } @@ -419,7 +419,7 @@ public void CanEnumerateCommitsFromATagWhichPointsToATree() Tag tag = repo.ApplyTag("point_to_tree", headTreeSha); AssertEnumerationOfCommitsInRepo(repo, - r => new CommitFilter { Since = tag }, + r => new CommitFilter { IncludeReachableFrom = tag }, new string[] { }); } } @@ -880,10 +880,10 @@ public void CanRetrieveChildrenOfASpecificCommit() var filter = new CommitFilter { /* Revwalk from all the refs (git log --all) ... */ - Since = repo.Refs, + IncludeReachableFrom = repo.Refs, /* ... and stop when the parent is reached */ - Until = parentSha + ExcludeReachableFrom = parentSha }; var commits = repo.Commits.QueryBy(filter); diff --git a/LibGit2Sharp.Tests/FilterBranchFixture.cs b/LibGit2Sharp.Tests/FilterBranchFixture.cs index aed628a15..2199cea4c 100644 --- a/LibGit2Sharp.Tests/FilterBranchFixture.cs +++ b/LibGit2Sharp.Tests/FilterBranchFixture.cs @@ -29,7 +29,7 @@ public override void Dispose() public void CanRewriteHistoryWithoutChangingCommitMetadata() { var originalRefs = repo.Refs.ToList().OrderBy(r => r.CanonicalName); - var commits = repo.Commits.QueryBy(new CommitFilter { Since = repo.Refs }).ToArray(); + var commits = repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = repo.Refs }).ToArray(); // Noop header rewriter repo.Refs.RewriteHistory(new RewriteHistoryOptions @@ -42,14 +42,14 @@ public void CanRewriteHistoryWithoutChangingCommitMetadata() AssertSucceedingButNotError(); Assert.Equal(originalRefs, repo.Refs.ToList().OrderBy(r => r.CanonicalName)); - Assert.Equal(commits, repo.Commits.QueryBy(new CommitFilter { Since = repo.Refs }).ToArray()); + Assert.Equal(commits, repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = repo.Refs }).ToArray()); } [Fact] public void CanRewriteHistoryWithoutChangingTrees() { var originalRefs = repo.Refs.ToList().OrderBy(r => r.CanonicalName); - var commits = repo.Commits.QueryBy(new CommitFilter { Since = repo.Refs }).ToArray(); + var commits = repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = repo.Refs }).ToArray(); // Noop tree rewriter repo.Refs.RewriteHistory(new RewriteHistoryOptions @@ -62,14 +62,14 @@ public void CanRewriteHistoryWithoutChangingTrees() AssertSucceedingButNotError(); Assert.Equal(originalRefs, repo.Refs.ToList().OrderBy(r => r.CanonicalName)); - Assert.Equal(commits, repo.Commits.QueryBy(new CommitFilter { Since = repo.Refs }).ToArray()); + Assert.Equal(commits, repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = repo.Refs }).ToArray()); } [Fact] public void CanRollbackRewriteByThrowingInOnCompleting() { var originalRefs = repo.Refs.ToList().OrderBy(r => r.CanonicalName); - var commits = repo.Commits.QueryBy(new CommitFilter { Since = repo.Refs }).ToArray(); + var commits = repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = repo.Refs }).ToArray(); Assert.Throws( () => @@ -90,14 +90,14 @@ public void CanRollbackRewriteByThrowingInOnCompleting() AssertSucceedingButNotError(); Assert.Equal(originalRefs, repo.Refs.ToList().OrderBy(r => r.CanonicalName)); - Assert.Equal(commits, repo.Commits.QueryBy(new CommitFilter { Since = repo.Refs }).ToArray()); + Assert.Equal(commits, repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = repo.Refs }).ToArray()); } [Fact] public void ErrorThrownInOnErrorTakesPrecedenceOverErrorDuringCommitHeaderRewriter() { var originalRefs = repo.Refs.ToList().OrderBy(r => r.CanonicalName); - var commits = repo.Commits.QueryBy(new CommitFilter { Since = repo.Refs }).ToArray(); + var commits = repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = repo.Refs }).ToArray(); var thrown = Assert.Throws( () => @@ -117,14 +117,14 @@ public void ErrorThrownInOnErrorTakesPrecedenceOverErrorDuringCommitHeaderRewrit Assert.Equal("From CommitHeaderRewriter", thrown.InnerException.Message); Assert.Equal(originalRefs, repo.Refs.ToList().OrderBy(r => r.CanonicalName)); - Assert.Equal(commits, repo.Commits.QueryBy(new CommitFilter { Since = repo.Refs }).ToArray()); + Assert.Equal(commits, repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = repo.Refs }).ToArray()); } [Fact] public void ErrorThrownInOnErrorTakesPrecedenceOverErrorDuringCommitTreeRewriter() { var originalRefs = repo.Refs.ToList().OrderBy(r => r.CanonicalName); - var commits = repo.Commits.QueryBy(new CommitFilter { Since = repo.Refs }).ToArray(); + var commits = repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = repo.Refs }).ToArray(); var thrown = Assert.Throws( () => @@ -144,13 +144,13 @@ public void ErrorThrownInOnErrorTakesPrecedenceOverErrorDuringCommitTreeRewriter Assert.Equal("From CommitTreeRewriter", thrown.InnerException.Message); Assert.Equal(originalRefs, repo.Refs.ToList().OrderBy(r => r.CanonicalName)); - Assert.Equal(commits, repo.Commits.QueryBy(new CommitFilter { Since = repo.Refs }).ToArray()); + Assert.Equal(commits, repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = repo.Refs }).ToArray()); } [Fact] public void CanRewriteAuthorOfCommits() { - var commits = repo.Commits.QueryBy(new CommitFilter { Since = repo.Refs }).ToArray(); + var commits = repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = repo.Refs }).ToArray(); repo.Refs.RewriteHistory(new RewriteHistoryOptions { OnError = OnError, @@ -164,7 +164,7 @@ public void CanRewriteAuthorOfCommits() var nonBackedUpRefs = repo.Refs.Where( x => !x.CanonicalName.StartsWith("refs/original/") && !x.CanonicalName.StartsWith("refs/notes/")); - Assert.Empty(repo.Commits.QueryBy(new CommitFilter { Since = nonBackedUpRefs }) + Assert.Empty(repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = nonBackedUpRefs }) .Where(c => c.Author.Name != "Ben Straub")); } @@ -217,7 +217,7 @@ public void CanRewriteTrees() [Fact] public void CanRewriteTreesByInjectingTreeEntry() { - var commits = repo.Commits.QueryBy(new CommitFilter { Since = repo.Branches }).ToArray(); + var commits = repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = repo.Branches }).ToArray(); var currentReadme = repo.Head["README"]; @@ -236,7 +236,7 @@ public void CanRewriteTreesByInjectingTreeEntry() Assert.Equal(new Commit[0], repo.Commits - .QueryBy(new CommitFilter {Since = repo.Branches}) + .QueryBy(new CommitFilter {IncludeReachableFrom = repo.Branches}) .Where(c => c["README"] != null && c["README"].Target.Id != currentReadme.Target.Id) .ToArray()); @@ -541,7 +541,7 @@ public void CanNotOverWriteBackedUpReferences() [Fact] public void CanNotOverWriteAnExistingReference() { - var commits = repo.Commits.QueryBy(new CommitFilter { Since = repo.Refs }).ToArray(); + var commits = repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = repo.Refs }).ToArray(); var ex = Assert.Throws( () => @@ -700,7 +700,7 @@ public void CanProvideNewNamesForTags() CommitHeaderRewriter = c => CommitRewriteInfo.From(c, message: ""), TagNameRewriter = TagNameRewriter, - }, repo.Commits.QueryBy(new CommitFilter { Since = repo.Refs["refs/heads/test"] })); + }, repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = repo.Refs["refs/heads/test"] })); AssertSucceedingButNotError(); @@ -807,7 +807,7 @@ public void RewritingNotesHasNoEffect() { var notesRefsRetriever = new Func>(() => repo.Refs.Where(r => r.CanonicalName.StartsWith("refs/notes/"))); var originalNotesRefs = notesRefsRetriever().ToList(); - var commits = repo.Commits.QueryBy(new CommitFilter { Since = originalNotesRefs }).ToArray(); + var commits = repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = originalNotesRefs }).ToArray(); repo.Refs.RewriteHistory(new RewriteHistoryOptions { diff --git a/LibGit2Sharp.Tests/RebaseFixture.cs b/LibGit2Sharp.Tests/RebaseFixture.cs index b8749f2a8..d70851bdc 100644 --- a/LibGit2Sharp.Tests/RebaseFixture.cs +++ b/LibGit2Sharp.Tests/RebaseFixture.cs @@ -97,8 +97,8 @@ public void CanRebase(string initialBranchName, // Verify the chain of source commits that were rebased. CommitFilter sourceCommitFilter = new CommitFilter() { - Since = expectedSinceCommit, - Until = expectedUntilCommit, + IncludeReachableFrom = expectedSinceCommit, + ExcludeReachableFrom = expectedUntilCommit, SortBy = CommitSortStrategies.Reverse | CommitSortStrategies.Topological, }; Assert.Equal(repo.Commits.QueryBy(sourceCommitFilter), PreRebaseCommits); @@ -261,8 +261,8 @@ public void VerifyRebaseDetailed(string attributes, string lineEnding, string[] // Verify the chain of resultant rebased commits. CommitFilter commitFilter = new CommitFilter() { - Since = repo.Head.Tip, - Until = upstreamBranch.Tip, + IncludeReachableFrom = repo.Head.Tip, + ExcludeReachableFrom = upstreamBranch.Tip, SortBy = CommitSortStrategies.Reverse | CommitSortStrategies.Topological, }; diff --git a/LibGit2Sharp.Tests/RepositoryFixture.cs b/LibGit2Sharp.Tests/RepositoryFixture.cs index 2453f7bfb..509ff7bac 100644 --- a/LibGit2Sharp.Tests/RepositoryFixture.cs +++ b/LibGit2Sharp.Tests/RepositoryFixture.cs @@ -264,10 +264,10 @@ private static void AssertInitializedRepository(IRepository repo, string expecte Assert.Equal(0, repo.Commits.Count()); Assert.Equal(0, repo.Commits.QueryBy(new CommitFilter()).Count()); - Assert.Equal(0, repo.Commits.QueryBy(new CommitFilter { Since = repo.Refs.Head }).Count()); - Assert.Equal(0, repo.Commits.QueryBy(new CommitFilter { Since = repo.Head }).Count()); - Assert.Equal(0, repo.Commits.QueryBy(new CommitFilter { Since = "HEAD" }).Count()); - Assert.Equal(0, repo.Commits.QueryBy(new CommitFilter { Since = expectedHeadTargetIdentifier }).Count()); + Assert.Equal(0, repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = repo.Refs.Head }).Count()); + Assert.Equal(0, repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = repo.Head }).Count()); + Assert.Equal(0, repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = "HEAD" }).Count()); + Assert.Equal(0, repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = expectedHeadTargetIdentifier }).Count()); Assert.Null(repo.Head["subdir/I-do-not-exist"]); diff --git a/LibGit2Sharp/Branch.cs b/LibGit2Sharp/Branch.cs index 905d94132..31fe33d89 100644 --- a/LibGit2Sharp/Branch.cs +++ b/LibGit2Sharp/Branch.cs @@ -122,7 +122,7 @@ public virtual Commit Tip /// public virtual ICommitLog Commits { - get { return repo.Commits.QueryBy(new CommitFilter { Since = this }); } + get { return repo.Commits.QueryBy(new CommitFilter { IncludeReachableFrom = this }); } } /// diff --git a/LibGit2Sharp/CommitFilter.cs b/LibGit2Sharp/CommitFilter.cs index 114cb4988..d3a815216 100644 --- a/LibGit2Sharp/CommitFilter.cs +++ b/LibGit2Sharp/CommitFilter.cs @@ -1,4 +1,5 @@ -using System.Collections; +using System; +using System.Collections; using System.Collections.Generic; using System.Linq; @@ -15,7 +16,7 @@ public sealed class CommitFilter public CommitFilter() { SortBy = CommitSortStrategies.Time; - Since = "HEAD"; + IncludeReachableFrom = "HEAD"; FirstParentOnly = false; } @@ -36,7 +37,23 @@ public CommitFilter() /// By default, the will be used as boundary. /// /// - public object Since { get; set; } + [Obsolete("This property will be removed in the next release. Please use IncludeReachableFrom instead.")] + public object Since + { + get { return IncludeReachableFrom; } + set { IncludeReachableFrom = value; } + } + + /// + /// A pointer to a commit object or a list of pointers to consider as starting points. + /// + /// Can be either a containing the sha or reference canonical name to use, + /// a , a , a , a , + /// a , an or even a mixed collection of all of the above. + /// By default, the will be used as boundary. + /// + /// + public object IncludeReachableFrom { get; set; } internal IList SinceList { @@ -51,7 +68,22 @@ internal IList SinceList /// a , an or even a mixed collection of all of the above. /// /// - public object Until { get; set; } + [Obsolete("This property will be removed in the next release. Please use ExcludeReachableFrom instead.")] + public object Until + { + get { return ExcludeReachableFrom; } + set { ExcludeReachableFrom = value; } + } + + /// + /// A pointer to a commit object or a list of pointers which will be excluded (along with ancestors) from the enumeration. + /// + /// Can be either a containing the sha or reference canonical name to use, + /// a , a , a , a , + /// a , an or even a mixed collection of all of the above. + /// + /// + public object ExcludeReachableFrom { get; set; } internal IList UntilList { diff --git a/LibGit2Sharp/Core/HistoryRewriter.cs b/LibGit2Sharp/Core/HistoryRewriter.cs index de1b24ffa..784c1cc9c 100644 --- a/LibGit2Sharp/Core/HistoryRewriter.cs +++ b/LibGit2Sharp/Core/HistoryRewriter.cs @@ -45,7 +45,7 @@ public void Execute() var filter = new CommitFilter { - Since = refsToRewrite, + IncludeReachableFrom = refsToRewrite, SortBy = CommitSortStrategies.Reverse | CommitSortStrategies.Topological };