use of com.intellij.openapi.vcs.changes.committed.ChangesBunch in project intellij-community by JetBrains.
the class CachedProvider method getEarliestRevision.
public long getEarliestRevision() {
if (myEarliestKeepedRevision == -1) {
try {
while (myIterator.hasNext()) {
final ChangesBunch changesBunch = myIterator.next();
if (changesBunch == null) {
break;
}
addToLoaded(changesBunch);
final List<CommittedChangeList> list = myAlreadyReaded.getList();
if (!list.isEmpty()) {
myEarliestKeepedRevision = list.get(0).getNumber();
break;
}
}
} catch (SwitchRevisionsProviderException e) {
// means that committed cache now should be queried instead of internally cached
// just return -1 -> queries will be redirected
myEarliestKeepedRevision = -1;
}
}
return myEarliestKeepedRevision;
}
use of com.intellij.openapi.vcs.changes.committed.ChangesBunch in project intellij-community by JetBrains.
the class CachedProvider method packNext.
private Fragment packNext(final long earliestRevision, final long oldestRevision, final int desirableSize, final boolean includeOldest, final boolean wasConsistentWithPrevious) {
try {
if (myIterator.hasNext()) {
final ChangesBunch changesBunch = myIterator.next();
if (changesBunch == null) {
return null;
}
addToLoaded(changesBunch);
// always consistent since there were exactly 'earliest revision' in previous potion
return createFromLoaded(changesBunch, earliestRevision, oldestRevision, desirableSize, true, includeOldest, wasConsistentWithPrevious);
}
} catch (SwitchRevisionsProviderException e) {
// means that committed cache now should be queried instead of internally cached
// just return null -> queries will be redirected
}
return null;
}
use of com.intellij.openapi.vcs.changes.committed.ChangesBunch in project intellij-community by JetBrains.
the class SvnCachingRevisionsTest method createCommittedIterator.
private Iterator<ChangesBunch> createCommittedIterator(final int bunchSize, final List<Long> revisions) {
final List<ChangesBunch> list = new ArrayList<>();
for (int i = revisions.size() - 1; i >= 0; i -= bunchSize) {
final int j = (bunchSize > i) ? -1 : (i - bunchSize);
final List<CommittedChangeList> subList = new ArrayList<>();
for (int k = i; k > j; --k) {
subList.add(createList(revisions.get(k)));
}
list.add(new ChangesBunch(subList, (j != -1)));
if (j == -1) {
break;
}
}
return list.iterator();
}
use of com.intellij.openapi.vcs.changes.committed.ChangesBunch in project intellij-community by JetBrains.
the class CachedProvider method getEarliestBunchInInterval.
@Nullable
public Fragment getEarliestBunchInInterval(final long earliestRevision, final long oldestRevision, final int desirableSize, final boolean includeYoungest, final boolean includeOldest) throws VcsException {
if ((earliestRevision > getEarliestRevision()) || (earliestRevision == -1)) {
if (myAlreadyReaded == null) {
return null;
}
// just return first
return createFromLoaded(myAlreadyReaded, earliestRevision, oldestRevision, desirableSize, includeYoungest, includeOldest, false);
}
final ChangesBunch loadedBunch = myAlreadyReaded;
final List<CommittedChangeList> list = loadedBunch.getList();
if (list.isEmpty()) {
return null;
}
final long oldest = list.get(list.size() - 1).getNumber();
if ((!includeYoungest) && (oldest == earliestRevision)) {
return packNext(earliestRevision, oldestRevision, desirableSize, includeOldest, loadedBunch.isConsistentWithPrevious());
//} else if ((oldest <= earliestRevision) && (youngest >= earliestRevision)) {
} else if (oldest <= earliestRevision) {
return createFromLoaded(loadedBunch, earliestRevision, oldestRevision, desirableSize, includeYoungest, includeOldest, false);
}
return null;
}
use of com.intellij.openapi.vcs.changes.committed.ChangesBunch in project intellij-community by JetBrains.
the class SvnCachingRevisionsTest method createCommittedIterator.
private Iterator<ChangesBunch> createCommittedIterator(final int bunchSize, final List<Long> revisions) {
final List<ChangesBunch> list = new ArrayList<>();
for (int i = revisions.size() - 1; i >= 0; i -= bunchSize) {
final int j = (bunchSize > i) ? -1 : (i - bunchSize);
final List<CommittedChangeList> subList = new ArrayList<>();
for (int k = i; k > j; --k) {
subList.add(createList(revisions.get(k)));
}
list.add(new ChangesBunch(subList, (j != -1)));
if (j == -1) {
break;
}
}
return list.iterator();
}
Aggregations