Reputation: 3485
I'm using filter with QueryBy to get the commits that I'm interested in.
// Set the filter
CommitFilter filter = null;
filter = new CommitFilter()
{
IncludeReachableFrom = "85494c32921c136cc3381fc14a3a20e08012c514",
ExcludeReachableFrom = "63c8cb9ed585c0f3b79b6e2efc067e254910f875"
};
// Get the commits
repo.Commits.QueryBy(filter)
The QueryBy will not return the 63c8cb9ed585c0f3b79b6e2efc067e254910f875 commit, it will return the commits between the two.
Is there a way to have the 63c8cb9ed585c0f3b79b6e2efc067e254910f875 commit included as well ?
Maybe there another way available that I can use to get to the previous 63c8cb9ed585c0f3b79b6e2efc067e254910f875 from the commit that came after 63c8cb9ed585c0f3b79b6e2efc067e254910f875 and is returned by the query ?
Upvotes: 1
Views: 789
Reputation: 74144
You can use parents of the Commit
as list of commit pointers for your ExcludeReachableFrom
filter.
var filter = new CommitFilter
{
IncludeReachableFrom = "824201fcb8d4fa79b0aafa7c5aea86643cdd118a",
ExcludeReachableFrom = repo.Lookup<Commit>("bcd85da0e287a3b404d12f8b666888962f692076").Parents
};
var commits = repo.Commits.QueryBy(filter);
foreach (var commit in commits)
{
Console.WriteLine($"{commit.Sha}");
}
824201fcb8d4fa79b0aafa7c5aea86643cdd118a
934fa3892acb2a48f296b7afc66b07125fb6db91
da995a21dc3fd038173695776fc1a3f4ff64f6ab
a9ee8086e5647141087c90909cd847a5fa5f294e
6313ca4b41dfef4d6b779f34f7b4807917c31188
bcd85da0e287a3b404d12f8b666888962f692076
Upvotes: 2