summaryrefslogtreecommitdiff
path: root/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java')
-rw-r--r--plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java87
1 files changed, 19 insertions, 68 deletions
diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java
index 20d60a9e50bf..bceb516caef3 100644
--- a/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java
+++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/browse/CmdBrowseClient.java
@@ -21,12 +21,17 @@ import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.svn.api.BaseSvnClient;
+import org.jetbrains.idea.svn.api.Depth;
+import org.jetbrains.idea.svn.api.NodeKind;
import org.jetbrains.idea.svn.checkin.CmdCheckinClient;
+import org.jetbrains.idea.svn.checkin.CommitInfo;
import org.jetbrains.idea.svn.commandLine.CommandExecutor;
import org.jetbrains.idea.svn.commandLine.CommandUtil;
import org.jetbrains.idea.svn.commandLine.SvnBindException;
import org.jetbrains.idea.svn.commandLine.SvnCommandName;
-import org.tmatesoft.svn.core.*;
+import org.jetbrains.idea.svn.lock.Lock;
+import org.tmatesoft.svn.core.SVNException;
+import org.tmatesoft.svn.core.SVNURL;
import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc2.SvnTarget;
@@ -35,7 +40,6 @@ import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
/**
@@ -46,8 +50,8 @@ public class CmdBrowseClient extends BaseSvnClient implements BrowseClient {
@Override
public void list(@NotNull SvnTarget target,
@Nullable SVNRevision revision,
- @Nullable SVNDepth depth,
- @Nullable ISVNDirEntryHandler handler) throws VcsException {
+ @Nullable Depth depth,
+ @Nullable DirectoryEntryConsumer handler) throws VcsException {
assertUrl(target);
List<String> parameters = new ArrayList<String>();
@@ -85,15 +89,15 @@ public class CmdBrowseClient extends BaseSvnClient implements BrowseClient {
return listener.getCommittedRevision();
}
- private static void parseOutput(@NotNull SVNURL url, @NotNull CommandExecutor command, @Nullable ISVNDirEntryHandler handler)
- throws VcsException, SVNException {
+ private static void parseOutput(@NotNull SVNURL url, @NotNull CommandExecutor command, @Nullable DirectoryEntryConsumer handler)
+ throws VcsException, SVNException {
try {
TargetLists lists = CommandUtil.parse(command.getOutput(), TargetLists.class);
if (handler != null && lists != null) {
for (TargetList list : lists.lists) {
for (Entry entry : list.entries) {
- handler.handleDirEntry(entry.toDirEntry(url));
+ handler.consume(entry.toDirectoryEntry(url));
}
}
}
@@ -122,8 +126,8 @@ public class CmdBrowseClient extends BaseSvnClient implements BrowseClient {
public static class Entry {
- @XmlAttribute(name = "kind")
- public String kind;
+ @XmlAttribute(name = "kind", required = true)
+ public NodeKind kind;
@XmlElement(name = "name")
public String name;
@@ -131,68 +135,15 @@ public class CmdBrowseClient extends BaseSvnClient implements BrowseClient {
@XmlElement(name = "size")
public long size;
- @XmlElement(name = "commit")
- public Commit commit;
+ public CommitInfo.Builder commit;
- @XmlElement(name = "lock")
- public Lock lock;
+ public Lock.Builder lock;
- public long revision() {
- return commit != null ? commit.revision : 0;
- }
-
- public String author() {
- return commit != null ? commit.author : "";
- }
-
- public Date date() {
- return commit != null ? commit.date : null;
- }
-
- public SVNDirEntry toDirEntry(@NotNull SVNURL url) throws SVNException {
+ @NotNull
+ public DirectoryEntry toDirectoryEntry(@NotNull SVNURL url) throws SVNException {
// TODO: repository is not used for now
- SVNDirEntry entry =
- new SVNDirEntry(url.appendPath(name, false), null, PathUtil.getFileName(name), SVNNodeKind.parseKind(kind), size, false, revision(),
- date(), author());
-
- entry.setRelativePath(name);
- entry.setLock(lock != null ? lock.toLock(entry.getRelativePath()) : null);
-
- return entry;
- }
- }
-
- public static class Commit {
-
- @XmlAttribute(name = "revision")
- public long revision;
-
- @XmlElement(name = "author")
- public String author;
-
- @XmlElement(name = "date")
- public Date date;
- }
-
- public static class Lock {
-
- @XmlElement(name = "token")
- public String token;
-
- @XmlElement(name = "owner")
- public String owner;
-
- @XmlElement(name = "comment")
- public String comment;
-
- @XmlElement(name = "created")
- public Date created;
-
- @XmlElement(name = "expires")
- public Date expires;
-
- public SVNLock toLock(@NotNull String path) {
- return new SVNLock(path, token, owner, comment, created, expires);
+ return new DirectoryEntry(url.appendPath(name, false), null, PathUtil.getFileName(name), kind,
+ commit != null ? commit.build() : null, name);
}
}
}