fix bug in SvnRepositoryClient

This commit is contained in:
Sebastian Sdorra
2011-10-19 10:30:16 +02:00
parent f1752c0403
commit a67abfa5fe

View File

@@ -44,13 +44,13 @@ import org.tmatesoft.svn.core.wc.SVNClientManager;
import org.tmatesoft.svn.core.wc.SVNCommitClient; import org.tmatesoft.svn.core.wc.SVNCommitClient;
import org.tmatesoft.svn.core.wc.SVNRevision; import org.tmatesoft.svn.core.wc.SVNRevision;
import org.tmatesoft.svn.core.wc.SVNUpdateClient; import org.tmatesoft.svn.core.wc.SVNUpdateClient;
import org.tmatesoft.svn.core.wc.SVNWCClient;
//~--- JDK imports ------------------------------------------------------------ //~--- JDK imports ------------------------------------------------------------
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
/** /**
@@ -107,14 +107,24 @@ public class SvnRepositoryClient extends AbstractRepositoryClient
public void add(String file, String... others) public void add(String file, String... others)
throws RepositoryClientException throws RepositoryClientException
{ {
files.add(file); checkout();
List<File> files = new ArrayList<File>();
files.add(new File(localRepository, file));
if (others != null) if (others != null)
{ {
files.addAll(Arrays.asList(others)); for (String f : others)
{
files.add(new File(localRepository, f));
} }
} }
addFiles(files);
pendingFiles.addAll(files);
}
/** /**
* Method description * Method description
* *
@@ -155,13 +165,9 @@ public class SvnRepositoryClient extends AbstractRepositoryClient
try try
{ {
for (String name : files) cc.doCommit(pendingFiles.toArray(new File[0]), true, message, null, null,
{ true, true, SVNDepth.INFINITY);
File file = new File(localRepository, name); pendingFiles.clear();
cc.doImport(file, remoteRepositoryURL.appendPath(name, true), message,
null, false, true, SVNDepth.FILES);
}
} }
catch (SVNException ex) catch (SVNException ex)
{ {
@@ -182,14 +188,38 @@ public class SvnRepositoryClient extends AbstractRepositoryClient
// do nothing // do nothing
} }
/**
* Method description
*
*
*
* @param files
*
* @throws RepositoryClientException
*/
private void addFiles(List<File> files) throws RepositoryClientException
{
SVNWCClient wClient = client.getWCClient();
try
{
wClient.doAdd(files.toArray(new File[0]), true, false, false,
SVNDepth.INFINITY, false, false, false);
}
catch (SVNException ex)
{
throw new RepositoryClientException(ex);
}
}
//~--- fields --------------------------------------------------------------- //~--- fields ---------------------------------------------------------------
/** Field description */
List<File> pendingFiles = new ArrayList<File>();
/** Field description */ /** Field description */
private SVNClientManager client; private SVNClientManager client;
/** Field description */
private List<String> files = new ArrayList<String>();
/** Field description */ /** Field description */
private SVNURL remoteRepositoryURL; private SVNURL remoteRepositoryURL;
} }