public WalkFetchConnection(IWalkTransport t, WalkRemoteObjectDatabase w)
        {
            _idBuffer = new MutableObjectId();
            _objectDigest = Constants.newMessageDigest();

            var wt = (Transport)t;
            _local = wt.Local;
            _objCheck = wt.CheckFetchedObjects ? new ObjectChecker() : null;

            _remotes = new List<WalkRemoteObjectDatabase> { w };

            _unfetchedPacks = new LinkedList<RemotePack>();
            _packsConsidered = new List<string>();

            _noPacksYet = new LinkedList<WalkRemoteObjectDatabase>();
            _noPacksYet.AddFirst(w);

            _noAlternatesYet = new LinkedList<WalkRemoteObjectDatabase>();
            _noAlternatesYet.AddFirst(w);

            _fetchErrors = new Dictionary<ObjectId, List<Exception>>();
            _packLocks = new List<PackLock>(4);

            _revWalk = new RevWalk.RevWalk(_local);
            _treeWalk = new TreeWalk.TreeWalk(_local);

            COMPLETE = _revWalk.newFlag("COMPLETE");
            IN_WORK_QUEUE = _revWalk.newFlag("IN_WORK_QUEUE");
            LOCALLY_SEEN = _revWalk.newFlag("LOCALLY_SEEN");

            _localCommitQueue = new DateRevQueue();
            _workQueue = new LinkedList<ObjectId>();
        }
 public PendingGenerator(RevWalk w, DateRevQueue p, RevFilter f, GeneratorOutputType outputType)
 {
     _walker = w;
     _pending = p;
     _filter = f;
     _outputType = outputType;
     CanDispose = true;
 }
        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();
        }
Exemple #4
0
 public PendingGenerator(RevWalk w, DateRevQueue p,
     RevFilter f, int @out)
 {
     walker = w;
     pending = p;
     filter = f;
     output = @out;
     canDispose = true;
 }
 public MergeBaseGenerator(RevWalk w)
 {
     walker = w;
     pending = new DateRevQueue();
 }