use of org.jetbrains.idea.svn.commandLine.SvnBindException in project intellij-community by JetBrains.
the class ChangesChecker method gather.
public void gather(final List<Change> changes) {
final TreeMap<String, File> renames = new TreeMap<>();
final Set<String> alsoReverted = new HashSet<>();
final Map<String, FilePath> files = new HashMap<>();
for (Change change : changes) {
final ContentRevision beforeRevision = change.getBeforeRevision();
final ContentRevision afterRevision = change.getAfterRevision();
final String key = afterRevision == null ? null : FilePathsHelper.convertWithLastSeparator(afterRevision.getFile());
if (SvnRollbackEnvironment.isMoveRenameReplace(change)) {
final File beforeFile = beforeRevision.getFile().getIOFile();
renames.put(key, beforeFile);
files.put(key, afterRevision.getFile());
myCollector.markRename(beforeFile, afterRevision.getFile().getIOFile());
} else if (afterRevision != null) {
alsoReverted.add(key);
}
}
if (!renames.isEmpty()) {
final ArrayList<String> paths = new ArrayList<>(renames.keySet());
if (paths.size() > 1) {
FilterFilePathStrings.getInstance().doFilter(paths);
}
myCollector.setRenamesMap(renames);
myCollector.setAlsoReverted(alsoReverted);
for (String path : paths) {
try {
myChangeProvider.getChanges(files.get(path), true, myCollector);
} catch (SVNException e) {
myExceptions.add(new VcsException(e));
} catch (SvnBindException e) {
myExceptions.add(e);
}
}
}
for (Change change : changes) {
final ContentRevision afterRevision = change.getAfterRevision();
boolean checked = myForAdds.accept(change);
checked |= myForDeletes.accept(change);
if (!checked) {
myForEdits.add(afterRevision.getFile().getIOFile());
}
}
}
use of org.jetbrains.idea.svn.commandLine.SvnBindException in project intellij-community by JetBrains.
the class SvnKitBrowseClient method list.
@Override
public void list(@NotNull SvnTarget target, @Nullable SVNRevision revision, @Nullable Depth depth, @Nullable DirectoryEntryConsumer handler) throws VcsException {
assertUrl(target);
SVNLogClient client = getLogClient();
ISVNDirEntryHandler wrappedHandler = wrapHandler(handler);
client.setIgnoreExternals(true);
try {
if (target.isFile()) {
client.doList(target.getFile(), target.getPegRevision(), notNullize(revision), true, toDepth(depth), SVNDirEntry.DIRENT_ALL, wrappedHandler);
} else {
client.doList(target.getURL(), target.getPegRevision(), notNullize(revision), true, toDepth(depth), SVNDirEntry.DIRENT_ALL, wrappedHandler);
}
} catch (SVNException e) {
throw new SvnBindException(e);
}
}
use of org.jetbrains.idea.svn.commandLine.SvnBindException 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.jetbrains.idea.svn.commandLine.SvnBindException in project intellij-community by JetBrains.
the class CreateBranchOrTagAction method perform.
@Override
protected void perform(@NotNull SvnVcs vcs, @NotNull VirtualFile file, @NotNull DataContext context) throws VcsException {
CreateBranchOrTagDialog dialog = new CreateBranchOrTagDialog(vcs.getProject(), true, virtualToIoFile(file));
if (dialog.showAndGet()) {
String dstURL = dialog.getToURL();
SVNRevision revision = dialog.getRevision();
String comment = dialog.getComment();
Ref<Exception> exception = new Ref<>();
boolean isSrcFile = dialog.isCopyFromWorkingCopy();
File srcFile = new File(dialog.getCopyFromPath());
SVNURL srcUrl;
SVNURL dstSvnUrl;
SVNURL parentUrl;
try {
srcUrl = SVNURL.parseURIEncoded(dialog.getCopyFromUrl());
dstSvnUrl = SVNURL.parseURIEncoded(dstURL);
parentUrl = dstSvnUrl.removePathTail();
} catch (SVNException e) {
throw new SvnBindException(e);
}
if (!dirExists(vcs, parentUrl)) {
int rc = Messages.showYesNoDialog(vcs.getProject(), "The repository path '" + parentUrl + "' does not exist. Would you like to create it?", "Branch or Tag", Messages.getQuestionIcon());
if (rc == Messages.NO) {
return;
}
}
Runnable copyCommand = () -> {
try {
ProgressIndicator progress = ProgressManager.getInstance().getProgressIndicator();
CommitEventHandler handler = null;
if (progress != null) {
progress.setText(SvnBundle.message("progress.text.copy.to", dstURL));
handler = new IdeaCommitHandler(progress);
}
SvnTarget source = isSrcFile ? SvnTarget.fromFile(srcFile, revision) : SvnTarget.fromURL(srcUrl, revision);
long newRevision = vcs.getFactory(source).createCopyMoveClient().copy(source, SvnTarget.fromURL(dstSvnUrl), revision, true, false, comment, handler);
updateStatusBar(newRevision, vcs.getProject());
} catch (Exception e) {
exception.set(e);
}
};
ProgressManager.getInstance().runProcessWithProgressSynchronously(copyCommand, SvnBundle.message("progress.title.copy"), false, vcs.getProject());
if (!exception.isNull()) {
throw new VcsException(exception.get());
}
if (dialog.isCopyFromWorkingCopy() && dialog.isSwitchOnCreate()) {
SingleRootSwitcher switcher = new SingleRootSwitcher(vcs.getProject(), VcsUtil.getFilePath(srcFile, srcFile.isDirectory()), dstSvnUrl);
AutoSvnUpdater.run(switcher, SvnBundle.message("action.name.switch"));
}
}
}
use of org.jetbrains.idea.svn.commandLine.SvnBindException in project intellij-community by JetBrains.
the class SvnKitCopyMoveClient method copy.
@Override
public void copy(@NotNull SvnTarget source, @NotNull File destination, @Nullable SVNRevision revision, boolean makeParents, @Nullable ProgressTracker handler) throws VcsException {
SVNCopyClient client = myVcs.getSvnKitManager().createCopyClient();
client.setEventHandler(toEventHandler(handler));
try {
client.doCopy(new SVNCopySource[] { createCopySource(source, revision) }, destination, false, makeParents, true);
} catch (SVNException e) {
throw new SvnBindException(e);
}
}
Aggregations