Example #1
0
 /// <exception cref="NGit.Errors.MissingObjectException"></exception>
 /// <exception cref="NGit.Errors.IncorrectObjectTypeException"></exception>
 /// <exception cref="System.IO.IOException"></exception>
 internal override RevCommit Next()
 {
     // Perform a breadth-first descent into the commit graph,
     // marking depths as we go.  This means that if a commit is
     // reachable by more than one route, we are guaranteed to
     // arrive by the shortest route first.
     for (; ;)
     {
         var c = (NGit.Revwalk.Depthwalk.Commit)pending.Next();
         if (c == null)
         {
             return(null);
         }
         if ((c.flags & RevWalk.PARSED) == 0)
         {
             c.ParseHeaders(walk);
         }
         int newDepth = c.depth + 1;
         foreach (RevCommit p in c.parents)
         {
             var dp = (NGit.Revwalk.Depthwalk.Commit)p;
             // If no depth has been assigned to this commit, assign
             // it now.  Since we arrive by the shortest route first,
             // this depth is guaranteed to be the smallest value that
             // any path could produce.
             if (dp.depth == -1)
             {
                 dp.depth = newDepth;
                 // If the parent is not too deep, add it to the queue
                 // so that we can produce it later
                 if (newDepth <= depth)
                 {
                     pending.Add(p);
                 }
             }
             // If the current commit has become unshallowed, everything
             // below us is new to the client.  Mark its parent as
             // re-interesting, and carry that flag downward to all
             // of its ancestors.
             if (c.Has(UNSHALLOW) || c.Has(REINTERESTING))
             {
                 p.Add(REINTERESTING);
                 p.flags &= ~RevWalk.UNINTERESTING;
             }
         }
         // Produce all commits less than the depth cutoff
         bool produce = c.depth <= depth;
         // Unshallow commits are uninteresting, but still need to be sent
         // up to the PackWriter so that it will exclude objects correctly.
         // All other uninteresting commits should be omitted.
         if ((c.flags & RevWalk.UNINTERESTING) != 0 && !c.Has(UNSHALLOW))
         {
             produce = false;
         }
         if (produce)
         {
             return(c);
         }
     }
 }
Example #2
0
 /// <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)
         {
             return(null);
         }
         if (c.inDegree > 0)
         {
             // At least one of our children is missing. We delay
             // production until all of our children are output.
             //
             c.flags |= TOPO_DELAY;
             continue;
         }
         // All of our children have already produced,
         // so it is OK for us to produce now as well.
         //
         foreach (RevCommit p in c.parents)
         {
             if (--p.inDegree == 0 && (p.flags & TOPO_DELAY) != 0)
             {
                 // This parent tried to come before us, but we are
                 // his last child. unpop the parent so it goes right
                 // behind this child.
                 //
                 p.flags &= ~TOPO_DELAY;
                 pending.Unpop(p);
             }
         }
         return(c);
     }
 }
Example #3
0
        /// <exception cref="NGit.Errors.MissingObjectException"></exception>
        /// <exception cref="NGit.Errors.IncorrectObjectTypeException"></exception>
        /// <exception cref="System.IO.IOException"></exception>
        internal override RevCommit Next()
        {
            while (size < OVER_SCAN)
            {
                RevCommit c = pending.Next();
                if (c == null)
                {
                    break;
                }
                delay.Add(c);
                size++;
            }
            RevCommit c_1 = delay.Next();

            if (c_1 == null)
            {
                return(null);
            }
            size--;
            return(c_1);
        }
Example #4
0
            /// <exception cref="NGit.Errors.MissingObjectException"></exception>
            /// <exception cref="NGit.Errors.IncorrectObjectTypeException"></exception>
            /// <exception cref="System.IO.IOException"></exception>
            internal override RevCommit Next()
            {
                RevCommit c = this.source.Next();

                if (c != null)
                {
                    foreach (RevCommit p in c.parents)
                    {
                        if ((p.flags & BoundaryGenerator.UNINTERESTING) != 0)
                        {
                            this.held.Add(p);
                        }
                    }
                    return(c);
                }
                FIFORevQueue boundary = new FIFORevQueue();

                boundary.ShareFreeList(this.held);
                for (; ;)
                {
                    c = this.held.Next();
                    if (c == null)
                    {
                        break;
                    }
                    if ((c.flags & BoundaryGenerator.InitialGenerator.DUPLICATE) != 0)
                    {
                        continue;
                    }
                    if ((c.flags & BoundaryGenerator.InitialGenerator.PARSED) == 0)
                    {
                        c.ParseHeaders(this.walk);
                    }
                    c.flags |= BoundaryGenerator.InitialGenerator.DUPLICATE;
                    boundary.Add(c);
                }
                boundary.RemoveFlag(BoundaryGenerator.InitialGenerator.DUPLICATE);
                this._enclosing.g = boundary;
                return(boundary.Next());
            }
Example #5
0
			/// <exception cref="NGit.Errors.MissingObjectException"></exception>
			/// <exception cref="NGit.Errors.IncorrectObjectTypeException"></exception>
			/// <exception cref="System.IO.IOException"></exception>
			internal override RevCommit Next()
			{
				RevCommit c = this.source.Next();
				if (c != null)
				{
					foreach (RevCommit p in c.parents)
					{
						if ((p.flags & BoundaryGenerator.UNINTERESTING) != 0)
						{
							this.held.Add(p);
						}
					}
					return c;
				}
				FIFORevQueue boundary = new FIFORevQueue();
				boundary.ShareFreeList(this.held);
				for (; ; )
				{
					c = this.held.Next();
					if (c == null)
					{
						break;
					}
					if ((c.flags & BoundaryGenerator.InitialGenerator.DUPLICATE) != 0)
					{
						continue;
					}
					if ((c.flags & BoundaryGenerator.InitialGenerator.PARSED) == 0)
					{
						c.ParseHeaders(this.walk);
					}
					c.flags |= BoundaryGenerator.InitialGenerator.DUPLICATE;
					boundary.Add(c);
				}
				boundary.RemoveFlag(BoundaryGenerator.InitialGenerator.DUPLICATE);
				this._enclosing.g = boundary;
				return boundary.Next();
			}