/// <summary>
/// Ensure this list contains at least a specified number of commits.
///
/// The revision walker specified by <see cref="Source(RevWalk)"/> is pumped until
/// the given number of commits are contained in this list. If there are
/// fewer total commits available from the walk then the method will return
/// early. Callers can test the size of the list by <see cref="RevObjectList{T}.Size"/> to
/// determine if the high water mark specified was met.
/// </summary>
/// <param name="highMark">
/// Number of commits the caller wants this list to contain when
/// the fill operation is complete.
/// </param>
public void fillTo(int highMark)
{
if (_walker == null || Size > highMark)
{
return;
}
Generator p = _walker.Pending;
T c = (T)p.next();
if (c == null)
{
_walker.Pending = EndGenerator.Instance;
_walker = null;
return;
}
enter(Size, c);
add(c);
p = _walker.Pending;
while (Size <= highMark)
{
int index = Size;
Block s = Contents;
while (index >> s.Shift >= BLOCK_SIZE)
{
s = new Block(s.Shift + BLOCK_SHIFT);
s.Contents[0] = Contents;
Contents = s;
}
while (s.Shift > 0)
{
int i = index >> s.Shift;
index -= i << s.Shift;
if (s.Contents[i] == null)
{
s.Contents[i] = new Block(s.Shift - BLOCK_SHIFT);
}
s = (Block)s.Contents[i];
}
object[] dst = s.Contents;
while (Size <= highMark && index < BLOCK_SIZE)
{
c = (T)p.next();
if (c == null)
{
_walker.Pending = EndGenerator.Instance;
_walker = null;
return;
}
enter(Size++, c);
dst[index++] = c;
}
}
}