当前位置: 首页>>代码示例>>Java>>正文


Java VcsUtil.getFilePath方法代码示例

本文整理汇总了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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:TabbedShowHistoryAction.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:SingleCommittedListProvider.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:GitCompareWithBranchAction.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:SvnNativeClientAuthTest.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:LocalChangesUnderRootsTest.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:GitContentRevision.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:BinaryFilePatchInProgress.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:ShelvedChange.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:HgChangeProvider.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:SvnCopyPathTracker.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:ApplyPatchContext.java

示例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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:61,代码来源:SvnRollbackTest.java

示例13: convert

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
public FilePath convert(VirtualFile vf) {
  return VcsUtil.getFilePath(vf);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:ObjectsConvertor.java

示例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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:59,代码来源:SvnRecursiveStatusWalker.java

示例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());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:MergeFromTheirsResolver.java


注:本文中的com.intellij.vcsUtil.VcsUtil.getFilePath方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。