Example #1
0
 public PendingGenerator(RevWalk w, DateRevQueue p, RevFilter f, GeneratorOutputType outputType)
 {
     _walker     = w;
     _pending    = p;
     _filter     = f;
     _outputType = outputType;
     CanDispose  = true;
 }
        /// <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 PendingGenerator(RevWalk w, DateRevQueue p, RevFilter f, GeneratorOutputType outputType)
 {
     _walker = w;
     _pending = p;
     _filter = f;
     _outputType = outputType;
     CanDispose = true;
 }
Example #5
0
        /// <summary>
		/// Create an empty revision queue.
        /// </summary>
    	protected BlockRevQueue(GeneratorOutputType outputType)
			: base(outputType)
        {
            _free = new BlockFreeList();
        }
        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());
        }
Example #7
0
 protected AbstractRevQueue(GeneratorOutputType outputType)
 {
     _outputType = outputType;
 }
 /// <summary>
 /// Create an empty revision queue.
 /// </summary>
 protected BlockRevQueue(GeneratorOutputType outputType)
     : base(outputType)
 {
     _free = new BlockFreeList();
 }
Example #9
0
 protected AbstractRevQueue(GeneratorOutputType outputType)
 {
     _outputType = outputType;
 }