1
2
3
4
5
6
7
8
9
10
11
12 package org.eclipse.jgit.revwalk;
13
14 import java.io.IOException;
15
16 import org.eclipse.jgit.errors.IncorrectObjectTypeException;
17 import org.eclipse.jgit.errors.MissingObjectException;
18
19
20
21
22
23
24
25
26
27
28
29
30 final class DelayRevQueue extends Generator {
31 private static final int OVER_SCAN = PendingGenerator.OVER_SCAN;
32
33 private final Generator pending;
34
35 private final FIFORevQueue delay;
36
37 private int size;
38
39 DelayRevQueue(Generator g) {
40 super(g.firstParent);
41 pending = g;
42 delay = new FIFORevQueue();
43 }
44
45 @Override
46 int outputType() {
47 return pending.outputType();
48 }
49
50 @Override
51 RevCommit next() throws MissingObjectException,
52 IncorrectObjectTypeException, IOException {
53 while (size < OVER_SCAN) {
54 final RevCommit c = pending.next();
55 if (c == null)
56 break;
57 delay.add(c);
58 size++;
59 }
60
61 final RevCommit c = delay.next();
62 if (c == null)
63 return null;
64 size--;
65 return c;
66 }
67 }