• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VcsUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.vcsUtil.VcsUtil的典型用法代码示例。如果您正苦于以下问题:Java VcsUtil类的具体用法?Java VcsUtil怎么用?Java VcsUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



VcsUtil类属于com.intellij.vcsUtil包,在下文中一共展示了VcsUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testKeepOneUnderRenamed

import com.intellij.vcsUtil.VcsUtil; //导入依赖的package包/类
@Test
public void testKeepOneUnderRenamed() throws Exception {
  final SubTree tree = new SubTree(myWorkingCopyDir);
  checkin();
  final File was2 = new File(tree.myS2File.getPath());

  final String editedText = "s1 edited";
  VcsTestUtil.editFileInCommand(myProject, tree.myS1File, editedText);
  VcsTestUtil.editFileInCommand(myProject, tree.myS2File, "s2 edited");

  VcsTestUtil.renameFileInCommand(myProject, tree.mySourceDir, "renamed");

  myDirtyScopeManager.markEverythingDirty();
  myChangeListManager.ensureUpToDate(false);

  final Change dirChange = assertRenamedChange(tree.mySourceDir);
  final Change s1Change = assertMovedChange(tree.myS1File);
  final Change s2Change = assertMovedChange(tree.myS2File);

  final FilePath fp = VcsUtil.getFilePath(was2, false);
  rollbackIMpl(Arrays.asList(dirChange, s1Change), Arrays.asList(new Change(
    new SimpleContentRevision("1", fp, "1"), new SimpleContentRevision("1", fp, SVNRevision.WORKING.getName()))));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:SvnRollbackTest.java


示例2: updateEverything

import com.intellij.vcsUtil.VcsUtil; //导入依赖的package包/类
/**
 * Based on the selected option and entered path to the target directory,
 * enable/disable the 'OK' button, show error text and update mySelectedDir. 
 */
private void updateEverything() {
  if (myShowDialog && myCreateRepositoryForTheRadioButton.isSelected()) {
    enableOKAction();
    mySelectedDir = myProject.getBaseDir();
  } else {
    final VirtualFile vf = VcsUtil.getVirtualFile(myTextFieldBrowser.getText());
    if (vf == null) {
      disableOKAction();
      mySelectedDir = null;
      return;
    }
    vf.refresh(false, false);
    if (vf.exists() && vf.isValid() && vf.isDirectory()) {
      enableOKAction();
      mySelectedDir = vf;
    } else {
      disableOKAction();
      mySelectedDir = null;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:HgInitDialog.java


示例3: getRevision

import com.intellij.vcsUtil.VcsUtil; //导入依赖的package包/类
@Nullable
private static VcsRevisionNumber getRevision(final ProjectLevelVcsManager vcsManager, final UpdatedFile file) {
  final String vcsName = file.getVcsName();
  final String revision = file.getRevision();
  if (vcsName != null && revision != null) {
    AbstractVcs vcs = vcsManager.findVcsByName(vcsName);
    if (vcs != null) {
      try {
        return vcs.parseRevisionNumber(revision, VcsUtil.getFilePath(file.getPath()));
      }
      catch (VcsException e) {
        //
      }
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:FileGroup.java


示例4: beforeFileDeletion

import com.intellij.vcsUtil.VcsUtil; //导入依赖的package包/类
@Override
public void beforeFileDeletion(@NotNull final VirtualFileEvent event) {
  final VirtualFile file = event.getFile();
  if (isEventIgnored(event, true)) {
    return;
  }
  if (!myChangeListManager.isIgnoredFile(file)) {
    addFileToDelete(file);
    return;
  }
  // files are ignored, directories are handled recursively
  if (event.getFile().isDirectory()) {
    final List<VirtualFile> list = new LinkedList<VirtualFile>();
    VcsUtil.collectFiles(file, list, true, isDirectoryVersioningSupported());
    for (VirtualFile child : list) {
      if (!myChangeListManager.isIgnoredFile(child)) {
        addFileToDelete(child);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:VcsVFSListener.java


示例5: testDeleteDirRecursively

import com.intellij.vcsUtil.VcsUtil; //导入依赖的package包/类
@Test
public void testDeleteDirRecursively() throws Exception {
  GuiUtils.runOrInvokeAndWait(new Runnable() {
    @Override
    public void run() {
      ApplicationManager.getApplication().runWriteAction(new Runnable() {
        @Override
        public void run() {
          final VirtualFile dir = myProjectRoot.findChild("dir");
          myDirtyScope.addDirtyDirRecursively(VcsUtil.getFilePath(dir));
          FileUtil.delete(VfsUtilCore.virtualToIoFile(dir));
        }
      });
    }
  });
  assertChanges(new VirtualFile[] { dir_ctxt, subdir_dtxt },
                new FileStatus[] { DELETED, DELETED });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GitChangeProviderVersionedTest.java


示例6: isEnabled

import com.intellij.vcsUtil.VcsUtil; //导入依赖的package包/类
protected boolean isEnabled(VcsContext context) {
  VirtualFile[] selectedFiles = context.getSelectedFiles();
  if (selectedFiles == null) return false;
  if (selectedFiles.length == 0) return false;
  VirtualFile file = selectedFiles[0];
  Project project = context.getProject();
  if (project == null) return false;
  final ProjectLevelVcsManagerImpl vcsManager = (ProjectLevelVcsManagerImpl) ProjectLevelVcsManager.getInstance(project);
  final BackgroundableActionEnabledHandler handler =
    vcsManager.getBackgroundableActionHandler(VcsBackgroundableActions.HISTORY_FOR_SELECTION);
  if (handler.isInProgress(VcsBackgroundableActions.keyFrom(file))) return false;
  AbstractVcs vcs = vcsManager.getVcsFor(file);
  if (vcs == null) return false;
  VcsHistoryProvider vcsHistoryProvider = vcs.getVcsBlockHistoryProvider();
  if (vcsHistoryProvider == null) return false;
  if (! AbstractVcs.fileInVcsByFileStatus(project, VcsUtil.getFilePath(file))) return false;

  VcsSelection selection = VcsSelectionUtil.getSelection(context);
  if (selection == null) {
    return false;
  }
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:SelectedBlockHistoryAction.java


示例7: getFile

import com.intellij.vcsUtil.VcsUtil; //导入依赖的package包/类
@Nullable
@Override
protected VirtualFile getFile(@NotNull AnActionEvent e) {
  VcsFileRevision revision = getFileRevision(e);
  if (revision == null) return null;

  final FileType currentFileType = myAnnotation.getFile().getFileType();
  FilePath filePath =
    (revision instanceof VcsFileRevisionEx ? ((VcsFileRevisionEx)revision).getPath() : VcsUtil.getFilePath(myAnnotation.getFile()));
  return new VcsVirtualFile(filePath.getPath(), revision, VcsFileSystem.getInstance()) {
    @NotNull
    @Override
    public FileType getFileType() {
      FileType type = super.getFileType();
      if (!type.isBinary()) return type;
      if (!currentFileType.isBinary()) return currentFileType;
      return PlainTextFileType.INSTANCE;
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AnnotateRevisionAction.java


示例8: getLastRevision

import com.intellij.vcsUtil.VcsUtil; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Nullable
public ItemLatestState getLastRevision(VirtualFile file) {
  if (file.isDirectory()) {
    return null;
  }
  if (!ourGoodStatuses.contains(myStatusManager.getStatus(file))) {
    return null;
  }
  try {
    return GitHistoryUtils.getLastRevision(myProject, VcsUtil.getFilePath(file.getPath()));
  }
  catch (VcsException e) {
    return null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GitDiffProvider.java


示例9: setNewBase

import com.intellij.vcsUtil.VcsUtil; //导入依赖的package包/类
public void setNewBase(final VirtualFile base) {
  myBase = base;
  myNewContentRevision = null;
  myCurrentRevision = null;
  myConflicts = null;

  final String beforeName = myPatch.getBeforeName();
  if (beforeName != null) {
    myIoCurrentBase = PathMerger.getFile(new File(myBase.getPath()), beforeName);
    myCurrentBase = myIoCurrentBase == null ? null : VcsUtil.getVirtualFileWithRefresh(myIoCurrentBase);
    myBaseExists = (myCurrentBase != null) && myCurrentBase.exists();
  }
  else {
    // creation
    final String afterName = myPatch.getAfterName();
    myBaseExists = true;
    myIoCurrentBase = PathMerger.getFile(new File(myBase.getPath()), afterName);
    myCurrentBase = VcsUtil.getVirtualFileWithRefresh(myIoCurrentBase);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AbstractFilePatchInProgress.java


示例10: processGroup

import com.intellij.vcsUtil.VcsUtil; //导入依赖的package包/类
private boolean processGroup(final FileGroup group, final List<IncomingChangeListData> incomingData,
                             final ReceivedChangeListTracker tracker) {
  boolean haveUnaccountedUpdatedFiles = false;
  final List<Pair<String,VcsRevisionNumber>> list = group.getFilesAndRevisions(myVcsManager);
  for(Pair<String, VcsRevisionNumber> pair: list) {
    final String file = pair.first;
    FilePath path = VcsUtil.getFilePath(file, false);
    if (!path.isUnder(myRootPath, false) || pair.second == null) {
      continue;
    }
    if (group.getId().equals(FileGroup.REMOVED_FROM_REPOSITORY_ID)) {
      haveUnaccountedUpdatedFiles |= processDeletedFile(path, incomingData, tracker);
    }
    else {
      haveUnaccountedUpdatedFiles |= processFile(path, pair.second, incomingData, tracker);
    }
  }
  for(FileGroup childGroup: group.getChildren()) {
    haveUnaccountedUpdatedFiles |= processGroup(childGroup, incomingData, tracker);
  }
  return haveUnaccountedUpdatedFiles;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:ChangesCacheFile.java


示例11: createFileContent

import com.intellij.vcsUtil.VcsUtil; //导入依赖的package包/类
public ContentRevision createFileContent(VcsRevisionNumber revisionNumber, VirtualFile file) {
  if (file == null) {
    return null;
  }

  VirtualFile vcsRoot = VcsUtil.getVcsRootFor(project, file);
  if (vcsRoot == null) {
    return null;
  }

  HgRevisionNumber hgRevisionNumber = (HgRevisionNumber) revisionNumber;
  if (hgRevisionNumber.isWorkingVersion()) {
    throw new IllegalStateException("Should not compare against working copy");
  }
  HgFile hgFile = new HgFile(vcsRoot, VfsUtilCore.virtualToIoFile(file));
  return HgContentRevision.create(project, hgFile, hgRevisionNumber);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:HgDiffProvider.java


示例12: performMoveRename

import com.intellij.vcsUtil.VcsUtil; //导入依赖的package包/类
@Override
protected void performMoveRename(List<MovedFileInfo> movedFiles) {
  (new VcsBackgroundTask<MovedFileInfo>(myProject,
                                      HgVcsMessages.message("hg4idea.move.progress"),
                                      VcsConfiguration.getInstance(myProject).getAddRemoveOption(),
                                      movedFiles) {
    protected void process(final MovedFileInfo file) throws VcsException {
      final FilePath source = VcsUtil.getFilePath(file.myOldPath);
      final FilePath target = VcsUtil.getFilePath(file.myNewPath);
      VirtualFile sourceRoot = VcsUtil.getVcsRootFor(myProject, source);
      VirtualFile targetRoot = VcsUtil.getVcsRootFor(myProject, target);
      if (sourceRoot != null && targetRoot != null) {
        (new HgMoveCommand(myProject)).execute(new HgFile(sourceRoot, source), new HgFile(targetRoot, target));
      }
      dirtyScopeManager.fileDirty(source);
      dirtyScopeManager.fileDirty(target);
    }

  }).queue();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:HgVFSListener.java


示例13: add

import com.intellij.vcsUtil.VcsUtil; //导入依赖的package包/类
/**
 * For the given VirtualFile constructs a FilePathImpl object without referring to the initial VirtualFile object
 * and adds this FilePathImpl to the set of files for proper VcsDirtyScopeManager - to mark these files dirty
 * when the set will be populated.
 * @param file        file which path is to be added.
 * @param addToFiles  If true, then add to dirty files even if it is a directory. Otherwise add to the proper set.
 */
private void add(VirtualFile file, boolean addToFiles) {
  if (file == null) { return; }
  final boolean isDirectory = file.isDirectory();
  FilePath path = VcsUtil.getFilePath(file.getPath(), isDirectory);
  final Collection<VcsDirtyScopeManager> managers = getManagers(file);
  for (VcsDirtyScopeManager manager : managers) {
    Couple<HashSet<FilePath>> filesAndDirs = map.get(manager);
    if (filesAndDirs == null) {
      filesAndDirs = Couple.of(new HashSet<FilePath>(), new HashSet<FilePath>());
      map.put(manager, filesAndDirs);
    }

    if (addToFiles || !isDirectory) {
      filesAndDirs.first.add(path);
    } else {
      filesAndDirs.second.add(path);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:VcsDirtyScopeVfsListener.java


示例14: check

import com.intellij.vcsUtil.VcsUtil; //导入依赖的package包/类
public boolean check() throws IOException {
  final String[] pieces = RelativePathCalculator.split(myAfterName);
  final VirtualFile parent = makeSureParentPathExists(pieces);
  if (parent == null) {
    setErrorMessage(fileNotFoundMessage(myAfterName));
    return false;
  }
  String name = pieces[pieces.length - 1];
  File afterFile = new File(parent.getPath(), name);
  //if user already accepted overwriting, we shouldn't have created a new one
  final VirtualFile file = myDelayedPrecheckContext.getOverridenPaths().contains(VcsUtil.getFilePath(afterFile))
                           ? parent.findChild(name)
                           : createFile(parent, name);
  if (file == null) {
    setErrorMessage(fileNotFoundMessage(myAfterName));
    return false;
  }
  myAddedPaths.add(VcsUtil.getFilePath(file));
  if (! checkExistsAndValid(file, myAfterName)) {
    return false;
  }
  addPatch(myPatch, file);
  return true;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:PathsVerifier.java


示例15: updateExpectAuthCanceled

import com.intellij.vcsUtil.VcsUtil; //导入依赖的package包/类
private void updateExpectAuthCanceled(File wc1, String expectedText) {
  Assert.assertTrue(wc1.isDirectory());
  final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(wc1);
  final UpdatedFiles files = UpdatedFiles.create();
  final UpdateSession session =
    myVcs.getUpdateEnvironment().updateDirectories(new FilePath[]{VcsUtil.getFilePath(vf)}, files, new EmptyProgressIndicator(),
                                                   new Ref<SequentialUpdatesContext>());
  Assert.assertTrue(session.getExceptions() != null && ! session.getExceptions().isEmpty());
  Assert.assertTrue(!session.isCanceled());
  Assert.assertTrue(session.getExceptions().get(0).getMessage().contains(expectedText));

  if (myIsSecure) {
    ++ myExpectedCreds;
    ++ myExpectedCert;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:SvnNativeClientAuthTest.java


示例16: 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


示例17: getFilesOverwrittenByMerge

import com.intellij.vcsUtil.VcsUtil; //导入依赖的package包/类
private List<FilePath> getFilesOverwrittenByMerge(@NotNull List<String> mergeOutput) {
  final List<FilePath> paths = new ArrayList<FilePath>();
  for  (String line : mergeOutput) {
    if (StringUtil.isEmptyOrSpaces(line)) {
      continue;
    }
    if (line.contains("Please, commit your changes or stash them before you can merge")) {
      break;
    }
    line = line.trim();

    final String path;
    try {
      path = myRoot.getPath() + "/" + GitUtil.unescapePath(line);
      final File file = new File(path);
      if (file.exists()) {
        paths.add(VcsUtil.getFilePath(file, false));
      }
    } catch (VcsException e) { // just continue
    }
  }
  return paths;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:GitMergeUpdater.java


示例18: getData

import com.intellij.vcsUtil.VcsUtil; //导入依赖的package包/类
@Override
public Object getData(String dataId) {
  if (CommonDataKeys.PROJECT.is(dataId)) {
    return myProject;
  }
  TreePath selectionPath = myTree.getSelectionPath();
  DefaultMutableTreeNode node = selectionPath == null ? null : (DefaultMutableTreeNode)selectionPath.getLastPathComponent();
  Object o = node == null ? null : node.getUserObject();
  if (o instanceof Commit) {
    Commit c = (Commit)o;
    if (VcsDataKeys.VCS_VIRTUAL_FILE.is(dataId)) {
      return c.root;
    }
    if (VcsDataKeys.VCS_FILE_REVISION.is(dataId)) {
      return new GitFileRevision(myProject, VcsUtil.getFilePath(c.root.getPath()), c.commitInfo.revision);
    }
  }
  return super.getData(dataId);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GitSkippedCommits.java


示例19: testRollbackLocallyDeletedSimpleDir

import com.intellij.vcsUtil.VcsUtil; //导入依赖的package包/类
@Test
public void testRollbackLocallyDeletedSimpleDir() throws Exception {
  final SubTree tree = new SubTree(myWorkingCopyDir);
  checkin();
  disableSilentOperation(VcsConfiguration.StandardConfirmation.REMOVE);
  final File wasFile = new File(tree.mySourceDir.getPath());
  final File wasFileS1 = new File(tree.myS1File.getPath());
  final File wasFileS2 = new File(tree.myS2File.getPath());
  VcsTestUtil.deleteFileInCommand(myProject, tree.mySourceDir);

  myDirtyScopeManager.markEverythingDirty();
  myChangeListManager.ensureUpToDate(false);

  final List<LocallyDeletedChange> deletedFiles = ((ChangeListManagerImpl)myChangeListManager).getDeletedFiles();
  Assert.assertNotNull(deletedFiles);
  Assert.assertTrue(deletedFiles.size() == 3);

  final Set<File> files = new HashSet<File>();
  files.add(wasFile);
  files.add(wasFileS1);
  files.add(wasFileS2);

  for (LocallyDeletedChange file : deletedFiles) {
    files.remove(file.getPath().getIOFile());
  }
  Assert.assertTrue(files.isEmpty());

  rollbackLocallyDeleted(Collections.<FilePath>singletonList(VcsUtil.getFilePath(wasFile, true)), Collections.<FilePath>emptyList());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:SvnRollbackTest.java


示例20: createChange

import com.intellij.vcsUtil.VcsUtil; //导入依赖的package包/类
@NotNull
private Change createChange(@NotNull String committed, @NotNull PsiFile file) {
  FilePath filePath = VcsUtil.getFilePath(file.getVirtualFile());
  ContentRevision before = new SimpleContentRevision(committed, filePath, "");
  ContentRevision after = new SimpleContentRevision("", filePath, "");
  return new Change(before, after);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ReformatOnlyVcsChangedTextTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StreamHeader11类代码示例发布时间:2022-05-23
下一篇:
Java DeviceInfoHelper类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap