com.intellij.openapi.vcs.VcsException Java Examples

The following examples show how to use com.intellij.openapi.vcs.VcsException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SvnDiffProvider.java    From review-board-idea-plugin with Apache License 2.0 6 votes vote down vote up
private String fromHead(Project project, VirtualFile root, Change[] changes) throws VcsException {
    //TODO: publish only selected changes attribute (need to handle deleted files)
    SvnVcs svnVcs = SvnVcs.getInstance(project);

    Target svnTarget = Target.on(new File(root.getPath()));
    List<String> parameters = new ArrayList<>();
    /*for (Change change : changes) {
        if (change.getVirtualFile() != null) {
            String path = new File(root.getPath()).toURI()
                    .relativize(new File(change.getVirtualFile().getPath()).toURI()).getPath();
            parameters.add(path);
        }
    }*/
    parameters.add("-r");
    parameters.add("HEAD");
    parameters.add("--patch-compatible");
    Command command = new Command(SvnCommandName.diff);
    command.setWorkingDirectory(new File(root.getPath()));
    command.setTarget(svnTarget);
    command.put(parameters);
    LOG.info("Executing svn command : Parameters : " + parameters + " ,target :" + svnTarget);
    CommandExecutor commandExecutor = newRuntime(svnVcs).runWithAuthenticationAttempt(command);
    String output = commandExecutor.getBinaryOutput().toString();
    return output;
}
 
Example #2
Source File: ChangesViewManager.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void changeListUpdateDone() {
  scheduleRefresh();
  ChangeListManagerImpl changeListManager = ChangeListManagerImpl.getInstanceImpl(myProject);
  VcsException updateException = changeListManager.getUpdateException();
  setBusy(false);
  if (updateException == null) {
    Factory<JComponent> additionalUpdateInfo = changeListManager.getAdditionalUpdateInfo();

    if (additionalUpdateInfo != null) {
      updateProgressComponent(additionalUpdateInfo);
    }
    else {
      updateProgressText("", false);
    }
  }
  else {
    updateProgressText(VcsBundle.message("error.updating.changes", updateException.getMessage()), true);
  }
}
 
Example #3
Source File: ResolveConflictHelper.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
/**
 * Process a rename conflict specifically
 *
 * @param conflict
 * @param context
 * @param model
 * @throws VcsException
 */
@VisibleForTesting
protected void processRenameConflict(final Conflict conflict, final ServerContext context, final ResolveConflictsModel model,
                                     final NameMergerResolution nameMergerResolution) throws VcsException {
    // take their name
    if (nameMergerResolution != null && nameMergerResolution.userChoseTheirs()) {
        logger.debug("Taking their name");
        resolveConflictWithProgress(conflict.getLocalPath(), nameMergerResolution.getTheirNameChoice(),
                ResolveConflictsCommand.AutoResolveType.TakeTheirs, context, model, true, nameMergerResolution);
    } else {
        // keep your name
        logger.debug("Keeping your name");
        resolveConflictWithProgress(conflict.getLocalPath(), ResolveConflictsCommand.AutoResolveType.KeepYours,
                context, model, true, nameMergerResolution);
    }
}
 
Example #4
Source File: P4HistoryProvider.java    From p4ic4idea with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public VcsHistorySession createSessionFor(FilePath filePath) throws VcsException {
    ClientConfigRoot root = getRootFor(filePath);
    if (root == null) {
        LOG.info("Not in P4 project: " + filePath);
        return null;
    }

    try {
        List<VcsFileRevision> revisions = P4ServerComponent
                .query(project, root.getClientConfig(),
                        new ListFileHistoryQuery(filePath, -1))
                .blockingGet(UserProjectPreferences.getLockWaitTimeoutMillis(project), TimeUnit.MILLISECONDS)
                .getRevisions(formatter, loader);
        return createAppendableSession(filePath, revisions, null);
    } catch (InterruptedException e) {
        throw new VcsInterruptedException(e);
    }
}
 
Example #5
Source File: BaseDiffFromHistoryHandler.java    From consulo with Apache License 2.0 6 votes vote down vote up
protected void showChangesBetweenRevisions(@Nonnull final FilePath path, @Nonnull final T older, @Nullable final T newer) {
  new CollectChangesTask("Comparing revisions...") {

    @Nonnull
    @Override
    public List<Change> getChanges() throws VcsException {
      return getChangesBetweenRevisions(path, older, newer);
    }

    @Nonnull
    @Override
    public String getDialogTitle() {
      return getChangesBetweenRevisionsDialogTitle(path, older, newer);
    }
  }.queue();
}
 
Example #6
Source File: ResolveConflictHelper.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
@VisibleForTesting
protected void resolveConflictWithProgress(final String localPath, final String updatedPath,
                                           final ResolveConflictsCommand.AutoResolveType type,
                                           final ServerContext context,
                                           final ResolveConflictsModel model,
                                           final boolean updateFiles,
                                           final NameMergerResolution nameMergerResolution) throws VcsException {
    final VcsRunnable resolveRunnable = new VcsRunnable() {
        public void run() throws VcsException {
            resolveConflict(localPath, updatedPath, type, context, model, updateFiles, nameMergerResolution);
        }
    };
    VcsUtil.runVcsProcessWithProgress(resolveRunnable, TfPluginBundle.message(TfPluginBundle.KEY_TFVC_CONFLICT_RESOLVING_PROGRESS_BAR), false, project);

    // The following code is in this method instead of resolveConflict so that it will be called from tests
    if (nameMergerResolution != null && StringUtils.isEmpty(nameMergerResolution.getResolvedLocalPath())) {
        // If we didn't get back what we expected from resolving the conflict, just default to the path we have
        nameMergerResolution.setResolvedLocalPath(nameMergerResolution.getUserSelection());
    }
}
 
Example #7
Source File: VcsLogPersistentIndex.java    From consulo with Apache License 2.0 6 votes vote down vote up
private boolean indexOneByOne(@Nonnull VirtualFile root, @Nonnull TIntHashSet commits) {
  VcsLogProvider provider = myProviders.get(root);
  try {
    List<String> hashes = TroveUtil.map(commits, value -> myHashMap.getCommitId(value).getHash().asString());
    provider.readFullDetails(root, hashes, VcsLogPersistentIndex.this::storeDetail);
  }
  catch (VcsException e) {
    LOG.error(e);
    commits.forEach(value -> {
      markForIndexing(value, root);
      return true;
    });
    return false;
  }
  return true;
}
 
Example #8
Source File: VcsLogRefresherImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
@Override
public DataPack readFirstBlock() {
  try {
    LogInfo data = loadRecentData(new CommitCountRequirements(myRecentCommitCount).asMap(myProviders.keySet()));
    Collection<List<GraphCommit<Integer>>> commits = data.getCommits();
    Map<VirtualFile, CompressedRefs> refs = data.getRefs();
    List<GraphCommit<Integer>> compoundList = multiRepoJoin(commits);
    compoundList = compoundList.subList(0, Math.min(myRecentCommitCount, compoundList.size()));
    myDataPack = DataPack.build(compoundList, refs, myProviders, myHashMap, false);
    mySingleTaskController.request(RefreshRequest.RELOAD_ALL); // build/rebuild the full log in background
    return myDataPack;
  }
  catch (VcsException e) {
    myExceptionHandler.consume(e);
    return DataPack.EMPTY;
  }
}
 
Example #9
Source File: ApplyBinaryShelvedFilePatch.java    From consulo with Apache License 2.0 6 votes vote down vote up
protected Result applyChange(Project project, final VirtualFile fileToPatch, FilePath pathBeforeRename, Getter<CharSequence> baseContents)
        throws IOException {
  try {
    ContentRevision contentRevision = myPatch.getShelvedBinaryFile().createChange(project).getAfterRevision();
    if (contentRevision != null) {
      assert (contentRevision instanceof ShelvedBinaryContentRevision);
      byte[] binaryContent = ((ShelvedBinaryContentRevision)contentRevision).getBinaryContent();
      //it may be new empty binary file
      fileToPatch.setBinaryContent(binaryContent != null ? binaryContent : ArrayUtil.EMPTY_BYTE_ARRAY);
    }
  }
  catch (VcsException e) {
    LOG.error("Couldn't apply shelved binary patch", e);
    return new Result(ApplyPatchStatus.FAILURE) {

      @Override
      public ApplyPatchForBaseRevisionTexts getMergeData() {
        return null;
      }
    };
  }
  return SUCCESS;
}
 
Example #10
Source File: ExceptionHandler.java    From review-board-idea-plugin with Apache License 2.0 6 votes vote down vote up
public static Message getMessage(Exception exception) {
    if (exception instanceof InvalidCredentialException || exception instanceof InvalidConfigurationException) {
        LOG.warn(exception.getMessage());
        return new Message(defaultString(exception.getMessage()), Message.Type.WARNING);
    } else if (exception instanceof ReviewBoardServerException) {
        LOG.warn(exception.getMessage());
        return new Message(exception.getMessage(), Message.Type.WARNING);
    } else if (exception instanceof URISyntaxException || exception instanceof IOException) {
        LOG.warn(exception.getMessage());
        return new Message(PluginBundle.message(PluginBundle.CONNECTION_ERROR_MSG), Message.Type.WARNING);
    } else if (exception instanceof VcsException) {
        LOG.warn(exception.getMessage());
        return new Message(exception.getMessage(), Message.Type.WARNING);
    } else {
        LOG.error(exception);
        return new Message(defaultString(exception.getMessage()), Message.Type.ERROR);
    }

}
 
Example #11
Source File: ContentRevisionUtil.java    From p4ic4idea with Apache License 2.0 6 votes vote down vote up
@Nullable
public static String getContent(@NotNull ClientConfig clientConfig,
        @NotNull HistoryContentLoader loader, @NotNull FilePath file, int rev, @NotNull Charset charset)
        throws VcsException {
    try {
        byte[] ret = loader.loadContentForLocal(clientConfig, file, rev);
        if (ret == null) {
            return null;
        }
        // TODO Look at using CharsetUtil.extractCharsetFromFileContent
        // Or maybe use EncodingManager.getEncoding(file, true);
        return new String(ret, charset);
    } catch (IOException e) {
        throw new VcsException(e);
    }
}
 
Example #12
Source File: Difference.java    From consulo with Apache License 2.0 6 votes vote down vote up
private ContentRevision createContentRevision(final Entry e, final IdeaGateway gw) {
  if (e == null) return null;

  return new ContentRevision() {
    @Nullable
    public String getContent() throws VcsException {
      if (e.isDirectory()) return null;
      return e.getContent().getString(e, gw);
    }

    @Nonnull
    public FilePath getFile() {
      return new FilePathImpl(new File(e.getPath()), e.isDirectory());
    }

    @Nonnull
    public VcsRevisionNumber getRevisionNumber() {
      return VcsRevisionNumber.NULL;
    }
  };
}
 
Example #13
Source File: BackgroundTaskGroup.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void runInEdt(@Nonnull ThrowableRunnable<VcsException> task) {
  myProcessor.add(continuation -> {
    boolean isSuccess = false;
    try {
      task.run();
      isSuccess = true;
    }
    catch (VcsException e) {
      addError(e);
      isSuccess = e.isWarning();
    }
    finally {
      if (!isSuccess) {
        end();
      }
      continuation.run();
    }
  });
}
 
Example #14
Source File: ResolveConflictsModel.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
/**
 * Load the conflicts into the table model
 */
public void loadConflicts() {
    logger.debug("Loading conflicts into the table");
    try {
        final VcsRunnable resolveRunnable = new VcsRunnable() {
            public void run() throws VcsException {
                IdeaHelper.setProgress(ProgressManager.getInstance().getProgressIndicator(), 0.1, TfPluginBundle.message(TfPluginBundle.KEY_TFVC_CONFLICT_LOADING_CONFLICTS));
                conflictHelper.findConflicts(ResolveConflictsModel.this);
            }
        };
        VcsUtil.runVcsProcessWithProgress(resolveRunnable, TfPluginBundle.message(TfPluginBundle.KEY_TFVC_CONFLICT_LOADING_PROGRESS_BAR), false, project);
    } catch (VcsException e) {
        logger.error("Error while loading conflicts: " + e.getMessage());
        addError(ModelValidationInfo.createWithMessage(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_CONFLICT_LOAD_ERROR)));
    }
}
 
Example #15
Source File: AddAction.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
@Override
public void actionPerformed(final AnActionEvent anActionEvent) {
    final Project project = anActionEvent.getData(CommonDataKeys.PROJECT);
    final VirtualFile[] files = VcsUtil.getVirtualFiles(anActionEvent);

    final List<VcsException> errors = new ArrayList<VcsException>();
    ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() {
        public void run() {
            ProgressManager.getInstance().getProgressIndicator().setIndeterminate(true);
            errors.addAll(TFSVcs.getInstance(project).getCheckinEnvironment().scheduleUnversionedFilesForAddition(Arrays.asList(files)));
        }
    }, TfPluginBundle.message(TfPluginBundle.KEY_TFVC_ADD_SCHEDULING), false, project);

    if (!errors.isEmpty()) {
        AbstractVcsHelper.getInstance(project).showErrors(errors, TFSVcs.TFVC_NAME);
    }
}
 
Example #16
Source File: TFSHistoryProvider.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
@Nullable
public VcsHistorySession createSessionFor(final FilePath filePath) throws VcsException {
    try {
        final List<TfsFileRevision> revisions =
                getRevisions(project, TFSVcs.getInstance(project).getServerContext(true), filePath, filePath.isDirectory());
        if (revisions.isEmpty()) {
            return null;
        }

        return createSession(revisions.get(0).getRevisionNumber(), revisions, !filePath.isDirectory());
    } catch (Exception e) {
        throw new VcsException(e);
    }
}
 
Example #17
Source File: CreatePullRequestModel.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
/**
 * This method calculates the commits and diff information against the tip of current branch and
 * the common ancestor of source branch (current branch) and target branch (selected remote branch).
 * <p/>
 * If there is no common parent (two branches are parallel), return an empty GitCommitCompareInfo
 * <p/>
 * This is potentially an expensive calculation, probably should do it on a background thread.
 * We will also attempt to cache the result
 * <p/>
 * default access for testing so we bypass UI code,
 * TODO: reevaluate the testing to properly shutoff the access level
 *
 * @return gitChangesContainer on what has changed on source branch
 */
GitChangesContainer getMyChangesCompareInfo() throws VcsException {

    final GitBranch currBranch = this.getSourceBranch();

    final GitRemoteBranch selectedRemoteBranch = this.getTargetBranch();

    // if source branch or currentBranch isn't set, just return empty diff
    if (selectedRemoteBranch == null || currBranch == null) {
        return GitChangesContainer.createChangesContainer(null, null, null, null,
                getDiffCompareInfoProvider().getEmptyDiff(this.gitRepository), this.gitRepository);
    }

    // get hash of last commit for each branch
    final String remoteBranchHash = GeneralGitHelper.getLastCommitHash(project, gitRepository, selectedRemoteBranch);
    final String currBranchHash = GeneralGitHelper.getLastCommitHash(project, gitRepository, currBranch);

    try {
        GitCommitCompareInfo changes
                = this.diffCache.get(new Pair<String, String>(currBranchHash, remoteBranchHash));

        return GitChangesContainer.createChangesContainer(currBranch.getName(), selectedRemoteBranch.getName(),
                currBranchHash, remoteBranchHash, changes, this.gitRepository);
    } catch (ExecutionException e) {
        throw new VcsException(e.getCause());
    }
}
 
Example #18
Source File: VcsLogRefresherImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void loadLogAndRefs(@Nonnull Collection<VirtualFile> roots,
                            @Nonnull Map<VirtualFile, CompressedRefs> prevRefs,
                            int commitCount) throws VcsException {
  LogInfo logInfo = loadRecentData(prepareRequirements(roots, commitCount, prevRefs));
  for (VirtualFile root : roots) {
    myLoadedInfo.put(root, logInfo.getCommits(root));
    myLoadedInfo.put(root, logInfo.getRefs().get(root));
  }
}
 
Example #19
Source File: P4Vcs.java    From p4ic4idea with Apache License 2.0 5 votes vote down vote up
@Override
@Nullable
public VcsRevisionNumber parseRevisionNumber(String revisionNumberString) throws VcsException {
    try {
        return new VcsRevisionNumber.Int(Integer.parseInt(revisionNumberString));
    } catch (NumberFormatException e) {
        throw new VcsException(e);
    }
}
 
Example #20
Source File: SvnDiffProvider.java    From review-board-idea-plugin with Apache License 2.0 5 votes vote down vote up
@Override
public String generateDiff(Project project, AnActionEvent action) throws VcsException {
    String diffContent;
    if (isFromRevision(project, action)) {
        ChangeList[] data = action.getData(VcsDataKeys.CHANGE_LISTS);
        diffContent = fromRevisions(project, project.getBaseDir(), ((CommittedChangeList) data[data.length - 1]).getNumber(),
                ((CommittedChangeList) data[0]).getNumber());
    } else {
        final Change[] changes = action.getData(VcsDataKeys.CHANGES);
        diffContent = fromHead(project, project.getBaseDir(), changes);
    }
    return diffContent;
}
 
Example #21
Source File: TFSCheckinEnvironmentTest.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
@Test
public void testScheduleUnversionedFilesForAddition_Happy() {
    List<VirtualFile> mockFiles = setupAdd();
    when(CommandUtils.addFiles(mockServerContext, filePaths)).thenReturn(filePaths);

    List<VcsException> exceptions =
            tfsCheckinEnvironment.scheduleUnversionedFilesForAddition(mockFiles);
    verifyStatic(times(1));
    TfsFileUtil.markFileDirty(any(Project.class), eq(mockFiles.get(0)));
    TfsFileUtil.markFileDirty(any(Project.class), eq(mockFiles.get(1)));
    assertTrue(exceptions.isEmpty());
}
 
Example #22
Source File: ManageWorkspacesModelTest.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
@Test(expected = VcsException.class)
public void testEditWorkspace_NullContext() throws Exception {
    doReturn(workspace1).when(manageWorkspacesModel).getPartialWorkspace(server.getName(), workspace1.getName());
    when(mockServerContextManager.createContextFromTfvcServerUrl(workspace1.getServerUri(), "root", true))
            .thenReturn(null);

    manageWorkspacesModel.editWorkspace(workspace1, mockRunnable);
}
 
Example #23
Source File: VcsBackgroundableComputable.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static <T> void createAndRun(final Project project, @Nullable final VcsBackgroundableActions actionKey,
                               @Nullable final Object actionParameter,
                               final String title,
                               final String errorTitle,
                               final ThrowableComputable<T, VcsException> backgroundable) {
  createAndRun(project, actionKey, actionParameter, title, errorTitle, backgroundable, null, null);
}
 
Example #24
Source File: ManageWorkspacesModelTest.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
@Test
public void testEditWorkspaceWithProgress_Exception() throws Exception {
    when(VcsUtil.runVcsProcessWithProgress(any(VcsRunnable.class), eq(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_EDIT_MSG, workspace1.getName())), eq(true), eq(mockProject)))
            .thenThrow(new VcsException(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_EDIT_ERROR_MSG, workspace1.getName())));
    manageWorkspacesModel.editWorkspaceWithProgress(workspace1, mockRunnable);

    verifyStatic(times(1));
    Messages.showErrorDialog(eq(mockProject), eq(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_EDIT_ERROR_MSG, workspace1.getName())),
            eq(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_EDIT_ERROR_TITLE)));
}
 
Example #25
Source File: ResolveConflictHelper.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
@VisibleForTesting
protected ContentTriplet populateThreeWayDiffWithProgress(final Conflict conflict, final File conflictPath,
                                                          final FilePath localPath, final ServerContext context) throws VcsException {
    final ContentTriplet contentTriplet = new ContentTriplet();
    final VcsRunnable runnable = new VcsRunnable() {
        public void run() throws VcsException {
            populateThreeWayDiff(conflict, conflictPath, localPath, context, contentTriplet);
        }
    };
    VcsUtil.runVcsProcessWithProgress(runnable, TfPluginBundle.message(TfPluginBundle.KEY_TFVC_CONFLICT_MERGE_LOADING), false, project);
    return contentTriplet;
}
 
Example #26
Source File: AmendComponent.java    From consulo with Apache License 2.0 5 votes vote down vote up
@javax.annotation.Nullable
private Map<VirtualFile, String> getLastCommitMessages() throws VcsException {
  Map<VirtualFile, String> messagesForRoots = new HashMap<>();
  // load all vcs roots visible in the commit dialog (not only selected ones), to avoid another loading task if selection changes
  for (VirtualFile root : getAffectedRoots()) {
    String message = getLastCommitMessage(root);
    messagesForRoots.put(root, message);
  }
  return messagesForRoots;
}
 
Example #27
Source File: P4RemoteFileContentRevision.java    From p4ic4idea with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
public String getContent()
        throws VcsException {
    ClientConfig config = clientConfigFactory.get();
    if (getLoader() == null || config == null || config.getClientname() == null) {
        return null;
    }
    return ContentRevisionUtil.getContent(config, getLoader(),
            getFile(), getIntRevisionNumber().getValue(), getCharset());
}
 
Example #28
Source File: VcsHistoryUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static byte[] loadRevisionContent(@Nonnull VcsFileRevision revision) throws VcsException, IOException {
  byte[] content = revision.getContent();
  if (content == null) {
    revision.loadContent();
    content = revision.getContent();
  }
  if (content == null) throw new VcsException("Failed to load content for revision " + revision.getRevisionNumber().asString());
  return content;
}
 
Example #29
Source File: ManageWorkspacesModelTest.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
@Test
public void testDeleteWorkspaceWithProgress_Exception() throws Exception {
    final MockObserver observer = new MockObserver(manageWorkspacesModel);
    when(Messages.showYesNoDialog(mockProject, TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_DELETE_CONFIRM_MSG, workspace1.getName()),
            TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_DELETE_CONFIRM_TITLE), Messages.getWarningIcon())).thenReturn(Messages.YES);
    when(VcsUtil.runVcsProcessWithProgress(any(VcsRunnable.class), eq(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_DELETE_MSG, workspace1.getName())), eq(true), eq(mockProject)))
            .thenThrow(new VcsException(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_DELETE_ERROR_MSG, workspace1.getName())));
    manageWorkspacesModel.deleteWorkspaceWithProgress(workspace1);

    observer.assertAndClearLastUpdate(manageWorkspacesModel, ManageWorkspacesModel.REFRESH_WORKSPACE);
    verifyStatic(times(1));
    Messages.showErrorDialog(eq(mockProject), eq(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_DELETE_ERROR_MSG, workspace1.getName())),
            eq(TfPluginBundle.message(TfPluginBundle.KEY_TFVC_MANAGE_WORKSPACES_DELETE_ERROR_TITLE)));
}
 
Example #30
Source File: TFSDiffProvider.java    From azure-devops-intellij with MIT License 5 votes vote down vote up
public ItemLatestState getLastRevision(final FilePath localPath) {
    try {
        // need to make a file because the FilePath object path is in system-independent format
        final File localFile = localPath.getIOFile();
        final VcsRevisionNumber revisionNumber = getRevisionNumber(localFile.getPath(), localFile.getName());
        if (revisionNumber != VcsRevisionNumber.NULL) {
            return new ItemLatestState(revisionNumber, true, false);
        }
    } catch (final Exception e) {
        logger.warn("Unable to getLastRevision", e);
        AbstractVcsHelper.getInstance(project).showError(
                new VcsException(LocalizationServiceImpl.getInstance().getExceptionMessage(e), e), TFSVcs.TFVC_NAME);
    }
    return new ItemLatestState(VcsRevisionNumber.NULL, false, false);
}