private boolean for17move( final SvnVcs vcs, final File src, final File dst, boolean undo, SVNStatus srcStatus) throws SVNException { if (srcStatus != null && srcStatus.getCopyFromURL() == null) { undo = false; } if (undo) { myUndoingMove = true; createRevertAction(vcs, dst, true).execute(); copyUnversionedMembersOfDirectory(src, dst); if (srcStatus == null || SvnVcs.svnStatusIsUnversioned(srcStatus)) { FileUtil.delete(src); } else { createRevertAction(vcs, src, true).execute(); } restoreFromUndoStorage(dst); } else { if (doUsualMove(vcs, src)) return true; // check destination directory final SVNStatus dstParentStatus = getFileStatus(vcs, dst.getParentFile()); if (dstParentStatus == null || SvnVcs.svnStatusIsUnversioned(dstParentStatus)) { try { copyFileOrDir(src, dst); } catch (IOException e) { throw new SVNException(SVNErrorMessage.create(SVNErrorCode.IO_ERROR, e), e); } createDeleteAction(vcs, src, true).execute(); return false; } moveFileWithSvn(vcs, src, dst); } return false; }
private boolean doMove(@NotNull SvnVcs vcs, final File src, final File dst) { long srcTime = src.lastModified(); try { final boolean isUndo = isUndo(vcs); final String list = isUndo ? null : SvnChangelistListener.getCurrentMapping(vcs, src); WorkingCopyFormat format = vcs.getWorkingCopyFormat(src); final boolean is17OrLater = WorkingCopyFormat.ONE_DOT_EIGHT.equals(format) || WorkingCopyFormat.ONE_DOT_SEVEN.equals(format); if (is17OrLater) { SVNStatus srcStatus = getFileStatus(vcs, src); final File toDir = dst.getParentFile(); SVNStatus dstStatus = getFileStatus(vcs, toDir); final boolean srcUnversioned = srcStatus == null || SvnVcs.svnStatusIsUnversioned(srcStatus); if (srcUnversioned && (dstStatus == null || SvnVcs.svnStatusIsUnversioned(dstStatus))) { return false; } if (srcUnversioned) { SVNStatus dstWasStatus = getFileStatus(vcs, dst); if (dstWasStatus == null || SvnVcs.svnStatusIsUnversioned(dstWasStatus)) { return false; } } if (for17move(vcs, src, dst, isUndo, srcStatus)) return false; } else { if (for16move(vcs, src, dst, isUndo)) return false; } if (!isUndo && list != null) { SvnChangelistListener.putUnderList(vcs.getProject(), list, dst); } dst.setLastModified(srcTime); } catch (SVNException e) { addToMoveExceptions(vcs.getProject(), e); return false; } catch (VcsException e) { addToMoveExceptions(vcs.getProject(), e); return false; } return true; }
private boolean doUsualMove(SvnVcs vcs, File src) { // if src is not under version control, do usual move. SVNStatus srcStatus = getFileStatus(vcs, src); if (srcStatus == null || SvnVcs.svnStatusIsUnversioned(srcStatus) || SvnVcs.svnStatusIs(srcStatus, SVNStatusType.STATUS_OBSTRUCTED) || SvnVcs.svnStatusIs(srcStatus, SVNStatusType.STATUS_MISSING) || SvnVcs.svnStatusIs(srcStatus, SVNStatusType.STATUS_EXTERNAL)) { return true; } return false; }
/** * delete file or directory (both 'undo' and 'do' modes) unversioned: do nothing, return false * obstructed: do nothing, return false external or wc root: do nothing, return false missing: do * nothing, return false * * <p>versioned: schedule for deletion, return true added: schedule for deletion (make * unversioned), return true copied, but not scheduled: schedule for deletion, return true * replaced: schedule for deletion, return true * * <p>deleted: do nothing, return true (strange) */ public boolean delete(VirtualFile file) throws IOException { final SvnVcs vcs = getVCS(file); if (vcs != null && SvnUtil.isAdminDirectory(file)) { return true; } if (vcs == null) return false; final VcsShowConfirmationOption.Value value = vcs.getDeleteConfirmation().getValue(); if (VcsShowConfirmationOption.Value.DO_NOTHING_SILENTLY.equals(value)) return false; final File ioFile = getIOFile(file); if (!SvnUtil.isSvnVersioned(vcs.getProject(), ioFile.getParentFile())) { return false; } if (SvnUtil.isWorkingCopyRoot(ioFile)) { return false; } SVNStatus status = getFileStatus(vcs, ioFile); if (status == null || SvnVcs.svnStatusIsUnversioned(status) || SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_OBSTRUCTED) || SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_MISSING) || SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_EXTERNAL) || SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_IGNORED)) { return false; } else if (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_DELETED)) { if (isUndo(vcs)) { moveToUndoStorage(file); } return true; } else { if (vcs != null) { if (isAboveSourceOfCopyOrMove(vcs.getProject(), ioFile)) { myDeletedFiles.putValue(vcs.getProject(), ioFile); return true; } if (SvnVcs.svnStatusIs(status, SVNStatusType.STATUS_ADDED)) { try { createRevertAction(vcs, ioFile, false).execute(); } catch (SVNException e) { // ignore } } else { myDeletedFiles.putValue(vcs.getProject(), ioFile); // packages deleted from disk should not be deleted from svn (IDEADEV-16066) if (file.isDirectory() || isUndo(vcs)) return true; } } return false; } }