use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class HgUpdateTest method updateShouldMergeButNotCommitWithConflicts.
@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));
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class HgUpdateTest method localChangesShouldBeAllowedWithFastForwardUpdate.
@Test
public void localChangesShouldBeAllowedWithFastForwardUpdate() throws Exception {
createFileInCommand(projectRepoVirtualFile.findChild("com"), "b.txt", "other file");
runHg(projectRepo, "commit", "-m", "adding second file");
runHg(projectRepo, "push");
runHg(remoteRepo, "update");
changeFile_A_AndCommitInRemoteRepository();
fillFile(projectRepo, new String[] { "com", "b.txt" }, "local change");
createFileInCommand(projectRepoVirtualFile.findChild("com"), "c.txt", "other file");
assertIsChanged(HgFileStatusEnum.MODIFIED, "com", "b.txt");
assertIsChanged(HgFileStatusEnum.ADDED, "com", "c.txt");
PreUpdateInformation information = new PreUpdateInformation().getPreUpdateInformation();
HgRevisionNumber incomingHead = information.getIncomingHead();
List<VcsException> nonFatalWarnings = updateThroughPlugin();
assertTrue(nonFatalWarnings.isEmpty());
HgRevisionNumber parentAfterUpdate = new HgParentsCommand(myProject).executeInCurrentThread(projectRepoVirtualFile).get(0);
assertEquals(incomingHead, parentAfterUpdate);
assertIsChanged(HgFileStatusEnum.MODIFIED, "com", "b.txt");
assertIsChanged(HgFileStatusEnum.ADDED, "com", "c.txt");
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class SvnKitDeleteClient method delete.
@Override
public void delete(@NotNull File path, boolean force, boolean dryRun, @Nullable ProgressTracker handler) throws VcsException {
SVNWCClient client = myVcs.getSvnKitManager().createWCClient();
client.setEventHandler(toEventHandler(handler));
try {
client.doDelete(path, force, dryRun);
} catch (SVNException e) {
throw new VcsException(e);
}
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class DiffContentRevision method getContentAsBytes.
@NotNull
@Override
public byte[] getContentAsBytes() throws VcsException {
if (myContents == null) {
BufferExposingByteArrayOutputStream bos = new BufferExposingByteArrayOutputStream(2048);
try {
myRepository.getFile(myPath, -1, null, bos);
myRepository.closeSession();
} catch (SVNException e) {
throw new VcsException(e);
}
myContents = bos.toByteArray();
}
return myContents;
}
use of com.intellij.openapi.vcs.VcsException in project intellij-community by JetBrains.
the class ElementWithBranchComparer method run.
public void run() {
new Task.Modal(myProject, getTitle(), true) {
@Override
public void run(@NotNull ProgressIndicator indicator) {
try {
beforeCompare();
myElementUrl = resolveElementUrl();
if (myElementUrl == null) {
reportNotFound();
} else {
compare();
}
} catch (SVNCancelException ex) {
ElementWithBranchComparer.this.onCancel();
} catch (SVNException ex) {
reportException(new SvnBindException(ex));
} catch (SvnBindException ex) {
reportException(ex);
} catch (VcsException ex) {
reportGeneralException(ex);
}
}
}.queue();
showResult();
}
Aggregations