本文整理汇总了Java中com.intellij.history.core.changes.ChangeSet类的典型用法代码示例。如果您正苦于以下问题:Java ChangeSet类的具体用法?Java ChangeSet怎么用?Java ChangeSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChangeSet类属于com.intellij.history.core.changes包,在下文中一共展示了ChangeSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ChangeRevision
import com.intellij.history.core.changes.ChangeSet; //导入依赖的package包/类
public ChangeRevision(LocalHistoryFacade facade, RootEntry r, @NotNull String entryPath, ChangeSet changeSet, boolean before) {
myFacade = facade;
myRoot = r;
myEntryPath = entryPath;
myBefore = before;
myTimestamp = changeSet.getTimestamp();
myChangeToRevert = before ? changeSet.getFirstChange() : changeSet.getLastChange();
myId = changeSet.getId();
myLabel = changeSet.getLabel();
myLabelColor = changeSet.getLabelColor();
myName = changeSet.getName();
List<String> allAffectedFiles = changeSet.getAffectedPaths();
List<String> someAffectedFiles = new SmartList<String>();
for (String each : allAffectedFiles.subList(0, Math.min(3, allAffectedFiles.size()))) {
someAffectedFiles.add(Paths.getNameOf(each));
}
myAffectedFiles = Pair.create(someAffectedFiles, allAffectedFiles.size());
}
示例2: writeNextSet
import com.intellij.history.core.changes.ChangeSet; //导入依赖的package包/类
public synchronized void writeNextSet(ChangeSet changeSet) {
if (isCompletelyBroken) return;
try {
AbstractStorage.StorageDataOutput out = myStorage.writeStream(myStorage.createNextRecord(), true);
try {
changeSet.write(out);
}
finally {
out.close();
}
myStorage.setLastId(myLastId);
myStorage.force();
}
catch (IOException e) {
handleError(e, null);
}
}
示例3: purge
import com.intellij.history.core.changes.ChangeSet; //导入依赖的package包/类
public synchronized void purge(long period, int intervalBetweenActivities, Consumer<ChangeSet> processor) {
if (isCompletelyBroken) return;
TIntHashSet recursionGuard = new TIntHashSet(1000);
try {
int firstObsoleteId = findFirstObsoleteBlock(period, intervalBetweenActivities, recursionGuard);
if (firstObsoleteId == 0) return;
int eachBlockId = firstObsoleteId;
while (eachBlockId != 0) {
processor.consume(doReadBlock(eachBlockId).changeSet);
eachBlockId = doReadPrevSafely(eachBlockId, recursionGuard);
}
myStorage.deleteRecordsUpTo(firstObsoleteId);
myStorage.force();
}
catch (IOException e) {
handleError(e, null);
}
}
示例4: testStop
import com.intellij.history.core.changes.ChangeSet; //导入依赖的package包/类
@Test
public void testStop() throws Exception {
createFile("f.txt");
createFile("dir");
TestVisitor visitor = new TestVisitor() {
int count = 0;
@Override
public void begin(ChangeSet c) throws ChangeVisitor.StopVisitingException {
if (++count == 2) stop();
super.begin(c);
}
};
assertVisitorLog("begin create end finished ", visitor);
}
示例5: ChangeRevision
import com.intellij.history.core.changes.ChangeSet; //导入依赖的package包/类
public ChangeRevision(LocalHistoryFacade facade, RootEntry r, @Nonnull String entryPath, ChangeSet changeSet, boolean before) {
myFacade = facade;
myRoot = r;
myEntryPath = entryPath;
myBefore = before;
myTimestamp = changeSet.getTimestamp();
myChangeToRevert = before ? changeSet.getFirstChange() : changeSet.getLastChange();
myId = changeSet.getId();
myLabel = changeSet.getLabel();
myLabelColor = changeSet.getLabelColor();
myName = changeSet.getName();
List<String> allAffectedFiles = changeSet.getAffectedPaths();
List<String> someAffectedFiles = new SmartList<>();
for (String each : allAffectedFiles.subList(0, Math.min(3, allAffectedFiles.size()))) {
someAffectedFiles.add(Paths.getNameOf(each));
}
myAffectedFiles = Pair.create(someAffectedFiles, allAffectedFiles.size());
}
示例6: getChangesInTests
import com.intellij.history.core.changes.ChangeSet; //导入依赖的package包/类
@TestOnly
public List<ChangeSet> getChangesInTests() {
List<ChangeSet> result = new ArrayList<ChangeSet>();
for (ChangeSet each : iterChanges()) {
result.add(each);
}
return result;
}
示例7: accept
import com.intellij.history.core.changes.ChangeSet; //导入依赖的package包/类
public void accept(ChangeVisitor v) {
try {
for (ChangeSet change : iterChanges()) {
change.accept(v);
}
}
catch (ChangeVisitor.StopVisitingException e) {
}
v.finished();
}
示例8: purgeObsolete
import com.intellij.history.core.changes.ChangeSet; //导入依赖的package包/类
public synchronized void purgeObsolete(long period) {
myStorage.purge(period, myIntervalBetweenActivities, new Consumer<ChangeSet>() {
public void consume(ChangeSet changeSet) {
for (Content each : changeSet.getContentsToPurge()) {
each.release();
}
}
});
}
示例9: process
import com.intellij.history.core.changes.ChangeSet; //导入依赖的package包/类
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);
}
}
示例10: doReadBlock
import com.intellij.history.core.changes.ChangeSet; //导入依赖的package包/类
@NotNull
private ChangeSetHolder doReadBlock(int id) throws IOException {
DataInputStream in = myStorage.readStream(id);
try {
return new ChangeSetHolder(id, new ChangeSet(in));
}
finally {
in.close();
}
}
示例11: collectChanges
import com.intellij.history.core.changes.ChangeSet; //导入依赖的package包/类
@Override
protected Pair<String, List<ChangeSet>> collectChanges() {
final List<ChangeSet> result = new ArrayList<ChangeSet>();
myVcs.accept(new ChangeVisitor() {
@Override
public void begin(ChangeSet c) throws StopVisitingException {
if (c.affectsPath(myPath)) result.add(c);
}
});
return Pair.create(myPath, result);
}
示例12: recordContentAndTimestamp
import com.intellij.history.core.changes.ChangeSet; //导入依赖的package包/类
private void recordContentAndTimestamp(ChangeSet c) {
// todo what if the path is being changed during changes?
for (Change each : c.getChanges()) {
if (!(each instanceof ContentChange)) continue;
ContentChange cc = (ContentChange)each;
if (!cc.affectsPath(myPath)) continue;
myCurrentFileTimestamp = cc.getOldTimestamp();
myCurrentFileContent = cc.getOldContent();
}
}
示例13: collectChanges
import com.intellij.history.core.changes.ChangeSet; //导入依赖的package包/类
@Override
protected Pair<String, List<ChangeSet>> collectChanges() {
// todo optimize to not collect all change sets + do not process changes twice
ChangeCollectingVisitor v = new ChangeCollectingVisitor(myPath, myProjectId, myPattern);
myFacade.accept(v);
return Pair.create(v.getPath(), v.getChanges());
}
示例14: assertRemainedChangesTimestamps
import com.intellij.history.core.changes.ChangeSet; //导入依赖的package包/类
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());
}
}
示例15: testAfterRevisionForRootEntry
import com.intellij.history.core.changes.ChangeSet; //导入依赖的package包/类
@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"));
}