本文整理汇总了Java中com.intellij.vcsUtil.VcsUtil.getFilePath方法的典型用法代码示例。如果您正苦于以下问题:Java VcsUtil.getFilePath方法的具体用法?Java VcsUtil.getFilePath怎么用?Java VcsUtil.getFilePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.vcsUtil.VcsUtil
的用法示例。
在下文中一共展示了VcsUtil.getFilePath方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSelectedFileOrNull
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
@Nullable
protected static FilePath getSelectedFileOrNull(VcsContext context) {
FilePath result = null;
VirtualFile[] virtualFileArray = context.getSelectedFiles();
if (virtualFileArray.length != 0) {
if (virtualFileArray.length > 1) return null;
if (virtualFileArray.length > 0) {
result = VcsUtil.getFilePath(virtualFileArray[0]);
}
}
File[] fileArray = context.getSelectedIOFiles();
if (fileArray != null && fileArray.length > 0) {
for (File file : fileArray) {
final File parentIoFile = file.getParentFile();
if (parentIoFile == null) continue;
final VirtualFile parent = LocalFileSystem.getInstance().findFileByIoFile(parentIoFile);
if (parent != null) {
FilePath child = VcsUtil.getFilePath(parent, file.getName());
if (result != null) return null;
result = child;
}
}
}
return result;
}
示例2: setup
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
private boolean setup() {
boolean result = false;
RootUrlInfo rootUrlInfo = myVcs.getSvnFileUrlMapping().getWcRootForFilePath(new File(file.getPath()));
if (rootUrlInfo != null) {
changeList = new SvnChangeList[1];
revisionBefore = ((SvnRevisionNumber)number).getRevision();
repositoryUrl = rootUrlInfo.getRepositoryUrlUrl();
svnRootUrl = rootUrlInfo.getAbsoluteUrlAsUrl();
svnRootLocation = new SvnRepositoryLocation(rootUrlInfo.getAbsoluteUrl());
repositoryRelativeUrl = SvnUtil.ensureStartSlash(SvnUtil.join(
SvnUtil.getRelativeUrl(repositoryUrl.toDecodedString(), svnRootUrl.toDecodedString()),
SvnUtil.getRelativePath(rootUrlInfo.getPath(), file.getPath())));
filePath = VcsUtil.getFilePath(file);
result = true;
}
return result;
}
示例3: showDiffWithBranch
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
private static void showDiffWithBranch(@NotNull Project project, @NotNull VirtualFile file, @NotNull String head,
@NotNull String branchToCompare) throws VcsException {
FilePath filePath = VcsUtil.getFilePath(file);
// we could use something like GitRepository#getCurrentRevision here,
// but this way we can easily identify if the file is available in the branch
GitRevisionNumber compareRevisionNumber = (GitRevisionNumber)GitHistoryUtils.getCurrentRevision(project, filePath, branchToCompare);
if (compareRevisionNumber == null) {
fileDoesntExistInBranchError(project, file, branchToCompare);
return;
}
GitRevisionNumber currentRevisionNumber = (GitRevisionNumber)GitHistoryUtils.getCurrentRevision(project, filePath, head);
if (currentRevisionNumber == null) {
LOG.error(String.format("Current revision number is null for file [%s] and branch [%s]", filePath, head));
return;
}
// constructing the revision with human readable name (will work for files comparison however).
VcsFileRevision compareRevision = new GitFileRevision(project, filePath,
new GitRevisionNumber(branchToCompare, compareRevisionNumber.getTimestamp()));
CurrentRevision currentRevision = new CurrentRevision(file, new GitRevisionNumber(head, currentRevisionNumber.getTimestamp()));
new GitDiffFromHistoryHandler(project).showDiffForTwo(project, VcsUtil.getFilePath(file), compareRevision, currentRevision);
}
示例4: testCommitImpl
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
private File testCommitImpl(File wc1) throws IOException {
Assert.assertTrue(wc1.isDirectory());
final File file = FileUtil.createTempFile(wc1, "file", ".txt");
final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(file);
Assert.assertNotNull(vf);
final ArrayList<VirtualFile> files = new ArrayList<VirtualFile>();
files.add(vf);
final List<VcsException> exceptions = myVcs.getCheckinEnvironment().scheduleUnversionedFilesForAddition(files);
Assert.assertTrue(exceptions.isEmpty());
final Change change = new Change(null, new CurrentContentRevision(VcsUtil.getFilePath(vf)));
final List<VcsException> commit = myVcs.getCheckinEnvironment().commit(Collections.singletonList(change), "commit");
Assert.assertTrue(commit.isEmpty());
++ myExpectedCreds;
++ myExpectedCert;
return file;
}
示例5: createChangeForPath
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
private Change createChangeForPath(String path) {
VirtualFile file = VfsTestUtil.createFile(myBaseDir, path);
FilePath filePath = VcsUtil.getFilePath(file);
ContentRevision beforeRevision = new MockContentRevision(filePath, new VcsRevisionNumber.Int(1));
ContentRevision afterRevision = new MockContentRevision(filePath, new VcsRevisionNumber.Int(2));
return new Change(beforeRevision, afterRevision);
}
示例6: createPath
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
public static FilePath createPath(@NotNull VirtualFile vcsRoot, @NotNull String path,
boolean isDeleted, boolean canBeDeleted, boolean unescapePath) throws VcsException {
final String absolutePath = makeAbsolutePath(vcsRoot, path, unescapePath);
FilePath file = isDeleted ? VcsUtil.getFilePathForDeletedFile(absolutePath, false) : VcsUtil.getFilePath(absolutePath, false);
if (canBeDeleted && (! SystemInfo.isFileSystemCaseSensitive) && VcsFilePathUtil.caseDiffers(file.getPath(), absolutePath)) {
// as for deleted file
file = VcsUtil.getFilePath(absolutePath, false);
}
return file;
}
示例7: getNewContentRevision
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
@Override
public ContentRevision getNewContentRevision() {
if (FilePatchStatus.DELETED.equals(myStatus)) return null;
if (myNewContentRevision != null) return myNewContentRevision;
if (myPatch.getAfterFileName() != null) {
final FilePath newFilePath = FilePatchStatus.ADDED.equals(myStatus) ? VcsUtil.getFilePath(myIoCurrentBase, false)
: detectNewFilePathForMovedOrModified();
myNewContentRevision = new ShelvedBinaryContentRevision(newFilePath, myPatch.getShelvedBinaryFile().SHELVED_PATH);
}
return myNewContentRevision;
}
示例8: getChange
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
public Change getChange(Project project) {
// todo unify with
if (myChange == null) {
File baseDir = new File(project.getBaseDir().getPath());
File file = getAbsolutePath(baseDir, myBeforePath);
FilePath beforePath = VcsUtil.getFilePath(file, false);
beforePath.refresh();
ContentRevision beforeRevision = null;
if (myFileStatus != FileStatus.ADDED) {
beforeRevision = new CurrentContentRevision(beforePath) {
@Override
@NotNull
public VcsRevisionNumber getRevisionNumber() {
return new TextRevisionNumber(VcsBundle.message("local.version.title"));
}
};
}
ContentRevision afterRevision = null;
if (myFileStatus != FileStatus.DELETED) {
FilePath afterPath = VcsUtil.getFilePath(getAbsolutePath(baseDir, myAfterPath), false);
afterRevision = new PatchedContentRevision(project, beforePath, afterPath);
}
myChange = new Change(beforeRevision, afterRevision, myFileStatus);
}
return myChange;
}
示例9: findChange
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
@Nullable
private HgChange findChange(@NotNull HgRepository hgRepo, @NotNull HgNameWithHashInfo info) {
File file = new File(hgRepo.getRoot().getPath(), info.getName());
VirtualFile virtualSubrepoFile = VfsUtil.findFileByIoFile(file, false);
HgRepository subrepo = HgUtil.getRepositoryForFile(myProject, virtualSubrepoFile);
if (subrepo != null && !info.getHash().asString().equals(subrepo.getCurrentRevision())) {
return new HgChange(new HgFile(hgRepo.getRoot(), VcsUtil.getFilePath(virtualSubrepoFile)), HgFileStatusEnum.MODIFIED);
}
return null;
}
示例10: getFilePath
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
@Nullable
public FilePath getFilePath(final SvnVcs vcs) {
if (! myHadChanged) return null;
final SvnFileUrlMapping svnFileUrlMapping = vcs.getSvnFileUrlMapping();
final String absolutePath = SVNPathUtil.append(myRepositoryRoot, myCurrentPath);
final String localPath = svnFileUrlMapping.getLocalPath(absolutePath);
if (localPath == null) {
LOG.info("Cannot find local path for url: " + absolutePath);
return null;
}
return VcsUtil.getFilePath(localPath, false);
}
示例11: getPathBeforeRename
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
public FilePath getPathBeforeRename(final VirtualFile file) {
final FilePath path = myPathsBeforeRename.get(file);
if (path != null) return path;
return VcsUtil.getFilePath(file);
}
示例12: testRollbackDirRenameWithDeepRenamesAndUnverioned
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
@Test
public void testRollbackDirRenameWithDeepRenamesAndUnverioned() throws Exception {
final SubTree tree = new SubTree(myWorkingCopyDir);
checkin();
final VirtualFile inner = createDirInCommand(tree.mySourceDir, "inner");
final VirtualFile inner1 = createDirInCommand(inner, "inner1");
final VirtualFile inner2 = createDirInCommand(inner1, "inner2");
final VirtualFile innerFile_ = createFileInCommand(inner1, "inInner38432.txt", "kdfjsdisdjiuewjfew wefn w");
final VirtualFile inner3 = createDirInCommand(inner2, "inner3");
final VirtualFile innerFile = createFileInCommand(inner3, "inInner.txt", "kdfjsdisdjiuewjfew wefn w");
final VirtualFile innerFile1 = createFileInCommand(inner3, "inInner1.txt", "kdfjsdisdjiuewjfew wefn w");
disableSilentOperation(VcsConfiguration.StandardConfirmation.ADD);
final VirtualFile deepUNversioned = createFileInCommand(inner3, "deep.txt", "deep");
final File wasU = new File(deepUNversioned.getPath());
final File wasLowestDir = new File(inner3.getPath());
final File wasInnerFile1 = new File(innerFile1.getPath());
final File wasInnerFile = new File(innerFile.getPath());
checkin();
runAndVerifyStatus("? root" + File.separator + "source" + File.separator + "inner" +
File.separator + "inner1" + File.separator + "inner2" + File.separator +
"inner3" + File.separator + "deep.txt");
VcsTestUtil.editFileInCommand(myProject, innerFile, "some content");
final File inner2Before = new File(inner2.getPath());
VcsTestUtil.renameFileInCommand(myProject, inner2, "newName2");
final File wasU2 = new File(deepUNversioned.getPath());
final File inner2After = new File(inner2.getPath());
final File wasInnerFileAfter = new File(innerFile.getPath());
final File wasInnerFile1After = new File(innerFile1.getPath());
final File wasLowestDirAfter = new File(inner3.getPath());
VcsTestUtil.renameFileInCommand(myProject, tree.mySourceDir, "newNameSource");
Assert.assertTrue(! wasU.exists());
Assert.assertTrue(! wasU2.exists());
myDirtyScopeManager.markEverythingDirty();
myChangeListManager.ensureUpToDate(false);
final Change change = assertRenamedChange(tree.mySourceDir);
final Change s1Change = assertMovedChange(tree.myS1File);
final Change s2Change = assertMovedChange(tree.myS2File);
final Change inner2Change = assertMovedChange(inner2);
assertMovedChange(inner);
final Change innerChange = assertMovedChange(innerFile);
final Change fantomDelete1 = new Change(new SimpleContentRevision("1", VcsUtil.getFilePath(wasLowestDir, true), "2"),
new SimpleContentRevision("1", VcsUtil.getFilePath(wasLowestDirAfter, true), "2"));
final Change fantomDelete2 = new Change(new SimpleContentRevision("1", VcsUtil.getFilePath(wasInnerFile1, false), "2"),
new SimpleContentRevision("1", VcsUtil.getFilePath(wasInnerFile1After, false), SVNRevision.WORKING.getName()));
rollbackIMpl(Arrays.asList(change),
Arrays.asList(new Change(new SimpleContentRevision("1", VcsUtil.getFilePath(wasInnerFile, false), "2"),
new SimpleContentRevision("1", VcsUtil.getFilePath(wasInnerFileAfter, false), SVNRevision.WORKING.getName())),
new Change(new SimpleContentRevision("1", VcsUtil.getFilePath(inner2Before, true), "2"),
new SimpleContentRevision("1", VcsUtil.getFilePath(inner2After, true), SVNRevision.WORKING.getName())),
fantomDelete1, fantomDelete2));
Assert.assertTrue(wasU2.exists());
}
示例13: convert
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
public FilePath convert(VirtualFile vf) {
return VcsUtil.getFilePath(vf);
}
示例14: processRecursively
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
private void processRecursively(@NotNull VirtualFile vFile, @NotNull Depth prevDepth) {
if (Depth.EMPTY.equals(prevDepth)) return;
if (isIgnoredIdeaLevel(vFile)) {
myReceiver.processIgnored(vFile);
return;
}
final Depth newDepth = Depth.INFINITY.equals(prevDepth) ? Depth.INFINITY : Depth.EMPTY;
final File ioFile = new File(vFile.getPath());
final Processor<File> processor;
final Processor<File> directoryFilter;
final Ref<File> lastIgnored = new Ref<File>();
final Processor<File> checkDirProcessor = new Processor<File>() {
@Override
public boolean process(File file) {
FilePath path = VcsUtil.getFilePath(file, true);
VirtualFile vf = VfsUtil.findFileByIoFile(file, true);
if (vf != null && isIgnoredIdeaLevel(vf)) {
lastIgnored.set(file);
myReceiver.processIgnored(vf);
}
else if (file.isDirectory() && new File(file, SVNFileUtil.getAdminDirectoryName()).exists()) {
myQueue.add(createItem(path, newDepth, true));
}
else if (vf != null) {
myReceiver.processUnversioned(vf);
}
return true;
}
};
if (Depth.EMPTY.equals(newDepth)) {
// just process immediate children - so only root directory itself should satisfy filter
directoryFilter = new Processor<File>() {
@Override
public boolean process(File file) {
return FileUtil.filesEqual(ioFile, file);
}
};
processor = new Processor<File>() {
@Override
public boolean process(File file) {
// TODO: check if we should still call checkDirProcessor() here - or we really could not check ignore settings but just call
// TODO: myReceiver.processUnversioned() for all immediate children
// here we deal only with immediate children - so ignored on IDEA level for children is not important
return FileUtil.filesEqual(ioFile, file) || checkDirProcessor.process(file);
}
};
} else {
directoryFilter = new Processor<File>() {
@Override
public boolean process(File file) {
return ! Comparing.equal(lastIgnored, file) && (myQueue.isEmpty() || ! FileUtil.filesEqual(myQueue.getLast().getPath().getIOFile(), file));
}
};
processor = checkDirProcessor;
}
FileUtil.processFilesRecursively(ioFile, processor, directoryFilter);
}
示例15: rebasePath
import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
@NotNull
private static FilePath rebasePath(@NotNull FilePath oldBase, @NotNull FilePath newBase, @NotNull FilePath path) {
String relativePath = ObjectUtils.assertNotNull(FileUtil.getRelativePath(oldBase.getPath(), path.getPath(), '/'));
return VcsUtil.getFilePath(newBase.getPath() + "/" + relativePath, path.isDirectory());
}