mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 09:25:43 +01:00
fix bug in SvnRepositoryClient
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user