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

Java VcsException类代码示例

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

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



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

示例1: getContent

import com.intellij.openapi.vcs.VcsException; //导入依赖的package包/类
@Nullable
public String getContent() throws VcsException {
  if (myFile.isDirectory()) {
    return null;
  }
  try {
    return ContentRevisionCache
      .getOrLoadAsString(myProject, myFile, myRevision, GitVcs.getKey(), ContentRevisionCache.UniqueType.REPOSITORY_CONTENT,
                         new Throwable2Computable<byte[], VcsException, IOException>() {
                           @Override
                           public byte[] compute() throws VcsException, IOException {
                             return loadContent();
                           }
                         }, myCharset);
  }
  catch (IOException e) {
    throw new VcsException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:GitContentRevision.java


示例2: loadBackwards

import com.intellij.openapi.vcs.VcsException; //导入依赖的package包/类
private void loadBackwards(SVNURL svnurl) throws SVNException, VcsException {
  // this method is called when svnurl does not exist in latest repository revision - thus concrete old revision is used for "info"
  // command to get repository url
  Info info = myVcs.getInfo(svnurl, myPeg, myPeg);
  final SVNURL rootURL = info != null ? info.getRepositoryRootURL() : null;
  final String root = rootURL != null ? rootURL.toString() : "";
  String relativeUrl = myUrl;
  if (myUrl.startsWith(root)) {
    relativeUrl = myUrl.substring(root.length());
  }

  final RepositoryLogEntryHandler repositoryLogEntryHandler =
      new RepositoryLogEntryHandler(myVcs, myUrl, SVNRevision.UNDEFINED, relativeUrl,
                                    new ThrowableConsumer<VcsFileRevision, SVNException>() {
                                      @Override
                                      public void consume(VcsFileRevision revision) throws SVNException {
                                        myConsumer.consume(revision);
                                      }
                                    }, rootURL);
  repositoryLogEntryHandler.setThrowCancelOnMeetPathCreation(true);

  SvnTarget target = SvnTarget.fromURL(rootURL, myFrom);
  myVcs.getFactory(target).createHistoryClient()
    .doLog(target, myFrom, myTo == null ? SVNRevision.create(1) : myTo, false, true, myShowMergeSources && mySupport15, 1, null,
           repositoryLogEntryHandler);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:SvnHistoryProvider.java


示例3: setRevisionProperty

import com.intellij.openapi.vcs.VcsException; //导入依赖的package包/类
@Override
public void setRevisionProperty(@NotNull SvnTarget target,
                                @NotNull String property,
                                @NotNull SVNRevision revision,
                                @Nullable PropertyValue value,
                                boolean force) throws VcsException {
  try {
    if (target.isFile()) {
      createClient().doSetRevisionProperty(target.getFile(), revision, property, toPropertyValue(value), force, null);
    }
    else {
      createClient().doSetRevisionProperty(target.getURL(), revision, property, toPropertyValue(value), force, null);
    }
  }
  catch (SVNException e) {
    throw new SvnBindException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:SvnKitPropertyClient.java


示例4: doMerge

import com.intellij.openapi.vcs.VcsException; //导入依赖的package包/类
protected void doMerge() throws VcsException {
  for (Change change : mySelectedChanges) {
    SvnRepositoryContentRevision before = (SvnRepositoryContentRevision)change.getBeforeRevision();
    SvnRepositoryContentRevision after = (SvnRepositoryContentRevision)change.getAfterRevision();

    if (before == null) {
      //noinspection ConstantConditions
      add(after);
    }
    else if (after == null) {
      delete(before);
    }
    else {
      merge(before, after);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PointMerger.java


示例5: runCommit

import com.intellij.openapi.vcs.VcsException; //导入依赖的package包/类
@NotNull
private CommitInfo[] runCommit(@NotNull List<File> paths, @NotNull String message) throws VcsException {
  if (ContainerUtil.isEmpty(paths)) return new CommitInfo[]{CommitInfo.EMPTY};

  Command command = newCommand(SvnCommandName.ci);

  command.put(Depth.EMPTY);
  command.put("-m", message);
  // TODO: seems that sort is not necessary here
  ContainerUtil.sort(paths);
  command.setTargets(paths);

  IdeaCommitHandler handler = new IdeaCommitHandler(ProgressManager.getInstance().getProgressIndicator());
  CmdCheckinClient.CommandListener listener = new CommandListener(handler);
  listener.setBaseDirectory(CommandUtil.requireExistingParent(paths.get(0)));
  execute(myVcs, SvnTarget.fromFile(paths.get(0)), null, command, listener);
  listener.throwExceptionIfOccurred();

  long revision = validateRevisionNumber(listener.getCommittedRevision());

  return new CommitInfo[]{new CommitInfo.Builder().setRevision(revision).build()};
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:CmdCheckinClient.java


示例6: registerFile

import com.intellij.openapi.vcs.VcsException; //导入依赖的package包/类
/**
 * Register file in the map under appropriate root
 *
 * @param files      a map to use
 * @param file       a file to register
 * @param exceptions the list of exceptions to update
 */
private static void registerFile(Map<VirtualFile, List<FilePath>> files, FilePath file, List<VcsException> exceptions) {
  final VirtualFile root;
  try {
    root = GitUtil.getGitRoot(file);
  }
  catch (VcsException e) {
    exceptions.add(e);
    return;
  }
  List<FilePath> paths = files.get(root);
  if (paths == null) {
    paths = new ArrayList<FilePath>();
    files.put(root, paths);
  }
  paths.add(file);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:GitRollbackEnvironment.java


示例7: checkout

import com.intellij.openapi.vcs.VcsException; //导入依赖的package包/类
@Override
public void checkout(@NotNull SvnTarget source,
                     @NotNull File destination,
                     @Nullable SVNRevision revision,
                     @Nullable Depth depth,
                     boolean ignoreExternals,
                     boolean force,
                     @NotNull WorkingCopyFormat format,
                     @Nullable ProgressTracker handler) throws VcsException {
  validateFormat(format, getSupportedFormats());

  List<String> parameters = new ArrayList<String>();

  CommandUtil.put(parameters, source);
  CommandUtil.put(parameters, destination, false);
  CommandUtil.put(parameters, depth);
  CommandUtil.put(parameters, revision);
  CommandUtil.put(parameters, ignoreExternals, "--ignore-externals");
  CommandUtil.put(parameters, force, "--force"); // corresponds to "allowUnversionedObstructions" in SVNKit

  run(source, destination, handler, parameters);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:CmdCheckoutClient.java


示例8: updateShouldMergeAndCommitChanges

import com.intellij.openapi.vcs.VcsException; //导入依赖的package包/类
@Test
public void updateShouldMergeAndCommitChanges() throws Exception{
  changeFile_A_AndCommitInRemoteRepository();
  createAndCommitNewFileInLocalRepository();
  //we've got diverging heads in remote and local now

  PreUpdateInformation preUpdateInformation = new PreUpdateInformation().getPreUpdateInformation();
  HgRevisionNumber incomingHead = preUpdateInformation.getIncomingHead();
  HgRevisionNumber headBeforeUpdate = preUpdateInformation.getHeadBeforeUpdate();

  List<VcsException> warnings = updateThroughPlugin();

  assertEquals(warnings.size(), 0, "Plain update should not generate warnings");

  assertCurrentHeadIsMerge(incomingHead, headBeforeUpdate);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:HgUpdateTest.java


示例9: executeCommand

import com.intellij.openapi.vcs.VcsException; //导入依赖的package包/类
private void executeCommand(final DirectoryContentProvider command, final GetContentCallback callback) {
  final CvsOperationExecutor executor = new CvsOperationExecutor(false, callback.getProject(), callback.getModalityState());
  executor.setIsQuietOperation(true);

  final CancellableCvsHandler cvsHandler = new CancellableCvsHandler(CvsBundle.message("browse.repository.operation.name"), (CvsOperation)command);
  callback.useForCancel(cvsHandler.getProgressListener());

  executor.performActionSync(cvsHandler, new DefaultCvsOperationExecutorCallback() {
    @Override
    public void executionFinished(boolean successfully) {
      if (!successfully) {
        final List<VcsException> errors = cvsHandler.getErrorsExceptAborted();
        if (!errors.isEmpty()) {
          myErrorCallback.consume(errors.get(0));
        }
      }
      callback.finished();
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:AbstractVcsDataProvider.java


示例10: getChange

import com.intellij.openapi.vcs.VcsException; //导入依赖的package包/类
@Nullable
private static Change getChange(@NotNull DiffRequestPresentable presentable) {
  if (presentable instanceof DiffRequestPresentableProxy) {
    try {
      presentable = ((DiffRequestPresentableProxy)presentable).init();
    }
    catch (VcsException e) {
      LOG.info(e);
      return null;
    }
  }
  if (presentable instanceof ChangeDiffRequestPresentable) {
    return ((ChangeDiffRequestPresentable)presentable).getChange();
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:MigrateToNewDiffUtil.java


示例11: runGetProperty

import com.intellij.openapi.vcs.VcsException; //导入依赖的package包/类
private void runGetProperty(@NotNull SvnTarget target,
                            @Nullable String property,
                            @Nullable SVNRevision revision,
                            @Nullable Depth depth,
                            @Nullable PropertyConsumer handler) throws VcsException {
  SVNWCClient client = createClient();

  try {
    if (target.isURL()) {
      client.doGetProperty(target.getURL(), property, target.getPegRevision(), revision, toDepth(depth), toHandler(handler));
    } else {
      client.doGetProperty(target.getFile(), property, target.getPegRevision(), revision, toDepth(depth), toHandler(handler), null);
    }
  } catch (SVNException e) {
    throw new VcsException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:SvnKitPropertyClient.java


示例12: onlyHashesHistory

import com.intellij.openapi.vcs.VcsException; //导入依赖的package包/类
public static List<Pair<SHAHash, Date>> onlyHashesHistory(Project project, FilePath path, final VirtualFile root, final String... parameters)
  throws VcsException {
  // adjust path using change manager
  path = getLastCommitName(project, path);
  GitSimpleHandler h = new GitSimpleHandler(project, root, GitCommand.LOG);
  GitLogParser parser = new GitLogParser(project, HASH, COMMIT_TIME);
  h.setStdoutSuppressed(true);
  h.addParameters(parameters);
  h.addParameters(parser.getPretty(), "--encoding=UTF-8");
  h.endOptions();
  h.addRelativePaths(path);
  String output = h.run();

  final List<Pair<SHAHash, Date>> rc = new ArrayList<Pair<SHAHash, Date>>();
  for (GitLogRecord record : parser.parse(output)) {
    record.setUsedHandler(h);
    rc.add(Pair.create(new SHAHash(record.getHash()), record.getDate()));
  }
  return rc;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GitHistoryUtils.java


示例13: export

import com.intellij.openapi.vcs.VcsException; //导入依赖的package包/类
@Override
public void export(@NotNull SvnTarget from,
                   @NotNull File to,
                   @Nullable SVNRevision revision,
                   @Nullable Depth depth,
                   @Nullable String nativeLineEnd,
                   boolean force,
                   boolean ignoreExternals,
                   @Nullable ProgressTracker handler) throws VcsException {
  SVNUpdateClient client = myVcs.getSvnKitManager().createUpdateClient();

  client.setEventHandler(toEventHandler(handler));
  client.setIgnoreExternals(ignoreExternals);

  try {
    if (from.isFile()) {
      client.doExport(from.getFile(), to, from.getPegRevision(), revision, nativeLineEnd, force, toDepth(depth));
    }
    else {
      client.doExport(from.getURL(), to, from.getPegRevision(), revision, nativeLineEnd, force, toDepth(depth));
    }
  }
  catch (SVNException e) {
    throw new SvnBindException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:SvnKitExportClient.java


示例14: updateShouldMergeButNotCommitWithConflicts

import com.intellij.openapi.vcs.VcsException; //导入依赖的package包/类
@Test
public void updateShouldMergeButNotCommitWithConflicts() throws Exception{
  changeFile_A_AndCommitInRemoteRepository();

  VirtualFile commonFile = projectRepoVirtualFile.findChild("com").findChild("a.txt");
  assertNotNull(commonFile);
  
  VcsTestUtil.editFileInCommand(myProject, commonFile, "conflicting content");
  runHg(projectRepo, "commit", "-m", "adding conflicting history to local repository");
  
  PreUpdateInformation preUpdateInformation = new PreUpdateInformation().getPreUpdateInformation();
  HgRevisionNumber incomingHead = preUpdateInformation.getIncomingHead();
  HgRevisionNumber headBeforeUpdate = preUpdateInformation.getHeadBeforeUpdate();

  List<VcsException> warnings = updateThroughPlugin();
  assertFalse(warnings.isEmpty());
  assertTrue(warnings.get(warnings.size()-1).getMessage().contains("conflicts"));
  assertTrue(warnings.get(warnings.size()-1).getMessage().contains("commit"));

  List<HgRevisionNumber> parents = new HgWorkingCopyRevisionsCommand(myProject).parents(projectRepoVirtualFile);
  assertEquals(parents.size(), 2);
  assertTrue(parents.contains(incomingHead));
  assertTrue(parents.contains(headBeforeUpdate));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:HgUpdateTest.java


示例15: annotate

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


示例16: activate

import com.intellij.openapi.vcs.VcsException; //导入依赖的package包/类
public void activate() {
  ValueHolder<WrapperInvertor, KeyData> cache = null;

  myPersistentHolder = new PersistentHolder(myFile);
  cache = new ValueHolder<WrapperInvertor, KeyData>() {
    public WrapperInvertor getValue(KeyData dataHolder) {
      final WrapperInvertor result =
        myPersistentHolder.getBestHit(dataHolder.getRepoUrl(), dataHolder.getSourceUrl(), dataHolder.getTargetUrl());
      if (LOG.isDebugEnabled()) {
        LOG.debug("Persistent for: " + dataHolder.toString() + " returned: " + (result == null ? null : result.toString()));
      }
      return result;
    }
    public void setValue(WrapperInvertor value, KeyData dataHolder) {
      if (LOG.isDebugEnabled()) {
        LOG.debug("Put into persistent: key: " + dataHolder.toString() + " value: " + value.toString());
      }
      myPersistentHolder.put(dataHolder.getRepoUrl(), value.getWrapped().getTarget(), value.getWrapped());
    }
  };

  myCalculator = new FactsCalculator<KeyData, WrapperInvertor, VcsException>(
    myProject, "Looking for branch origin", cache, new Loader(myProject));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:SvnBranchPointsCalculator.java


示例17: addGithubRemote

import com.intellij.openapi.vcs.VcsException; //导入依赖的package包/类
public static boolean addGithubRemote(@NotNull Project project,
                                      @NotNull GitRepository repository,
                                      @NotNull String remote,
                                      @NotNull String url) {
  final GitSimpleHandler handler = new GitSimpleHandler(project, repository.getRoot(), GitCommand.REMOTE);
  handler.setSilent(true);

  try {
    handler.addParameters("add", remote, url);
    handler.run();
    if (handler.getExitCode() != 0) {
      GithubNotifications.showError(project, "Can't add remote", "Failed to add GitHub remote: '" + url + "'. " + handler.getStderr());
      return false;
    }
    // catch newly added remote
    repository.update();
    return true;
  }
  catch (VcsException e) {
    GithubNotifications.showError(project, "Can't add remote", e);
    return false;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:GithubUtil.java


示例18: loadStashStack

import com.intellij.openapi.vcs.VcsException; //导入依赖的package包/类
public static void loadStashStack(@NotNull Project project, @NotNull VirtualFile root, @NotNull Charset charset,
                                  final Consumer<StashInfo> consumer) {
  GitSimpleHandler h = new GitSimpleHandler(project, root, GitCommand.STASH.readLockingCommand());
  h.setSilent(true);
  h.addParameters("list");
  String out;
  try {
    h.setCharset(charset);
    out = h.run();
  }
  catch (VcsException e) {
    GitUIUtil.showOperationError(project, e, h.printableCommandLine());
    return;
  }
  for (StringScanner s = new StringScanner(out); s.hasMoreData();) {
    consumer.consume(new StashInfo(s.boundedToken(':'), s.boundedToken(':'), s.line().trim()));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GitStashUtils.java


示例19: buildPatch

import com.intellij.openapi.vcs.VcsException; //导入依赖的package包/类
@NotNull
public static List<FilePatch> buildPatch(final Project project, final Collection<Change> changes, final String basePath,
                                         final boolean reversePatch, final boolean includeBaseText) throws VcsException {
  final Collection<BeforeAfter<AirContentRevision>> revisions;
  if (project != null) {
    revisions = revisionsConvertor(project, new ArrayList<Change>(changes));
  } else {
    revisions = new ArrayList<BeforeAfter<AirContentRevision>>(changes.size());
    for (Change change : changes) {
      revisions.add(new BeforeAfter<AirContentRevision>(convertRevisionToAir(change.getBeforeRevision()), convertRevisionToAir(change.getAfterRevision())));
    }
  }
  return TextPatchBuilder.buildPatch(revisions, basePath, reversePatch, SystemInfo.isFileSystemCaseSensitive, new Runnable() {
    public void run() {
      ProgressManager.checkCanceled();
    }
  }, includeBaseText);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:IdeaTextPatchBuilder.java


示例20: getFactory

import com.intellij.openapi.vcs.VcsException; //导入依赖的package包/类
@NotNull
private ClientFactory getFactory(@NotNull File path, @NotNull WorkingCopyFormat format) throws VcsException {
  ClientFactory factory = myVcs.getFactory(path);
  ClientFactory otherFactory = myVcs.getOtherFactory(factory);
  List<WorkingCopyFormat> factoryFormats = factory.createUpgradeClient().getSupportedFormats();
  List<WorkingCopyFormat> otherFactoryFormats = getOtherFactoryFormats(otherFactory);

  return factoryFormats.contains(format) || !otherFactoryFormats.contains(format) ? factory : otherFactory;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:SvnFormatWorker.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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