use of org.jetbrains.idea.svn.commandLine.SvnBindException in project intellij-community by JetBrains.
the class SingleCommittedListProvider method searchForUrl.
private boolean searchForUrl(@NotNull SVNURL url) throws VcsException {
LogEntryConsumer handler = logEntry -> {
checkDisposed();
if (logEntry.getDate() != null) {
changeList[0] = createChangeList(logEntry);
}
};
SvnTarget target = SvnTarget.fromURL(url);
try {
myVcs.getFactory(target).createHistoryClient().doLog(target, revisionBefore, revisionBefore, false, true, false, 1, null, handler);
} catch (SvnBindException e) {
LOG.info(e);
if (!e.containsCategory(SVNErrorCode.FS_CATEGORY)) {
throw e;
}
}
return changeList[0] != null;
}
use of org.jetbrains.idea.svn.commandLine.SvnBindException in project intellij-community by JetBrains.
the class SvnChangeProvider method processCopiedFile.
private void processCopiedFile(@NotNull SvnChangedFile copiedFile, @NotNull SvnChangeProviderContext context, @Nullable VcsDirtyScope dirtyScope) throws SVNException {
boolean foundRename = false;
final Status copiedStatus = copiedFile.getStatus();
final String copyFromURL = ObjectUtils.assertNotNull(copiedFile.getCopyFromURL());
final Set<SvnChangedFile> deletedToDelete = new HashSet<>();
for (SvnChangedFile deletedFile : context.getDeletedFiles()) {
final Status deletedStatus = deletedFile.getStatus();
if (deletedStatus.getURL() != null && Comparing.equal(copyFromURL, deletedStatus.getURL().toString())) {
final String clName = SvnUtil.getChangelistName(copiedFile.getStatus());
applyMovedChange(context, copiedFile.getFilePath(), dirtyScope, deletedToDelete, deletedFile, copiedStatus, clName);
for (SvnChangedFile deletedChild : context.getDeletedFiles()) {
final Status childStatus = deletedChild.getStatus();
final SVNURL childUrl = childStatus.getURL();
if (childUrl == null) {
continue;
}
final String childURL = childUrl.toDecodedString();
if (StringUtil.startsWithConcatenation(childURL, copyFromURL, "/")) {
String relativePath = childURL.substring(copyFromURL.length());
File newPath = new File(copiedFile.getFilePath().getIOFile(), relativePath);
FilePath newFilePath = myFactory.createFilePathOn(newPath);
if (!context.isDeleted(newFilePath)) {
applyMovedChange(context, newFilePath, dirtyScope, deletedToDelete, deletedChild, context.getTreeConflictStatus(newPath), clName);
}
}
}
foundRename = true;
break;
}
}
final List<SvnChangedFile> deletedFiles = context.getDeletedFiles();
for (SvnChangedFile file : deletedToDelete) {
deletedFiles.remove(file);
}
// by building a relative url
if (!foundRename && copiedStatus.getURL() != null) {
File wcPath = myVcs.getSvnFileUrlMapping().getLocalPath(copyFromURL);
if (wcPath != null) {
Status status;
try {
status = myVcs.getFactory(wcPath).createStatusClient().doStatus(wcPath, false);
} catch (SvnBindException ex) {
LOG.info(ex);
status = null;
}
if (status != null && status.is(StatusType.STATUS_DELETED)) {
final FilePath filePath = myFactory.createFilePathOnDeleted(wcPath, false);
final SvnContentRevision beforeRevision = SvnContentRevision.createBaseRevision(myVcs, filePath, status.getRevision());
final ContentRevision afterRevision = CurrentContentRevision.create(copiedFile.getFilePath());
context.getBuilder().processChangeInList(context.createMovedChange(beforeRevision, afterRevision, copiedStatus, status), SvnUtil.getChangelistName(status), SvnVcs.getKey());
foundRename = true;
}
}
}
if (!foundRename) {
// for debug
LOG.info("Rename not found for " + copiedFile.getFilePath().getPresentableUrl());
context.processStatus(copiedFile.getFilePath(), copiedStatus);
}
}
use of org.jetbrains.idea.svn.commandLine.SvnBindException in project intellij-community by JetBrains.
the class SvnFileSystemListener method for16move.
private boolean for16move(SvnVcs vcs, final File src, final File dst, final boolean undo) throws VcsException {
final SVNMoveClient mover = vcs.getSvnKitManager().createMoveClient();
if (undo) {
myUndoingMove = true;
restoreFromUndoStorage(dst);
} else if (doUsualMove(vcs, src))
return true;
new RepeatSvnActionThroughBusy() {
@Override
protected void executeImpl() throws VcsException {
try {
if (undo) {
mover.undoMove(src, dst);
} else {
mover.doMove(src, dst);
}
} catch (SVNException e) {
throw new SvnBindException(e);
}
}
}.execute();
return false;
}
use of org.jetbrains.idea.svn.commandLine.SvnBindException in project intellij-community by JetBrains.
the class SvnFileSystemListener method copyUnversionedMembersOfDirectory.
private static void copyUnversionedMembersOfDirectory(final File src, final File dst) throws SvnBindException {
if (src.isDirectory()) {
final SvnBindException[] exc = new SvnBindException[1];
FileUtil.processFilesRecursively(src, file -> {
String relativePath = FileUtil.getRelativePath(src, file);
File newFile = new File(dst, relativePath);
if (!newFile.exists()) {
try {
FileUtil.copyFileOrDir(src, dst);
} catch (IOException e) {
exc[0] = new SvnBindException(e);
return false;
}
}
return true;
});
if (exc[0] != null) {
throw exc[0];
}
}
}
use of org.jetbrains.idea.svn.commandLine.SvnBindException in project intellij-community by JetBrains.
the class CmdDiffClient method parseOutput.
@NotNull
private List<Change> parseOutput(@NotNull SvnTarget target1, @NotNull SvnTarget target2, @NotNull CommandExecutor executor) throws SvnBindException {
try {
DiffInfo diffInfo = CommandUtil.parse(executor.getOutput(), DiffInfo.class);
List<Change> result = ContainerUtil.newArrayList();
if (diffInfo != null) {
for (DiffPath path : diffInfo.diffPaths) {
result.add(createChange(target1, target2, path));
}
}
return result;
} catch (JAXBException e) {
throw new SvnBindException(e);
}
}
Aggregations