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


Java VcsUtil.getVcsRootFor方法代码示例

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


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

示例1: getLastRevision

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
public ItemLatestState getLastRevision(FilePath filePath) {
  VirtualFile vcsRoot = VcsUtil.getVcsRootFor(project, filePath);
  if (vcsRoot == null) {
    return null;
  }

  HgWorkingCopyRevisionsCommand command = new HgWorkingCopyRevisionsCommand(project);
  HgRevisionNumber currentRevision = command.identify(vcsRoot).getFirst();
  if (currentRevision == null) {
    return null;
  }

  boolean fileExists = filePath.getIOFile().exists();
  if (currentRevision.isWorkingVersion()) {
    return new ItemLatestState(command.firstParent(vcsRoot), fileExists, true);
  }

  return new ItemLatestState(currentRevision, fileExists, true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:HgDiffProvider.java

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

示例3: annotate

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
public FileAnnotation annotate(VirtualFile file, VcsFileRevision revision) throws VcsException {
  final VirtualFile vcsRoot = VcsUtil.getVcsRootFor(myProject, VcsUtil.getFilePath(file.getPath()));
  if (vcsRoot == null) {
    throw new VcsException("vcs root is null for " + file);
  }
  final HgFile hgFile = new HgFile(vcsRoot, VfsUtilCore.virtualToIoFile(file));
  HgFile fileToAnnotate = revision instanceof HgFileRevision
                          ? HgUtil.getFileNameInTargetRevision(myProject, ((HgFileRevision)revision).getRevisionNumber(), hgFile)
                          : new HgFile(vcsRoot,
                                       HgUtil.getOriginalFileName(hgFile.toFilePath(), ChangeListManager.getInstance(myProject)));
  final List<HgAnnotationLine> annotationResult = (new HgAnnotateCommand(myProject)).execute(fileToAnnotate, revision);
  final List<HgFileRevision> logResult;
  try {
    HgLogCommand logCommand = new HgLogCommand(myProject);
    logCommand.setFollowCopies(true);
    logResult = logCommand.execute(fileToAnnotate, -1, false);
  }
  catch (HgCommandException e) {
    throw new VcsException("Can not annotate, " + HgVcsMessages.message("hg4idea.error.log.command.execution"), e);
  }
  VcsRevisionNumber revisionNumber = revision == null ?
                                     new HgWorkingCopyRevisionsCommand(myProject).tip(vcsRoot) :
                                     revision.getRevisionNumber();
  return new HgAnnotation(myProject, hgFile, annotationResult, logResult, revisionNumber);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:HgAnnotationProvider.java

示例4: scheduleMissingFileForDeletion

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
public List<VcsException> scheduleMissingFileForDeletion(List<FilePath> files) {
  final List<HgFile> filesWithRoots = new ArrayList<HgFile>();
  for (FilePath filePath : files) {
    VirtualFile vcsRoot = VcsUtil.getVcsRootFor(myProject, filePath);
    if (vcsRoot == null) {
      continue;
    }
    filesWithRoots.add(new HgFile(vcsRoot, filePath));
  }
  new Task.Backgroundable(myProject, "Removing files...") {
    @Override
    public void run(@NotNull ProgressIndicator indicator) {
      HgRemoveCommand command = new HgRemoveCommand(myProject);
      command.execute(filesWithRoots);
    }
  }.queue();
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:HgCheckinEnvironment.java

示例5: getCurrentRevision

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
public VcsRevisionNumber getCurrentRevision(VirtualFile file) {
  VirtualFile vcsRoot = VcsUtil.getVcsRootFor(project, file);
  if (vcsRoot == null) {
    return null;
  }

  FilePath filePath = ObjectsConvertor.VIRTUAL_FILEPATH.convert(file);
  return new HgWorkingCopyRevisionsCommand(project).parents(vcsRoot, filePath).first;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:HgDiffProvider.java

示例6: createSessionFor

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
public VcsHistorySession createSessionFor(FilePath filePath) throws VcsException {
  final VirtualFile vcsRoot = VcsUtil.getVcsRootFor(myProject, filePath);
  if (vcsRoot == null) {
    return null;
  }
  final List<VcsFileRevision> revisions = new ArrayList<VcsFileRevision>();
  revisions.addAll(getHistory(filePath, vcsRoot, myProject));
  return createAppendableSession(vcsRoot, revisions, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:HgHistoryProvider.java

示例7: executeDiff

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
@NotNull
private List<Change> executeDiff(@NotNull FilePath path, @Nullable HgFileRevision rev1, @Nullable HgFileRevision rev2) {
  VirtualFile root = VcsUtil.getVcsRootFor(myProject, path);
  LOG.assertTrue(root != null, "Repository is null for " + path);

  return HgUtil.getDiff(myProject, root, path, rev1, rev2);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:HgDiffFromHistoryHandler.java

示例8: getLocationFor

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
@Nullable
public RepositoryLocation getLocationFor(FilePath filePath) {
  VirtualFile repo = VcsUtil.getVcsRootFor(project, filePath);
  if (repo == null) {
    return null;
  }
  return new HgRepositoryLocation(repo.getUrl(), repo);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:HgCachingCommittedChangesProvider.java

示例9: removeFilesFromVcs

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
/**
 * Calls 'hg remove' to remove given files from the VCS.
 * @param project
 * @param files files to be removed from the VCS.
 */
public static void removeFilesFromVcs(Project project, List<FilePath> files) {
  final HgRemoveCommand command = new HgRemoveCommand(project);
  for (FilePath filePath : files) {
    final VirtualFile vcsRoot = VcsUtil.getVcsRootFor(project, filePath);
    if (vcsRoot == null) {
      continue;
    }
    command.execute(new HgFile(vcsRoot, filePath));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:HgUtil.java

示例10: execute

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
public void execute(VirtualFile source, VirtualFile target) {
  VirtualFile sourceRepo = VcsUtil.getVcsRootFor(myProject, source);
  VirtualFile targetRepo = VcsUtil.getVcsRootFor(myProject, target);
  HgCommandExecutor executor = new HgCommandExecutor(myProject, VcsFileUtil.relativeOrFullPath(sourceRepo, source));
  if (sourceRepo != null && targetRepo != null && sourceRepo.equals(targetRepo)) {
    executor.execute(sourceRepo, "copy", Arrays.asList("--after",
                                                       VcsFileUtil.relativeOrFullPath(sourceRepo, source),
                                                       VcsFileUtil.relativeOrFullPath(targetRepo, target)), null);
  } else {
    // copying from one repository to another => 'hg add' in new repo
    if (targetRepo != null) {
      new HgAddCommand(myProject).execute(Collections.singleton(target));
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:HgCopyCommand.java

示例11: batchPerform

import com.intellij.vcsUtil.VcsUtil; //导入方法依赖的package包/类
protected void batchPerform(Project project, HgVcs activeVcs,
  List<VirtualFile> files, DataContext context) throws VcsException {
  HgResolveCommand resolveCommand = new HgResolveCommand(project);
  for (VirtualFile file : files) {
    VirtualFile root = VcsUtil.getVcsRootFor(project, file);
    if (root == null) {
      return;
    }
    resolveCommand.markResolved(root, file);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:HgMarkResolved.java


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