use of com.intellij.history.core.changes.ChangeSet in project intellij-community by JetBrains.
the class ChangeList method iterChanges.
// todo synchronization issue: changeset may me modified while being iterated
public synchronized Iterable<ChangeSet> iterChanges() {
return new Iterable<ChangeSet>() {
public Iterator<ChangeSet> iterator() {
return new Iterator<ChangeSet>() {
private final TIntHashSet recursionGuard = new TIntHashSet(1000);
private ChangeSetHolder currentBlock;
private ChangeSet next = fetchNext();
public boolean hasNext() {
return next != null;
}
public ChangeSet next() {
ChangeSet result = next;
next = fetchNext();
return result;
}
private ChangeSet fetchNext() {
if (currentBlock == null) {
synchronized (ChangeList.this) {
if (myCurrentChangeSet != null) {
currentBlock = new ChangeSetHolder(-1, myCurrentChangeSet);
} else {
currentBlock = myStorage.readPrevious(-1, recursionGuard);
}
}
} else {
synchronized (ChangeList.this) {
currentBlock = myStorage.readPrevious(currentBlock.id, recursionGuard);
}
}
if (currentBlock == null)
return null;
return currentBlock.changeSet;
}
public void remove() {
throw new UnsupportedOperationException();
}
};
}
};
}
use of com.intellij.history.core.changes.ChangeSet in project intellij-community by JetBrains.
the class ChangeSetsProcessor method process.
protected void process() {
Pair<String, List<ChangeSet>> pathAndChanges = collectChanges();
List<ChangeSet> changes = pathAndChanges.second;
if (changes.isEmpty()) {
nothingToVisit();
return;
}
for (ChangeSet c : changes) {
visit(c);
}
}
use of com.intellij.history.core.changes.ChangeSet in project intellij-community by JetBrains.
the class RevisionsTest method testAfterRevisionForRootEntry.
@Test
public void testAfterRevisionForRootEntry() {
RootEntry root = new RootEntry();
LocalHistoryFacade facade = new InMemoryLocalHistoryFacade();
ChangeSet cs = addChangeSet(facade, createFile(root, "f1"));
addChangeSet(facade, createFile(root, "f2"));
Revision r = new ChangeRevision(facade, root, "", cs, false);
RootEntry e = (RootEntry) r.findEntry();
assertEquals(e.getClass(), RootEntry.class);
assertNotNull(e.findEntry("f1"));
assertNull(e.findEntry("f2"));
}
use of com.intellij.history.core.changes.ChangeSet in project intellij-community by JetBrains.
the class ByteContentRetriever method collectChanges.
@Override
protected Pair<String, List<ChangeSet>> collectChanges() {
final List<ChangeSet> result = new ArrayList<>();
myVcs.accept(new ChangeVisitor() {
@Override
public void begin(ChangeSet c) throws StopVisitingException {
if (c.affectsPath(myPath))
result.add(c);
}
});
return Pair.create(myPath, result);
}
use of com.intellij.history.core.changes.ChangeSet in project intellij-community by JetBrains.
the class PurgingTest method assertRemainedChangesTimestamps.
private void assertRemainedChangesTimestamps(long... tt) {
assertEquals(tt.length, getVcs().getChangeListInTests().getChangesInTests().size());
for (int i = 0; i < tt.length; i++) {
long t = tt[i];
ChangeSet c = getVcs().getChangeListInTests().getChangesInTests().get(i);
assertEquals(t, c.getTimestamp());
}
}
Aggregations