public InitialGenerator(RevWalk w, Generator s, BoundaryGenerator parent) // [henon] parent needed because we cannot access outer instances in C# { _walk = w; _held = new FIFORevQueue(); _source = s; _source.shareFreeList(_held); _parent = parent; }
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() { RevWalk w = _walker; RevFilter rf = w.getRevFilter(); TreeFilter tf = w.getTreeFilter(); AbstractRevQueue q = _walker.Queue; if (rf == RevFilter.MERGE_BASE) { // Computing for merge bases is a special case and does not // use the bulk of the generator pipeline. // if (tf != TreeFilter.ALL) { throw new InvalidOperationException("Cannot combine TreeFilter " + tf + " with RevFilter " + rf + "."); } var mbg = new MergeBaseGenerator(w); _walker.Pending = mbg; _walker.Queue = AbstractRevQueue.EmptyQueue; mbg.init(q); return mbg.next(); } bool uninteresting = q.anybodyHasFlag(RevWalk.UNINTERESTING); bool boundary = _walker.hasRevSort(RevSort.BOUNDARY); if (!boundary && _walker is ObjectWalk) { // The object walker requires boundary support to color // trees and blobs at the boundary uninteresting so it // does not produce those in the result. // boundary = true; } if (boundary && !uninteresting) { // If we were not fed uninteresting commits we will never // construct a boundary. There is no reason to include the // extra overhead associated with that in our pipeline. // boundary = false; } DateRevQueue pending; GeneratorOutputType pendingOutputType = 0; if (q is DateRevQueue) { pending = (DateRevQueue)q; } else { pending = new DateRevQueue(q); } if (tf != TreeFilter.ALL) { rf = AndRevFilter.create(rf, new RewriteTreeFilter(w, tf)); pendingOutputType |= GeneratorOutputType.HasRewrite | GeneratorOutputType.NeedsRewrite; } _walker.Queue = q; Generator g = new PendingGenerator(w, pending, rf, pendingOutputType); if (boundary) { // Because the boundary generator may produce uninteresting // commits we cannot allow the pending generator to dispose // of them early. // ((PendingGenerator)g).CanDispose = false; } if ((g.OutputType & GeneratorOutputType.NeedsRewrite) != GeneratorOutputType.None) { // Correction for an upstream NEEDS_REWRITE is to buffer // fully and then Apply a rewrite generator that can // pull through the rewrite chain and produce a dense // output graph. // g = new FIFORevQueue(g); g = new RewriteGenerator(g); } if (_walker.hasRevSort(RevSort.TOPO) && (g.OutputType & GeneratorOutputType.SortTopo) == 0) { g = new TopoSortGenerator(g); } if (_walker.hasRevSort(RevSort.REVERSE)) { g = new LIFORevQueue(g); } if (boundary) { g = new BoundaryGenerator(w, g); } else if (uninteresting) { // Try to protect ourselves from uninteresting commits producing // due to clock skew in the commit time stamps. Delay such that // we have a chance at coloring enough of the graph correctly, // and then strip any UNINTERESTING nodes that may have leaked // through early. // if (pending.peek() != null) { g = new DelayRevQueue(g); } g = new FixUninterestingGenerator(g); } w.Pending = g; return g.next(); }
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() { RevWalk w = _walker; RevFilter rf = w.getRevFilter(); TreeFilter tf = w.getTreeFilter(); AbstractRevQueue q = _walker.Queue; if (rf == RevFilter.MERGE_BASE) { // Computing for merge bases is a special case and does not // use the bulk of the generator pipeline. // if (tf != TreeFilter.ALL) { throw new InvalidOperationException("Cannot combine TreeFilter " + tf + " with RevFilter " + rf + "."); } var mbg = new MergeBaseGenerator(w); _walker.Pending = mbg; _walker.Queue = AbstractRevQueue.EmptyQueue; mbg.init(q); return(mbg.next()); } bool uninteresting = q.anybodyHasFlag(RevWalk.UNINTERESTING); bool boundary = _walker.hasRevSort(RevSort.BOUNDARY); if (!boundary && _walker is ObjectWalk) { // The object walker requires boundary support to color // trees and blobs at the boundary uninteresting so it // does not produce those in the result. // boundary = true; } if (boundary && !uninteresting) { // If we were not fed uninteresting commits we will never // construct a boundary. There is no reason to include the // extra overhead associated with that in our pipeline. // boundary = false; } DateRevQueue pending = (q as DateRevQueue); GeneratorOutputType pendingOutputType = 0; if (pending == null) { pending = new DateRevQueue(q); } if (tf != TreeFilter.ALL) { rf = AndRevFilter.create(rf, new RewriteTreeFilter(w, tf)); pendingOutputType |= GeneratorOutputType.HasRewrite | GeneratorOutputType.NeedsRewrite; } _walker.Queue = q; Generator g = new PendingGenerator(w, pending, rf, pendingOutputType); if (boundary) { // Because the boundary generator may produce uninteresting // commits we cannot allow the pending generator to dispose // of them early. // ((PendingGenerator)g).CanDispose = false; } if ((g.OutputType & GeneratorOutputType.NeedsRewrite) != GeneratorOutputType.None) { // Correction for an upstream NEEDS_REWRITE is to buffer // fully and then Apply a rewrite generator that can // pull through the rewrite chain and produce a dense // output graph. // g = new FIFORevQueue(g); g = new RewriteGenerator(g); } if (_walker.hasRevSort(RevSort.TOPO) && (g.OutputType & GeneratorOutputType.SortTopo) == 0) { g = new TopoSortGenerator(g); } if (_walker.hasRevSort(RevSort.REVERSE)) { g = new LIFORevQueue(g); } if (boundary) { g = new BoundaryGenerator(w, g); } else if (uninteresting) { // Try to protect ourselves from uninteresting commits producing // due to clock skew in the commit time stamps. Delay such that // we have a chance at coloring enough of the graph correctly, // and then strip any UNINTERESTING nodes that may have leaked // through early. // if (pending.peek() != null) { g = new DelayRevQueue(g); } g = new FixUninterestingGenerator(g); } w.Pending = g; return(g.next()); }
// [henon] parent needed because we cannot access outer instances in C# public InitialGenerator(RevWalk w, Generator s, BoundaryGenerator parent) { _walk = w; _held = new FIFORevQueue(); _source = s; _source.shareFreeList(_held); _parent = parent; }