use of org.tmatesoft.svn.core.SVNException in project intellij-community by JetBrains.
the class SvnKitMergeClient method merge.
public void merge(@NotNull SvnTarget source, @NotNull File destination, boolean dryRun, boolean reintegrate, @Nullable DiffOptions diffOptions, @Nullable ProgressTracker handler) throws VcsException {
assertUrl(source);
SVNDiffClient client = createClient(diffOptions, handler);
try {
if (reintegrate) {
client.doMergeReIntegrate(source.getURL(), source.getPegRevision(), destination, dryRun);
} else {
client.doMerge(source.getURL(), source.getPegRevision(), ALL_REVISIONS_RANGE, destination, SVNDepth.UNKNOWN, true, false, dryRun, false);
}
} catch (SVNException e) {
throw new VcsException(e);
}
}
use of org.tmatesoft.svn.core.SVNException in project intellij-community by JetBrains.
the class SvnKitAdminAreaFactorySelector method getEnabledFactories.
public Collection getEnabledFactories(File path, Collection factories, boolean writeAccess) throws SVNException {
if (ApplicationManager.getApplication().isUnitTestMode()) {
return factories;
}
if (!writeAccess) {
return factories;
}
Collection result = null;
final WorkingCopyFormat presetFormat = SvnWorkingCopyFormatHolder.getPresetFormat();
if (presetFormat != null) {
result = format2Factories(presetFormat, factories);
}
if (result == null) {
final WorkingCopyFormat format = SvnFormatSelector.getWorkingCopyFormat(path);
result = format2Factories(format, factories);
}
if (result == null) {
throw new SVNException(SVNErrorMessage.create(SVNErrorCode.WC_NOT_DIRECTORY));
}
return result;
}
use of org.tmatesoft.svn.core.SVNException in project intellij-community by JetBrains.
the class SvnAuthenticationManager method checkHostGroup.
public static boolean checkHostGroup(final String url, final String patterns, final String exceptions) {
final SVNURL svnurl;
try {
svnurl = SVNURL.parseURIEncoded(url);
} catch (SVNException e) {
return false;
}
final String host = svnurl.getHost();
return matches(patterns, host) && (!matches(exceptions, host));
}
use of org.tmatesoft.svn.core.SVNException in project intellij-community by JetBrains.
the class SvnKitCheckinClient method commit.
@NotNull
@Override
public CommitInfo[] commit(@NotNull List<File> paths, @NotNull String comment) throws VcsException {
File[] pathsToCommit = ArrayUtil.toObjectArray(paths, File.class);
boolean keepLocks = myVcs.getSvnConfiguration().isKeepLocks();
SVNCommitPacket[] commitPackets = null;
SVNCommitInfo[] results;
SVNCommitClient committer = myVcs.getSvnKitManager().createCommitClient();
IdeaCommitHandler handler = new IdeaCommitHandler(ProgressManager.getInstance().getProgressIndicator(), true, true);
committer.setEventHandler(toEventHandler(handler));
try {
commitPackets = committer.doCollectCommitItems(pathsToCommit, keepLocks, true, SVNDepth.EMPTY, true, null);
results = committer.doCommit(commitPackets, keepLocks, comment);
commitPackets = null;
} catch (SVNException e) {
throw new SvnBindException(e);
} finally {
if (commitPackets != null) {
for (SVNCommitPacket commitPacket : commitPackets) {
try {
commitPacket.dispose();
} catch (SVNException e) {
LOG.info(e);
}
}
}
}
// This seems to be necessary only for SVNKit as changes after command line operations should be detected during VFS refresh.
for (VirtualFile f : handler.getDeletedFiles()) {
f.putUserData(VirtualFile.REQUESTOR_MARKER, this);
}
return convert(results);
}
use of org.tmatesoft.svn.core.SVNException in project intellij-community by JetBrains.
the class SvnCheckoutProvider method checkout.
public static void checkout(final Project project, final File target, final String url, final SVNRevision revision, final Depth depth, final boolean ignoreExternals, final Listener listener, final WorkingCopyFormat selectedFormat) {
final Ref<Boolean> checkoutSuccessful = new Ref<>();
final Exception[] exception = new Exception[1];
final Task.Backgroundable checkoutBackgroundTask = new Task.Backgroundable(project, message("message.title.check.out"), true, VcsConfiguration.getInstance(project).getCheckoutOption()) {
public void run(@NotNull final ProgressIndicator indicator) {
final WorkingCopyFormat format = selectedFormat == null ? UNKNOWN : selectedFormat;
SvnWorkingCopyFormatHolder.setPresetFormat(format);
SvnVcs vcs = SvnVcs.getInstance(project);
ProgressTracker handler = new CheckoutEventHandler(vcs, false, ProgressManager.getInstance().getProgressIndicator());
ProgressManager.progress(message("progress.text.checking.out", target.getAbsolutePath()));
try {
getFactory(vcs, format).createCheckoutClient().checkout(SvnTarget.fromURL(SVNURL.parseURIEncoded(url)), target, revision, depth, ignoreExternals, true, format, handler);
ProgressManager.checkCanceled();
checkoutSuccessful.set(Boolean.TRUE);
} catch (SVNCancelException ignore) {
} catch (SVNException | VcsException e) {
exception[0] = e;
} finally {
SvnWorkingCopyFormatHolder.setPresetFormat(null);
}
}
public void onCancel() {
onSuccess();
}
public void onSuccess() {
if (exception[0] != null) {
showErrorDialog(message("message.text.cannot.checkout", exception[0].getMessage()), message("message.title.check.out"));
}
VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(target);
if (vf != null) {
vf.refresh(true, true, () -> getApplication().invokeLater(() -> notifyListener()));
} else {
notifyListener();
}
}
private void notifyListener() {
notifyRootManagerIfUnderProject(project, target);
if (listener != null) {
if (!checkoutSuccessful.isNull()) {
listener.directoryCheckedOut(target, SvnVcs.getKey());
}
listener.checkoutCompleted();
}
}
};
ProgressManager.getInstance().run(checkoutBackgroundTask);
}
Aggregations