public virtual void TestSkipRevFilter0() { RevCommit a = Commit(); RevCommit b = Commit(a); rw.Reset(); rw.SetRevFilter(SkipRevFilter.Create(0)); MarkStart(b); AssertCommit(b, rw.Next()); AssertCommit(a, rw.Next()); NUnit.Framework.Assert.IsNull(rw.Next()); }
/// <summary> /// Executes the /// <code>Log</code> /// command with all the options and parameters /// collected by the setter methods (e.g. /// <see cref="Add(NGit.AnyObjectId)">Add(NGit.AnyObjectId)</see> /// , /// <see cref="Not(NGit.AnyObjectId)">Not(NGit.AnyObjectId)</see> /// , ..) of this class. Each instance of this class /// should only be used for one invocation of the command. Don't call this /// method twice on an instance. /// </summary> /// <returns>an iteration over RevCommits</returns> /// <exception cref="NGit.Api.Errors.NoHeadException">of the references ref cannot be resolved /// </exception> /// <exception cref="NGit.Api.Errors.GitAPIException"></exception> public override Iterable <RevCommit> Call() { CheckCallable(); if (pathFilters.Count > 0) { walk.SetTreeFilter(AndTreeFilter.Create(PathFilterGroup.Create(pathFilters), TreeFilter .ANY_DIFF)); } if (skip > -1 && maxCount > -1) { walk.SetRevFilter(AndRevFilter.Create(SkipRevFilter.Create(skip), MaxCountRevFilter .Create(maxCount))); } else { if (skip > -1) { walk.SetRevFilter(SkipRevFilter.Create(skip)); } else { if (maxCount > -1) { walk.SetRevFilter(MaxCountRevFilter.Create(maxCount)); } } } if (!startSpecified) { try { ObjectId headId = repo.Resolve(Constants.HEAD); if (headId == null) { throw new NoHeadException(JGitText.Get().noHEADExistsAndNoExplicitStartingRevisionWasSpecified ); } Add(headId); } catch (IOException e) { // all exceptions thrown by add() shouldn't occur and represent // severe low-level exception which are therefore wrapped throw new JGitInternalException(JGitText.Get().anExceptionOccurredWhileTryingToAddTheIdOfHEAD , e); } } SetCallable(false); return(walk); }
public virtual void TestSkipRevFilter() { RevCommit a = Commit(); RevCommit b1 = Commit(a); RevCommit b2 = Commit(a); RevCommit c = Commit(b1, b2); RevCommit d = Commit(c); rw.Reset(); rw.SetRevFilter(SkipRevFilter.Create(3)); MarkStart(d); AssertCommit(b1, rw.Next()); AssertCommit(a, rw.Next()); NUnit.Framework.Assert.IsNull(rw.Next()); }
/// <exception cref="System.Exception"></exception> public virtual void TestSkipRevFilterNegative() { SkipRevFilter.Create(-1); }