summaryrefslogtreecommitdiff
path: root/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java')
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java71
1 files changed, 37 insertions, 34 deletions
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java
index 45b28e34b3d0..1b1cd00589d0 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnRecursiveStatusWalker.java
@@ -31,16 +31,16 @@ import com.intellij.util.Processor;
import com.intellij.vcsUtil.VcsUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.commandLine.SvnBindException;
+import org.jetbrains.idea.svn.status.Status;
import org.jetbrains.idea.svn.status.StatusClient;
-import org.tmatesoft.svn.core.SVNDepth;
+import org.jetbrains.idea.svn.status.StatusConsumer;
+import org.jetbrains.idea.svn.status.StatusType;
import org.tmatesoft.svn.core.SVNErrorCode;
import org.tmatesoft.svn.core.SVNException;
-import org.tmatesoft.svn.core.SVNNodeKind;
import org.tmatesoft.svn.core.internal.wc.SVNFileUtil;
-import org.tmatesoft.svn.core.wc.ISVNStatusHandler;
import org.tmatesoft.svn.core.wc.SVNRevision;
-import org.tmatesoft.svn.core.wc.SVNStatus;
-import org.tmatesoft.svn.core.wc.SVNStatusType;
import java.io.File;
import java.util.LinkedList;
@@ -63,7 +63,7 @@ public class SvnRecursiveStatusWalker {
myHandler = new MyHandler();
}
- public void go(final FilePath rootPath, final SVNDepth depth) throws SVNException {
+ public void go(final FilePath rootPath, final Depth depth) throws SvnBindException {
final MyItem root = createItem(rootPath, depth, false);
myQueue.add(root);
@@ -81,23 +81,26 @@ public class SvnRecursiveStatusWalker {
client.doStatus(ioFile, SVNRevision.WORKING, item.getDepth(), false, false, true, true, myHandler, null);
myHandler.checkIfCopyRootWasReported(null, ioFile);
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
handleStatusException(item, path, e);
}
} else {
try {
- final SVNStatus status = item.getClient().doStatus(ioFile, false, false);
+ final Status status = item.getClient().doStatus(ioFile, false);
myReceiver.process(path, status);
- } catch (SVNException e) {
+ }
+ catch (SvnBindException e) {
handleStatusException(item, path, e);
}
+ catch (SVNException e) {
+ handleStatusException(item, path, new SvnBindException(e));
+ }
}
}
}
- private void handleStatusException(MyItem item, FilePath path, SVNException e) throws SVNException {
- final SVNErrorCode errorCode = e.getErrorMessage().getErrorCode();
- if (SVNErrorCode.WC_NOT_DIRECTORY.equals(errorCode) || SVNErrorCode.WC_NOT_FILE.equals(errorCode)) {
+ private void handleStatusException(MyItem item, FilePath path, SvnBindException e) throws SvnBindException {
+ if (e.contains(SVNErrorCode.WC_NOT_DIRECTORY) || e.contains(SVNErrorCode.WC_NOT_FILE)) {
final VirtualFile virtualFile = path.getVirtualFile();
if (virtualFile != null) {
if (! myPartner.isExcluded(virtualFile)) {
@@ -116,11 +119,11 @@ public class SvnRecursiveStatusWalker {
private static class MyItem {
@NotNull private final FilePath myPath;
- @NotNull private final SVNDepth myDepth;
+ @NotNull private final Depth myDepth;
@NotNull private final StatusClient myStatusClient;
private final boolean myIsInnerCopyRoot;
- private MyItem(@NotNull FilePath path, @NotNull SVNDepth depth, boolean isInnerCopyRoot, @NotNull StatusClient statusClient) {
+ private MyItem(@NotNull FilePath path, @NotNull Depth depth, boolean isInnerCopyRoot, @NotNull StatusClient statusClient) {
myPath = path;
myDepth = depth;
myStatusClient = statusClient;
@@ -133,7 +136,7 @@ public class SvnRecursiveStatusWalker {
}
@NotNull
- public SVNDepth getDepth() {
+ public Depth getDepth() {
return myDepth;
}
@@ -147,13 +150,13 @@ public class SvnRecursiveStatusWalker {
}
}
- private void processRecursively(final VirtualFile vFile, final SVNDepth prevDepth) {
- if (SVNDepth.EMPTY.equals(prevDepth)) return;
+ private void processRecursively(final VirtualFile vFile, final Depth prevDepth) {
+ if (Depth.EMPTY.equals(prevDepth)) return;
if (myPartner.isIgnoredIdeaLevel(vFile)) {
myReceiver.processIgnored(vFile);
return;
}
- final SVNDepth newDepth = SVNDepth.INFINITY.equals(prevDepth) ? SVNDepth.INFINITY : SVNDepth.EMPTY;
+ final Depth newDepth = Depth.INFINITY.equals(prevDepth) ? Depth.INFINITY : Depth.EMPTY;
final File ioFile = new File(vFile.getPath());
final Processor<File> processor;
@@ -180,7 +183,7 @@ public class SvnRecursiveStatusWalker {
return true;
}
};
- if (SVNDepth.EMPTY.equals(newDepth)) {
+ if (Depth.EMPTY.equals(newDepth)) {
directoryFilter = Processor.TRUE;
processor = new Processor<File>() {
@Override
@@ -205,14 +208,14 @@ public class SvnRecursiveStatusWalker {
}
@NotNull
- private MyItem createItem(@NotNull FilePath path, @NotNull SVNDepth depth, boolean isInnerCopyRoot) {
+ private MyItem createItem(@NotNull FilePath path, @NotNull Depth depth, boolean isInnerCopyRoot) {
StatusClient statusClient =
myVcs.getFactory(path.getIOFile()).createStatusClient(myPartner.getFileProvider(), myPartner.getEventHandler());
return new MyItem(path, depth, isInnerCopyRoot, statusClient);
}
- private class MyHandler implements ISVNStatusHandler {
+ private class MyHandler implements StatusConsumer {
private MyItem myCurrentItem;
private boolean myMetCurrentItem;
@@ -221,37 +224,36 @@ public class SvnRecursiveStatusWalker {
myMetCurrentItem = false;
}
- public void checkIfCopyRootWasReported(@Nullable final SVNStatus ioFileStatus, final File ioFile) {
+ public void checkIfCopyRootWasReported(@Nullable final Status ioFileStatus, final File ioFile) {
File itemFile = myCurrentItem.getPath().getIOFile();
if (! myMetCurrentItem && FileUtil.filesEqual(ioFile, itemFile)) {
myMetCurrentItem = true;
- SVNStatus statusInner;
+ Status statusInner;
try {
- statusInner = ioFileStatus != null ? ioFileStatus :
- myCurrentItem.getClient().doStatus(itemFile, false);
+ statusInner = ioFileStatus != null ? ioFileStatus : myCurrentItem.getClient().doStatus(itemFile, false);
}
- catch (SVNException e) {
+ catch (SvnBindException e) {
LOG.info(e);
statusInner = null;
}
if (statusInner == null) return;
- final SVNStatusType status = statusInner.getNodeStatus();
+ final StatusType status = statusInner.getNodeStatus();
final VirtualFile vf = myCurrentItem.getPath().getVirtualFile();
- if (SVNStatusType.STATUS_IGNORED.equals(status)) {
+ if (StatusType.STATUS_IGNORED.equals(status)) {
if (vf != null) {
myReceiver.processIgnored(vf);
}
return;
}
- if (SVNStatusType.STATUS_UNVERSIONED.equals(status) || SVNStatusType.UNKNOWN.equals(status)) {
+ if (StatusType.STATUS_UNVERSIONED.equals(status) || StatusType.UNKNOWN.equals(status)) {
if (vf != null) {
myReceiver.processUnversioned(vf);
processRecursively(vf, myCurrentItem.getDepth());
}
return;
}
- if (SVNStatusType.OBSTRUCTED.equals(status) || SVNStatusType.STATUS_NONE.equals(status)) {
+ if (StatusType.OBSTRUCTED.equals(status) || StatusType.STATUS_NONE.equals(status)) {
return;
}
if (vf != null) {
@@ -264,7 +266,8 @@ public class SvnRecursiveStatusWalker {
}
}
- public void handleStatus(final SVNStatus status) throws SVNException {
+ @Override
+ public void consume(final Status status) throws SVNException {
myPartner.checkCanceled();
final File ioFile = status.getFile();
checkIfCopyRootWasReported(status, ioFile);
@@ -282,20 +285,20 @@ public class SvnRecursiveStatusWalker {
}
if (myProject.isDisposed()) throw new ProcessCanceledException();
- if ((vFile != null) && (SvnVcs.svnStatusIsUnversioned(status))) {
+ if ((vFile != null) && (status.is(StatusType.STATUS_UNVERSIONED))) {
if (vFile.isDirectory()) {
if (FileUtil.filesEqual(myCurrentItem.getPath().getIOFile(), ioFile)) {
//myReceiver.processUnversioned(vFile);
//processRecursively(vFile, myCurrentItem.getDepth());
} else {
- final MyItem childItem = createItem(new FilePathImpl(vFile), SVNDepth.INFINITY, true);
+ final MyItem childItem = createItem(new FilePathImpl(vFile), Depth.INFINITY, true);
myQueue.add(childItem);
}
} else {
myReceiver.processUnversioned(vFile);
}
} else {
- final FilePath path = VcsUtil.getFilePath(ioFile, status.getKind().equals(SVNNodeKind.DIR));
+ final FilePath path = VcsUtil.getFilePath(ioFile, status.getKind().isDirectory());
myReceiver.process(path, status);
}
}