use of com.intellij.openapi.vcs.history.VcsRevisionNumber in project intellij-community by JetBrains.
the class GitAnnotationProvider method annotate.
@NotNull
public FileAnnotation annotate(@NotNull final VirtualFile file, @Nullable final VcsFileRevision revision) throws VcsException {
if (file.isDirectory()) {
throw new VcsException("Cannot annotate a directory");
}
final FilePath currentFilePath = VcsUtil.getFilePath(file.getPath());
final FilePath realFilePath;
if (revision == null) {
realFilePath = GitHistoryUtils.getLastCommitName(myProject, currentFilePath);
} else {
realFilePath = ((VcsFileRevisionEx) revision).getPath();
}
VcsRevisionNumber revisionNumber = revision != null ? revision.getRevisionNumber() : null;
return annotate(realFilePath, revisionNumber, file);
}
use of com.intellij.openapi.vcs.history.VcsRevisionNumber in project intellij-community by JetBrains.
the class GitShowCommitInLogAction method actionPerformed.
@Override
public void actionPerformed(@NotNull AnActionEvent event) {
final Project project = event.getRequiredData(CommonDataKeys.PROJECT);
final VcsRevisionNumber revision = getRevisionNumber(event);
if (revision == null) {
return;
}
boolean logReady = findLog(project) != null;
final ToolWindow window = ToolWindowManager.getInstance(project).getToolWindow(ChangesViewContentManager.TOOLWINDOW_ID);
ContentManager cm = window.getContentManager();
Content[] contents = cm.getContents();
for (Content content : contents) {
if (VcsLogContentProvider.TAB_NAME.equals(content.getDisplayName())) {
cm.setSelectedContent(content);
break;
}
}
final VcsLog log = findLog(project);
if (log == null) {
showLogNotReadyMessage(project);
return;
}
Runnable selectAndOpenLog = new Runnable() {
@Override
public void run() {
Runnable selectCommit = new Runnable() {
@Override
public void run() {
jumpToRevisionUnderProgress(project, log, revision);
}
};
if (!window.isVisible()) {
window.activate(selectCommit, true);
} else {
selectCommit.run();
}
}
};
if (logReady) {
selectAndOpenLog.run();
return;
}
VcsProjectLog projectLog = VcsProjectLog.getInstance(project);
if (projectLog == null) {
showLogNotReadyMessage(project);
return;
}
VcsLogUiImpl logUi = projectLog.getMainLogUi();
if (logUi == null) {
showLogNotReadyMessage(project);
return;
}
logUi.invokeOnChange(selectAndOpenLog);
}
use of com.intellij.openapi.vcs.history.VcsRevisionNumber in project intellij-community by JetBrains.
the class MergeUtil method putRevisionInfo.
private static void putRevisionInfo(@NotNull List<? extends DiffContent> contents, @NotNull MergeData data) {
for (ThreeSide side : ThreeSide.values()) {
DiffContent content = side.select(contents);
FilePath filePath = side.select(data.CURRENT_FILE_PATH, data.ORIGINAL_FILE_PATH, data.LAST_FILE_PATH);
VcsRevisionNumber revision = side.select(data.CURRENT_REVISION_NUMBER, data.ORIGINAL_REVISION_NUMBER, data.LAST_REVISION_NUMBER);
if (filePath != null && revision != null) {
content.putUserData(DiffUserDataKeysEx.REVISION_INFO, Pair.create(filePath, revision));
}
}
}
use of com.intellij.openapi.vcs.history.VcsRevisionNumber in project intellij-community by JetBrains.
the class FileGroup method getFilesAndRevisions.
public List<Pair<String, VcsRevisionNumber>> getFilesAndRevisions(ProjectLevelVcsManager vcsManager) {
ArrayList<Pair<String, VcsRevisionNumber>> files = new ArrayList<>();
for (UpdatedFile file : myFiles) {
VcsRevisionNumber number = getRevision(vcsManager, file);
files.add(Pair.create(file.getPath(), number));
}
return files;
}
use of com.intellij.openapi.vcs.history.VcsRevisionNumber in project intellij-community by JetBrains.
the class BinaryFilePatchInProgress method createChange.
@NotNull
@Override
protected Change createChange(Project project) {
ContentRevision before = null;
ContentRevision after = null;
if (!myPatch.isNewFile()) {
before = new CurrentBinaryContentRevision(getFilePath()) {
@NotNull
@Override
public VcsRevisionNumber getRevisionNumber() {
return new TextRevisionNumber(VcsBundle.message("local.version.title"));
}
};
}
if (!myPatch.isDeletedFile()) {
after = createNewContentRevision(getFilePath());
}
return new Change(before, after);
}
Aggregations