public void testCloneFIFO() { RevCommit a = parseBody(Commit()); RevCommit b = parseBody(Commit(200, a)); RevCommit c = parseBody(Commit(200, b)); var src = new FIFORevQueue(); src.add(a); src.add(b); src.add(c); q = new DateRevQueue(src); Assert.IsFalse(q.everbodyHasFlag(GitSharp.Core.RevWalk.RevWalk.UNINTERESTING)); Assert.IsFalse(q.anybodyHasFlag(GitSharp.Core.RevWalk.RevWalk.UNINTERESTING)); AssertCommit(c, q.peek()); AssertCommit(c, q.peek()); AssertCommit(c, q.next()); AssertCommit(b, q.next()); AssertCommit(a, q.next()); Assert.IsNull(q.next()); }
/** * Create a new sorter and completely spin the generator. * <p> * When the constructor completes the supplied generator will have no * commits remaining, as all of the commits will be held inside of this * generator's internal buffer. * * @param s * generator to pull all commits out of, and into this buffer. * @throws MissingObjectException * @throws IncorrectObjectTypeException * @ */ public TopoSortGenerator(Generator s) { pending = new FIFORevQueue(); _outputType = s.outputType() | SORT_TOPO; s.shareFreeList(pending); for (; ; ) { RevCommit c = s.next(); if (c == null) break; foreach (RevCommit p in c.parents) p.inDegree++; pending.add(c); } }
/// <summary> /// Create a new sorter and completely spin the generator. /// <para /> /// When the constructor completes the supplied generator will have no /// commits remaining, as all of the commits will be held inside of this /// generator's internal buffer. /// </summary> /// <param name="s"> /// Generator to pull all commits out of, and into this buffer. /// </param> public TopoSortGenerator(Generator s) { _pending = new FIFORevQueue(); _outputType = s.OutputType | GeneratorOutputType.SortTopo; s.shareFreeList(_pending); while (true) { RevCommit c = s.next(); if (c == null) break; foreach (RevCommit p in c.Parents) { p.InDegree++; } _pending.add(c); } }
/// <summary> /// Create a new sorter and completely spin the generator. /// <para /> /// When the constructor completes the supplied generator will have no /// commits remaining, as all of the commits will be held inside of this /// generator's internal buffer. /// </summary> /// <param name="s"> /// Generator to pull all commits out of, and into this buffer. /// </param> public TopoSortGenerator(Generator s) { _pending = new FIFORevQueue(); _outputType = s.OutputType | GeneratorOutputType.SortTopo; s.shareFreeList(_pending); while (true) { RevCommit c = s.next(); if (c == null) { break; } foreach (RevCommit p in c.Parents) { p.InDegree++; } _pending.add(c); } }
public override RevCommit next() { while (_size < PendingGenerator.OVER_SCAN) { RevCommit c = _pending.next(); if (c == null) { break; } _delay.add(c); _size++; } RevCommit cc = _delay.next(); if (cc == null) { return(null); } _size--; return(cc); }
public override RevCommit next() { RevCommit c = _source.next(); if (c != null) { foreach (RevCommit p in c.Parents) { if ((p.Flags & RevWalk.UNINTERESTING) != 0) { _held.add(p); } } return c; } var boundary = new FIFORevQueue(); boundary.shareFreeList(_held); while (true) { c = _held.next(); if (c == null) break; if ((c.Flags & Duplicate) != 0) continue; if ((c.Flags & Parsed) == 0) { c.parseHeaders(_walk); } c.Flags |= Duplicate; boundary.add(c); } boundary.removeFlag(Duplicate); _parent._generator = boundary; return boundary.next(); }
public override RevCommit next() { RevCommit c = source.next(); if (c != null) { foreach (RevCommit p in c.parents) if ((p.flags & UNINTERESTING) != 0) held.add(p); return c; } FIFORevQueue boundary = new FIFORevQueue(); boundary.shareFreeList(held); for (; ; ) { c = held.next(); if (c == null) break; if ((c.flags & DUPLICATE) != 0) continue; if ((c.flags & PARSED) == 0) c.parse(walk); c.flags |= DUPLICATE; boundary.add(c); } boundary.removeFlag(DUPLICATE); parent.g = boundary; return boundary.next(); }