/// <exception cref="NGit.Errors.MissingObjectException"></exception> /// <exception cref="NGit.Errors.IncorrectObjectTypeException"></exception> /// <exception cref="System.IO.IOException"></exception> internal override RevCommit Next() { for (; ;) { RevCommit c = pending.Next(); if (c == null) { walker.reader.WalkAdviceEnd(); return(null); } foreach (RevCommit p in c.parents) { if ((p.flags & IN_PENDING) != 0) { continue; } if ((p.flags & PARSED) == 0) { p.ParseHeaders(walker); } p.flags |= IN_PENDING; pending.Add(p); } int carry = c.flags & branchMask; bool mb = carry == branchMask; if (mb) { // If we are a merge base make sure our ancestors are // also flagged as being popped, so that they do not // generate to the caller. // carry |= MERGE_BASE; } CarryOntoHistory(c, carry); if ((c.flags & MERGE_BASE) != 0) { // This commit is an ancestor of a merge base we already // popped back to the caller. If everyone in pending is // that way we are done traversing; if not we just need // to move to the next available commit and try again. // if (pending.EverbodyHasFlag(MERGE_BASE)) { return(null); } continue; } c.flags |= POPPED; if (mb) { c.flags |= MERGE_BASE; return(c); } } }
/// <exception cref="NGit.Errors.MissingObjectException"></exception> /// <exception cref="NGit.Errors.IncorrectObjectTypeException"></exception> /// <exception cref="System.IO.IOException"></exception> internal override RevCommit Next() { try { for (; ;) { RevCommit c = pending.Next(); if (c == null) { walker.reader.WalkAdviceEnd(); return(null); } bool produce; if ((c.flags & UNINTERESTING) != 0) { produce = false; } else { if (filter.RequiresCommitBody()) { c.ParseBody(walker); } produce = filter.Include(walker, c); } foreach (RevCommit p in c.parents) { if ((p.flags & SEEN) != 0) { continue; } if ((p.flags & PARSED) == 0) { p.ParseHeaders(walker); } p.flags |= SEEN; pending.Add(p); } walker.CarryFlagsImpl(c); if ((c.flags & UNINTERESTING) != 0) { if (pending.EverbodyHasFlag(UNINTERESTING)) { RevCommit n = pending.Peek(); if (n != null && n.commitTime >= last.commitTime) { // This is too close to call. The next commit we // would pop is dated after the last one produced. // We have to keep going to ensure that we carry // flags as much as necessary. // overScan = OVER_SCAN; } else { if (--overScan == 0) { throw StopWalkException.INSTANCE; } } } else { overScan = OVER_SCAN; } if (canDispose) { c.DisposeBody(); } continue; } if (produce) { return(last = c); } else { if (canDispose) { c.DisposeBody(); } } } } catch (StopWalkException) { walker.reader.WalkAdviceEnd(); pending.Clear(); return(null); } }