本文整理汇总了Java中com.intellij.vcsUtil.VcsUtil.runVcsProcessWithProgress方法的典型用法代码示例。如果您正苦于以下问题:Java VcsUtil.runVcsProcessWithProgress方法的具体用法?Java VcsUtil.runVcsProcessWithProgress怎么用?Java VcsUtil.runVcsProcessWithProgress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.vcsUtil.VcsUtil
的用法示例。
在下文中一共展示了VcsUtil.runVcsProcessWithProgress方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadRevisions
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
@Override
@NotNull
public MergeData loadRevisions(@NotNull final VirtualFile file) throws VcsException {
final MergeData mergeData = new MergeData();
final VirtualFile root = GitUtil.getGitRoot(file);
final FilePath path = VcsUtil.getFilePath(file.getPath());
VcsRunnable runnable = new VcsRunnable() {
@Override
@SuppressWarnings({"ConstantConditions"})
public void run() throws VcsException {
GitFileRevision original = new GitFileRevision(myProject, path, new GitRevisionNumber(":" + ORIGINAL_REVISION_NUM));
GitFileRevision current = new GitFileRevision(myProject, path, new GitRevisionNumber(":" + yoursRevision(root)));
GitFileRevision last = new GitFileRevision(myProject, path, new GitRevisionNumber(":" + theirsRevision(root)));
try {
try {
mergeData.ORIGINAL = original.getContent();
}
catch (Exception ex) {
/// unable to load original revision, use the current instead
/// This could happen in case if rebasing.
mergeData.ORIGINAL = file.contentsToByteArray();
}
mergeData.CURRENT = loadRevisionCatchingErrors(current);
mergeData.LAST = loadRevisionCatchingErrors(last);
mergeData.LAST_REVISION_NUMBER = findLastRevisionNumber(root);
}
catch (IOException e) {
throw new IllegalStateException("Failed to load file content", e);
}
}
};
VcsUtil.runVcsProcessWithProgress(runnable, GitBundle.message("merge.load.files"), false, myProject);
return mergeData;
}
示例2: loadRevisions
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
@NotNull
public MergeData loadRevisions(@NotNull final VirtualFile file) throws VcsException {
final MergeData data = new MergeData();
VcsRunnable runnable = new VcsRunnable() {
public void run() throws VcsException {
File oldFile = null;
File newFile = null;
File workingFile = null;
boolean mergeCase = false;
SvnVcs vcs = SvnVcs.getInstance(myProject);
Info info = vcs.getInfo(file);
if (info != null) {
oldFile = info.getConflictOldFile();
newFile = info.getConflictNewFile();
workingFile = info.getConflictWrkFile();
mergeCase = workingFile == null || workingFile.getName().contains("working");
// for debug
if (workingFile == null) {
LOG.info("Null working file when merging text conflict for " + file.getPath() + " old file: " + oldFile + " new file: " + newFile);
}
if (mergeCase) {
// this is merge case
oldFile = info.getConflictNewFile();
newFile = info.getConflictOldFile();
workingFile = info.getConflictWrkFile();
}
data.LAST_REVISION_NUMBER = new SvnRevisionNumber(info.getRevision());
} else {
throw new VcsException("Could not get info for " + file.getPath());
}
if (oldFile == null || newFile == null || workingFile == null) {
ByteArrayOutputStream bos = getBaseRevisionContents(vcs, file);
data.ORIGINAL = bos.toByteArray();
data.LAST = bos.toByteArray();
data.CURRENT = readFile(new File(file.getPath()));
}
else {
data.ORIGINAL = readFile(oldFile);
data.LAST = readFile(newFile);
data.CURRENT = readFile(workingFile);
}
if (mergeCase) {
final ByteArrayOutputStream contents = getBaseRevisionContents(vcs, file);
if (! Arrays.equals(contents.toByteArray(), data.ORIGINAL)) {
// swap base and server: another order of merge arguments
byte[] original = data.ORIGINAL;
data.ORIGINAL = data.LAST;
data.LAST = original;
}
}
}
};
VcsUtil.runVcsProcessWithProgress(runnable, VcsBundle.message("multiple.file.merge.loading.progress.title"), false, myProject);
return data;
}