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


Java VcsFileRevision.getRevisionNumber方法代码示例

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


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

示例1: annotate

import com.intellij.openapi.vcs.history.VcsFileRevision; //导入方法依赖的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

示例2: execute

import com.intellij.openapi.vcs.history.VcsFileRevision; //导入方法依赖的package包/类
public List<HgAnnotationLine> execute(@NotNull HgFile hgFile, VcsFileRevision revision) {
  final List<String> arguments = new ArrayList<String>();
  arguments.add("-cvnudl");
  HgVcs vcs = HgVcs.getInstance(myProject);
  if (vcs != null &&
      vcs.getProjectSettings().isWhitespacesIgnoredInAnnotations() &&
      vcs.getVersion().isIgnoreWhitespaceDiffInAnnotationsSupported()) {
    arguments.add("-w");
  }
  if (revision != null) {
    arguments.add("-r");
    HgRevisionNumber revisionNumber = (HgRevisionNumber)revision.getRevisionNumber();
    arguments.add(revisionNumber.getChangeset());
  }
  arguments.add(hgFile.getRelativePath());
  final HgCommandResult result = new HgCommandExecutor(myProject).executeInCurrentThread(hgFile.getRepo(), "annotate", arguments);

  if (result == null) {
    return Collections.emptyList();
  }

  List<String> outputLines = result.getOutputLines();
  return parse(outputLines);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:HgAnnotateCommand.java

示例3: annotate

import com.intellij.openapi.vcs.history.VcsFileRevision; //导入方法依赖的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));
  final List<HgAnnotationLine> annotationResult = (new HgAnnotateCommand(myProject)).execute(hgFile, revision);
  final List<HgFileRevision> logResult;
  try {
    logResult = (new HgLogCommand(myProject)).execute(hgFile, DEFAULT_LIMIT, 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:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:HgAnnotationProvider.java

示例4: execute

import com.intellij.openapi.vcs.history.VcsFileRevision; //导入方法依赖的package包/类
public List<HgAnnotationLine> execute(@NotNull HgFile hgFile, VcsFileRevision revision) {
  final List<String> arguments = new ArrayList<String>();
  arguments.add("-cvnudl");
  if (revision != null) {
    arguments.add("-r");
    HgRevisionNumber revisionNumber = (HgRevisionNumber)revision.getRevisionNumber();
    arguments.add(revisionNumber.getChangeset());
  }
  arguments.add(hgFile.getRelativePath());
  final HgCommandResult result = new HgCommandExecutor(myProject).executeInCurrentThread(hgFile.getRepo(), "annotate", arguments);

  if (result == null) {
    return Collections.emptyList();
  }

  List<String> outputLines = result.getOutputLines();
  return parse(outputLines);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:19,代码来源:HgAnnotateCommand.java

示例5: computeLineNumbers

import com.intellij.openapi.vcs.history.VcsFileRevision; //导入方法依赖的package包/类
@Nullable
private static Map<VcsRevisionNumber, Integer> computeLineNumbers(@NotNull FileAnnotation fileAnnotation) {
  final Map<VcsRevisionNumber, Integer> numbers = new HashMap<VcsRevisionNumber, Integer>();
  final List<VcsFileRevision> fileRevisionList = fileAnnotation.getRevisions();
  if (fileRevisionList != null) {
    int size = fileRevisionList.size();
    for (int i = 0; i < size; i++) {
      VcsFileRevision revision = fileRevisionList.get(i);
      final VcsRevisionNumber number = revision.getRevisionNumber();

      numbers.put(number, size - i);
    }
  }
  return numbers.size() < 2 ? null : numbers;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:AnnotateToggleAction.java

示例6: create

import com.intellij.openapi.vcs.history.VcsFileRevision; //导入方法依赖的package包/类
@NotNull
public static LastRevision create(@NotNull VcsFileRevision revision) {
  VcsRevisionNumber number = revision.getRevisionNumber();
  String author = StringUtil.notNullize(revision.getAuthor(), "Unknown");
  Date date = revision.getRevisionDate();
  String message = StringUtil.notNullize(revision.getCommitMessage());
  return new LastRevision(number, author, date, message);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:AnnotateStackTraceAction.java

示例7: getRevisionNumber

import com.intellij.openapi.vcs.history.VcsFileRevision; //导入方法依赖的package包/类
@Nullable
private static VcsRevisionNumber getRevisionNumber(@NotNull AnActionEvent event) {
  VcsRevisionNumber revision = event.getData(VcsDataKeys.VCS_REVISION_NUMBER);
  if (revision == null) {
    VcsFileRevision fileRevision = event.getData(VcsDataKeys.VCS_FILE_REVISION);
    if (fileRevision != null) {
      revision = fileRevision.getRevisionNumber();
    }
  }
  return revision;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:SelectRevisionInGitLogAction.java

示例8: annotate

import com.intellij.openapi.vcs.history.VcsFileRevision; //导入方法依赖的package包/类
@Override
public FileAnnotation annotate(final VirtualFile file, final VcsFileRevision revision) throws VcsException {
  final File ioFile = new File(file.getPath());
  final FossilFileAnnotation annotation = new FossilFileAnnotation(myFossilVcs.getProject(),
      new CatWorker(myFossilVcs.getProject()).cat(ioFile, revision.getRevisionNumber().asString()),
      (FossilRevisionNumber) revision.getRevisionNumber(), file);
  final FossilSimpleCommand command = new FossilSimpleCommand(myFossilVcs.getProject(), MoveWorker.findParent(ioFile), FCommandName.annotate);
  command.addParameters(ioFile.getPath());
  String result = command.run();
  result = result.replace("\r", "");
  final String[] lines = result.split("\n");
  final CommitWorker commitWorker = new CommitWorker(myFossilVcs.getProject());
  final Map<String, ArtifactInfo> revisionMap = new HashMap<String, ArtifactInfo>();
  int i = 0;
  for (String line : lines) {
    final int spaceIdx = line.indexOf(' ');
    if (spaceIdx == -1) {
      throw new FossilException("Can not parse annotation, line: " + line);
    }
    final String hash = line.substring(0, spaceIdx);
    ArtifactInfo artifactInfo = revisionMap.get(hash);
    if (artifactInfo == null) {
      artifactInfo = commitWorker.getArtifactInfo(hash, ioFile);
      if (artifactInfo == null) {
        // can not get file information, it was renamed
        artifactInfo = new ArtifactInfo();
        artifactInfo.setHash(hash);
        artifactInfo.setDate(new Date(0));
      } else {
        revisionMap.put(hash, artifactInfo);
      }
    }
    annotation.registerLine(i, artifactInfo);
    ++ i;
  }
  return annotation;
}
 
开发者ID:irengrig,项目名称:fossil4idea,代码行数:38,代码来源:FossilAnnotationProvider.java

示例9: computeLineNumbers

import com.intellij.openapi.vcs.history.VcsFileRevision; //导入方法依赖的package包/类
@Nullable
private static Map<VcsRevisionNumber, Integer> computeLineNumbers(@Nonnull FileAnnotation fileAnnotation) {
  final Map<VcsRevisionNumber, Integer> numbers = new HashMap<>();
  final List<VcsFileRevision> fileRevisionList = fileAnnotation.getRevisions();
  if (fileRevisionList != null) {
    int size = fileRevisionList.size();
    for (int i = 0; i < size; i++) {
      VcsFileRevision revision = fileRevisionList.get(i);
      final VcsRevisionNumber number = revision.getRevisionNumber();

      numbers.put(number, size - i);
    }
  }
  return numbers.size() < 2 ? null : numbers;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:AnnotateToggleAction.java

示例10: annotate

import com.intellij.openapi.vcs.history.VcsFileRevision; //导入方法依赖的package包/类
public FileAnnotation annotate(@NotNull final VirtualFile file, final VcsFileRevision revision) throws VcsException {
  if (file.isDirectory()) {
    throw new VcsException("Cannot annotate a directory");
  }
  final FileAnnotation[] annotation = new FileAnnotation[1];
  final Exception[] exception = new Exception[1];
  Runnable command = new Runnable() {
    public void run() {
      try {
        final FilePath currentFilePath = VcsUtil.getFilePath(file.getPath());
        final FilePath realFilePath;
        setProgressIndicatorText(GitBundle.message("getting.history", file.getName()));
        final List<VcsFileRevision> revisions = GitHistoryUtils.history(myProject, currentFilePath);
        if (revision == null) {
          realFilePath = GitHistoryUtils.getLastCommitName(myProject, currentFilePath);
        }
        else {
          realFilePath = ((GitFileRevision)revision).getPath();
        }
        setProgressIndicatorText(GitBundle.message("computing.annotation", file.getName()));
        VcsRevisionNumber revisionNumber = revision != null ? revision.getRevisionNumber() : null;
        final GitFileAnnotation result = annotate(realFilePath, revisionNumber, revisions, file);
        annotation[0] = result;
      }
      catch (ProcessCanceledException pce) {
        throw pce;
      }
      catch (Exception e) {
        exception[0] = e;
      }
    }
  };
  if (ApplicationManager.getApplication().isDispatchThread()) {
    ProgressManager.getInstance().runProcessWithProgressSynchronously(command, GitBundle.getString("annotate.action.name"), false,
                                                                      myProject);
  }
  else {
    command.run();
  }
  if (exception[0] != null) {
    throw new VcsException("Failed to annotate: " + exception[0], exception[0]);
  }
  return annotation[0];
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:45,代码来源:GitAnnotationProvider.java


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