use of com.intellij.openapi.vcs.history.VcsRevisionNumber in project intellij-community by JetBrains.
the class SvnDiffProvider method getCurrentRevisions.
@NotNull
@Override
public Map<VirtualFile, VcsRevisionNumber> getCurrentRevisions(@NotNull Iterable<VirtualFile> files) {
Map<VirtualFile, VcsRevisionNumber> result = ContainerUtil.newHashMap();
Map<String, VirtualFile> items = ContainerUtil.newHashMap();
List<File> ioFiles = ContainerUtil.newArrayList();
for (VirtualFile file : files) {
File ioFile = VfsUtilCore.virtualToIoFile(file);
ioFiles.add(ioFile);
items.put(ioFile.getAbsolutePath(), file);
// process in blocks of BATCH_INFO_SIZE size
if (items.size() == BATCH_INFO_SIZE) {
collectRevisionsInBatch(result, items, ioFiles);
items.clear();
ioFiles.clear();
}
}
// process left files
collectRevisionsInBatch(result, items, ioFiles);
return result;
}
use of com.intellij.openapi.vcs.history.VcsRevisionNumber in project intellij-community by JetBrains.
the class GitAnnotationProvider method loadFileHistoryInBackground.
private void loadFileHistoryInBackground(@NotNull GitFileAnnotation fileAnnotation) {
List<VcsFileRevision> fileRevisions = BackgroundTaskUtil.computeInBackgroundAndTryWait(() -> {
try {
VirtualFile file = fileAnnotation.getFile();
FilePath filePath = VcsUtil.getFilePath(file);
VcsRevisionNumber currentRevision = fileAnnotation.getCurrentRevision();
if (file.isInLocalFileSystem() || currentRevision == null) {
return loadFileHistory(filePath);
} else {
return GitHistoryUtils.history(myProject, filePath, null, currentRevision);
}
} catch (VcsException e) {
LOG.error(e);
return null;
}
}, (revisions) -> {
if (revisions == null)
return;
ApplicationManager.getApplication().invokeLater(() -> {
GitFileAnnotation newFileAnnotation = new GitFileAnnotation(fileAnnotation);
newFileAnnotation.setRevisions(revisions);
fileAnnotation.reload(newFileAnnotation);
}, myProject.getDisposed());
}, ProgressWindow.DEFAULT_PROGRESS_DIALOG_POSTPONE_TIME_MILLIS);
if (fileRevisions != null) {
fileAnnotation.setRevisions(fileRevisions);
}
}
use of com.intellij.openapi.vcs.history.VcsRevisionNumber in project intellij-community by JetBrains.
the class GitFileAnnotation method getRevisionsOrderProvider.
@Nullable
@Override
public RevisionsOrderProvider getRevisionsOrderProvider() {
ContainerUtil.KeyOrderedMultiMap<Date, VcsRevisionNumber> dates = new ContainerUtil.KeyOrderedMultiMap<>();
for (int i = 0; i < getLineCount(); i++) {
LineInfo lineInfo = getLineInfo(i);
if (lineInfo == null)
continue;
VcsRevisionNumber number = lineInfo.getRevisionNumber();
Date date = lineInfo.getDate();
dates.putValue(date, number);
}
List<List<VcsRevisionNumber>> orderedRevisions = new ArrayList<>();
NavigableSet<Date> orderedDates = dates.navigableKeySet();
for (Date date : orderedDates.descendingSet()) {
Collection<VcsRevisionNumber> revisionNumbers = dates.get(date);
orderedRevisions.add(new ArrayList<>(revisionNumbers));
}
return () -> orderedRevisions;
}
use of com.intellij.openapi.vcs.history.VcsRevisionNumber in project intellij-community by JetBrains.
the class CopyRevisionNumberAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
List<VcsRevisionNumber> revisions = getRevisionNumbersFromContext(e);
// we want hashes from old to new, e.g. to be able to pass to native client in terminal
revisions = ContainerUtil.reverse(revisions);
CopyPasteManager.getInstance().setContents(new StringSelection(getHashesAsString(revisions)));
}
use of com.intellij.openapi.vcs.history.VcsRevisionNumber in project intellij-community by JetBrains.
the class ShelvedBinaryFile method createChange.
public Change createChange(final Project project) {
ContentRevision before = null;
ContentRevision after = null;
final File baseDir = new File(project.getBaseDir().getPath());
if (BEFORE_PATH != null) {
final FilePath file = VcsUtil.getFilePath(new File(baseDir, BEFORE_PATH), false);
before = new CurrentBinaryContentRevision(file) {
@NotNull
@Override
public VcsRevisionNumber getRevisionNumber() {
return new TextRevisionNumber(VcsBundle.message("local.version.title"));
}
};
}
if (AFTER_PATH != null) {
final FilePath file = VcsUtil.getFilePath(new File(baseDir, AFTER_PATH), false);
after = new ShelvedBinaryContentRevision(file, SHELVED_PATH);
}
return new Change(before, after);
}
Aggregations