libnb-svnclientadapter-java-6.7.orig/ 0000755 0000000 0000000 00000000000 11240243242 016366 5 ustar root root libnb-svnclientadapter-java-6.7.orig/.project 0000644 0000000 0000000 00000000567 10260370556 020057 0 ustar root root
* - when ignoreExternals is set to false during call to status(),
* besides the "external" status, second status with url and all fields is returned too,
* but this one has textStatus NORMAL)
*/
public static class JhlStatusExternal extends JhlStatus
{
private String url;
/**
* Constructor
* @param status
*/
public JhlStatusExternal(JhlStatus status) {
this(status, null);
}
/**
* Constructor
* @param status
* @param url
*/
public JhlStatusExternal(JhlStatus status, String url) {
super(status._s);
this.url = url;
}
public SVNStatusKind getTextStatus() {
return SVNStatusKind.EXTERNAL;
}
public String getUrlString()
{
return (url != null) ? url : super.getUrlString();
}
}
}
././@LongLink 0000000 0000000 0000000 00000000174 00000000000 011567 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/AbstractJhlClientAdapter.java libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/Abstra0000644 0000000 0000000 00000332125 11164227655 032710 0 ustar root root /*******************************************************************************
* Copyright (c) 2005, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.javahl;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import org.tigris.subversion.javahl.ClientException;
import org.tigris.subversion.javahl.CopySource;
import org.tigris.subversion.javahl.Depth;
import org.tigris.subversion.javahl.ErrorCodes;
import org.tigris.subversion.javahl.Info;
import org.tigris.subversion.javahl.Info2;
import org.tigris.subversion.javahl.Mergeinfo;
import org.tigris.subversion.javahl.PromptUserPassword;
import org.tigris.subversion.javahl.PropertyData;
import org.tigris.subversion.javahl.Revision;
import org.tigris.subversion.javahl.RevisionKind;
import org.tigris.subversion.javahl.RevisionRange;
import org.tigris.subversion.javahl.SVNClientInterface;
import org.tigris.subversion.javahl.Status;
import org.tigris.subversion.javahl.StatusCallback;
import org.tigris.subversion.javahl.SubversionException;
import org.tigris.subversion.svnclientadapter.AbstractClientAdapter;
import org.tigris.subversion.svnclientadapter.ISVNAnnotations;
import org.tigris.subversion.svnclientadapter.ISVNClientAdapter;
import org.tigris.subversion.svnclientadapter.ISVNConflictResolver;
import org.tigris.subversion.svnclientadapter.ISVNDirEntry;
import org.tigris.subversion.svnclientadapter.ISVNInfo;
import org.tigris.subversion.svnclientadapter.ISVNLogMessage;
import org.tigris.subversion.svnclientadapter.ISVNLogMessageCallback;
import org.tigris.subversion.svnclientadapter.ISVNMergeInfo;
import org.tigris.subversion.svnclientadapter.ISVNMergeinfoLogKind;
import org.tigris.subversion.svnclientadapter.ISVNNotifyListener;
import org.tigris.subversion.svnclientadapter.ISVNProgressListener;
import org.tigris.subversion.svnclientadapter.ISVNPromptUserPassword;
import org.tigris.subversion.svnclientadapter.ISVNProperty;
import org.tigris.subversion.svnclientadapter.ISVNStatus;
import org.tigris.subversion.svnclientadapter.SVNBaseDir;
import org.tigris.subversion.svnclientadapter.SVNClientException;
import org.tigris.subversion.svnclientadapter.SVNDiffSummary;
import org.tigris.subversion.svnclientadapter.SVNInfoUnversioned;
import org.tigris.subversion.svnclientadapter.SVNLogMessageCallback;
import org.tigris.subversion.svnclientadapter.SVNNodeKind;
import org.tigris.subversion.svnclientadapter.SVNNotificationHandler;
import org.tigris.subversion.svnclientadapter.SVNRevision;
import org.tigris.subversion.svnclientadapter.SVNRevisionRange;
import org.tigris.subversion.svnclientadapter.SVNScheduleKind;
import org.tigris.subversion.svnclientadapter.SVNStatusKind;
import org.tigris.subversion.svnclientadapter.SVNStatusUnversioned;
import org.tigris.subversion.svnclientadapter.SVNUrl;
import org.tigris.subversion.svnclientadapter.utils.Messages;
/**
* This is a base class for the JavaHL Adapter. It allows the JavaHL
* Adapter and the SVNKit Adapter to share most of their implementation.
*
* The SVNKit Adapter works by providing an implementation of the JavaHL
* SVNClientInterface.
*
*/
public abstract class AbstractJhlClientAdapter extends AbstractClientAdapter {
protected SVNClientInterface svnClient;
protected JhlNotificationHandler notificationHandler;
protected JhlConflictResolver conflictResolver;
protected JhlProgressListener progressListener;
public AbstractJhlClientAdapter() {
}
/**
* for users who want to directly use underlying javahl SVNClientInterface
* @return the SVNClientInterface instance
*/
public SVNClientInterface getSVNClient() {
return svnClient;
}
/**
* the default prompter : never prompts the user
*/
public static class DefaultPromptUserPassword implements PromptUserPassword {
public String askQuestion(String realm, String question, boolean showAnswer) {
return "";
}
public boolean askYesNo(String realm, String question, boolean yesIsDefault) {
return yesIsDefault;
}
public String getPassword() {
return "";
}
public String getUsername() {
return "";
}
public boolean prompt(String realm, String username) {
return false;
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#addNotifyListener(org.tigris.subversion.svnclientadapter.ISVNNotifyListener)
*/
public void addNotifyListener(ISVNNotifyListener listener) {
notificationHandler.add(listener);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#removeNotifyListener(org.tigris.subversion.svnclientadapter.ISVNNotifyListener)
*/
public void removeNotifyListener(ISVNNotifyListener listener) {
notificationHandler.remove(listener);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getNotificationHandler()
*/
public SVNNotificationHandler getNotificationHandler() {
return notificationHandler;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#setUsername(java.lang.String)
*/
public void setUsername(String username) {
svnClient.username(username);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#setPassword(java.lang.String)
*/
public void setPassword(String password) {
notificationHandler.setCommand(ISVNNotifyListener.Command.UNDEFINED);
svnClient.password(password);
}
/**
* Register callback interface to supply username and password on demand
* @param prompt
*/
public void setPromptUserPassword(PromptUserPassword prompt) {
svnClient.setPrompt(prompt);
}
protected static String fileToSVNPath(File file, boolean canonical) {
if (file == null) return null;
// SVN need paths with '/' separators
if (canonical) {
try {
return file.getCanonicalPath().replace('\\', '/');
} catch (IOException e)
{
return null;
}
} else
return file.getPath().replace('\\', '/');
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#addFile(java.io.File)
*/
public void addFile(File file) throws SVNClientException {
try{
notificationHandler.setCommand(ISVNNotifyListener.Command.ADD);
notificationHandler.logCommandLine("add -N "+file.toString());
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(file));
svnClient.add(fileToSVNPath(file, false), false);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#addDirectory(java.io.File, boolean)
*/
public void addDirectory(File file, boolean recurse) throws SVNClientException {
addDirectory(file, recurse, false);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#addDirectory(java.io.File, boolean, boolean)
*/
public void addDirectory(File dir, boolean recurse, boolean force)
throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.ADD);
notificationHandler.logCommandLine(
"add"+
(recurse?"":" -N")+
(force?" --force":"")+
" "+dir.toString());
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(dir));
svnClient.add(fileToSVNPath(dir, false), recurse, force);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#checkout(org.tigris.subversion.svnclientadapter.SVNUrl, java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, boolean)
*/
public void checkout(
SVNUrl moduleName,
File destPath,
SVNRevision revision,
boolean recurse)
throws SVNClientException {
checkout(moduleName, destPath, revision, Depth.infinityOrImmediates(recurse), false, true);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#checkout(org.tigris.subversion.svnclientadapter.SVNUrl, java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, int, boolean, boolean)
*/
public void checkout(
SVNUrl moduleName,
File destPath,
SVNRevision revision,
int depth,
boolean ignoreExternals,
boolean force)
throws SVNClientException {
try {
String url = moduleName.toString();
notificationHandler.setCommand(ISVNNotifyListener.Command.CHECKOUT);
StringBuffer commandLine = new StringBuffer("checkout " + url +
" -r " + revision.toString() + depthCommandLine(depth));
if (ignoreExternals) commandLine.append(" --ignore-externals");
if (force) commandLine.append(" --force");
notificationHandler.logCommandLine(commandLine.toString());
notificationHandler.setBaseDir(new File("."));
svnClient.checkout(
url,
fileToSVNPath(destPath, false),
JhlConverter.convert(revision),
JhlConverter.convert(revision),
depth,
ignoreExternals,
force);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#commit(java.io.File[], java.lang.String, boolean)
*/
public long commit(File[] paths, String message, boolean recurse)
throws SVNClientException {
return commit(paths, message, recurse, false);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#commit(java.io.File[], java.lang.String, boolean, boolean)
*/
public long commit(File[] paths, String message, boolean recurse, boolean keepLocks)
throws SVNClientException {
try {
String fixedMessage = fixSVNString(message);
if (fixedMessage == null)
fixedMessage = "";
notificationHandler.setCommand(ISVNNotifyListener.Command.COMMIT);
String[] files = new String[paths.length];
String commandLine = "commit -m \""+getFirstMessageLine(fixedMessage)+"\"";
if (!recurse)
commandLine+=" -N";
if (keepLocks)
commandLine+=" --no-unlock";
for (int i = 0; i < paths.length; i++) {
files[i] = fileToSVNPath(paths[i], false);
}
commandLine = appendPaths(commandLine, files);
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(paths));
long newRev = svnClient.commit(files, fixedMessage, recurse, keepLocks);
if (newRev > 0)
notificationHandler.logCompleted("Committed revision " + newRev + ".");
return newRev;
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getList(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, boolean)
*/
public ISVNDirEntry[] getList(SVNUrl url, SVNRevision revision, boolean recurse)
throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.LS);
String commandLine = "list -r "+revision.toString()+(recurse?"-R":"")+" "+url.toString();
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir(new File("."));
return JhlConverter.convert(svnClient.list(url.toString(), JhlConverter.convert(revision), recurse));
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getList(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, boolean)
*/
public ISVNDirEntry[] getList(SVNUrl url, SVNRevision revision, SVNRevision pegRevision, boolean recurse)
throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.LS);
String commandLine = "list -r "+revision.toString()+(recurse?"-R":"")+" "+url.toString();
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir(new File("."));
return JhlConverter.convert(svnClient.list(url.toString(), JhlConverter.convert(revision), JhlConverter.convert(pegRevision), recurse));
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getList(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, boolean)
*/
public ISVNDirEntry[] getList(File path, SVNRevision revision, boolean recurse)
throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.LS);
String target = fileToSVNPath(path, false);
String commandLine = "list -r "+revision.toString()+(recurse?"-R":"")+" "+path;
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir(new File("."));
return JhlConverter.convert(svnClient.list(target, JhlConverter.convert(revision), recurse));
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getList(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, boolean)
*/
public ISVNDirEntry[] getList(File path, SVNRevision revision, SVNRevision pegRevision, boolean recurse)
throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.LS);
String target = fileToSVNPath(path, false);
String commandLine = "list -r "+revision.toString()+(recurse?"-R":"")+" "+path;
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir(new File("."));
return JhlConverter.convert(svnClient.list(target, JhlConverter.convert(revision), JhlConverter.convert(pegRevision), recurse));
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/*
* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getDirEntry(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision)
*/
public ISVNDirEntry getDirEntry(SVNUrl url, SVNRevision revision)
throws SVNClientException {
// list give the DirEntrys of the elements of a directory or the DirEntry
// of a file
ISVNDirEntry[] entries = getList(url.getParent(), revision,false);
String expectedPath = url.getLastPathSegment();
for (int i = 0; i < entries.length;i++) {
if (entries[i].getPath().equals(expectedPath)) {
return entries[i];
}
}
return null; // not found
}
/*
* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getDirEntry(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision)
*/
public ISVNDirEntry getDirEntry(File path, SVNRevision revision)
throws SVNClientException {
// list give the DirEntrys of the elements of a directory or the DirEntry
// of a file
ISVNDirEntry[] entries = getList(path.getParentFile(), revision,false);
String expectedPath = path.getName();
for (int i = 0; i < entries.length;i++) {
if (entries[i].getPath().equals(expectedPath)) {
return entries[i];
}
}
return null; // not found
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getSingleStatus(java.io.File)
*/
public ISVNStatus getSingleStatus(File path)
throws SVNClientException {
return getStatus(new File[] {path})[0];
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getStatus(java.io.File[])
*/
public ISVNStatus[] getStatus(File[] path) throws SVNClientException {
ISVNStatus[] statuses = new ISVNStatus[path.length];
for (int i = 0; i < path.length; i++) {
ISVNStatus[] s = getStatus(path[i], false, true, false, false);
if (s == null || s.length == 0) {
statuses[i] = new SVNStatusUnversioned(path[i]);
} else {
statuses[i] = s[0];
}
}
return statuses;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getStatus(java.io.File, boolean, boolean)
*/
public ISVNStatus[] getStatus(File path, boolean descend, boolean getAll)
throws SVNClientException {
return getStatus(path, descend,getAll,false);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getStatus(java.io.File, boolean, boolean, boolean)
*/
public ISVNStatus[] getStatus(File path, boolean descend, boolean getAll, boolean contactServer) throws SVNClientException {
return getStatus(path, descend, getAll, contactServer, false);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getStatus(java.io.File, boolean, boolean, boolean, boolean)
*/
public ISVNStatus[] getStatus(File path, boolean descend, boolean getAll, boolean contactServer, boolean ignoreExternals) throws SVNClientException {
notificationHandler.setCommand(ISVNNotifyListener.Command.STATUS);
String filePathSVN = fileToSVNPath(path, false);
int depth = Depth.unknownOrImmediates(descend); // If descend is true, recurse fully, else do only immediate children.
notificationHandler.logCommandLine("status " + (contactServer?"-u ":"")+ depthCommandLine(depth) + filePathSVN);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
try {
MyStatusCallback callback = new MyStatusCallback();
svnClient.status(
filePathSVN,
depth,
contactServer, // If update is set, contact the repository and augment the status structures with information about out-of-dateness
getAll,getAll, // retrieve all entries; otherwise, retrieve only "interesting" entries (local mods and/or out-of-date).
ignoreExternals, null, callback);
return processFolderStatuses(processExternalStatuses(JhlConverter.convert(
callback.getStatusArray())), getAll, contactServer); // if yes the svn:externals will be ignored
} catch (ClientException e) {
if (e.getAprError() == ErrorCodes.wcNotDirectory) {
// when there is no .svn dir, an exception is thrown ...
return new ISVNStatus[] {new SVNStatusUnversioned(path)};
} else {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
}
/**
* A private status callback implementation used by thin wrappers.
* Instances of this class are not thread-safe.
*/
private class MyStatusCallback implements StatusCallback
{
private List statuses = new ArrayList();
public void doStatus(Status status)
{
statuses.add(status);
}
public Status[] getStatusArray()
{
return (Status[]) statuses.toArray(new Status[statuses.size()]);
}
}
/**
* Post-process svn:externals statuses.
* JavaHL answer two sort of statuses on externals:
* - when ignoreExternals is set to true during call to status(),
* the returned status has textStatus set to EXTERNAL, but the url is null.
* - when ignoreExternals is set to false during call to status(),
* besides the "external + null" status, the second status with url and all fields is returned too,
* but this one has textStatus NORMAL.
*
* This methods unifies both statuses to be complete and has textStatus external.
* In case the first sort (when ignoreExternals true), the url is retrieved by call the info()
*/
protected JhlStatus[] processExternalStatuses(JhlStatus[] statuses) throws SVNClientException
{
//Collect indexes of external statuses
List externalStatusesIndexes = new ArrayList();
for (int i = 0; i < statuses.length; i++) {
if (SVNStatusKind.EXTERNAL.equals(statuses[i].getTextStatus())) {
externalStatusesIndexes.add(new Integer(i));
}
}
if (externalStatusesIndexes.isEmpty()) {
return statuses;
}
//Wrap the "second" externals so their textStatus is actually external
for (Iterator iter = externalStatusesIndexes.iterator(); iter.hasNext();) {
int index = ((Integer) iter.next()).intValue();
JhlStatus jhlStatus = statuses[index];
for (int i = 0; i < statuses.length; i++) {
if ((statuses[i].getPath() != null) && (statuses[i].getPath().equals(jhlStatus.getPath()))) {
statuses[i] = new JhlStatus.JhlStatusExternal(statuses[i]);
statuses[index] = statuses[i];
}
}
}
//Fill the missing urls
for (Iterator iter = externalStatusesIndexes.iterator(); iter.hasNext();) {
int index = ((Integer) iter.next()).intValue();
JhlStatus jhlStatus = statuses[index];
if ((jhlStatus.getUrlString() == null) || (jhlStatus.getUrlString().length() == 0)) {
ISVNInfo info = getInfoFromWorkingCopy(jhlStatus.getFile());
if (info != null) {
statuses[index] = new JhlStatus.JhlStatusExternal(jhlStatus, info.getUrlString());
}
}
}
return statuses;
}
/**
* Post-process statuses.
* Folders do not return proper lastChangedRevision information.
* this allows it to be populated via the svn info command
*/
protected ISVNStatus[] processFolderStatuses(JhlStatus[] statuses, boolean getAll, boolean contactServer) throws SVNClientException
{
if (!getAll || !contactServer)
return statuses;
//Fill the missing last changed info on folders from the file info in the array
List folders = new ArrayList();
for (int i = 0; i < statuses.length; i++) {
JhlStatus jhlStatus = statuses[i];
if (SVNNodeKind.DIR == jhlStatus.getNodeKind() && jhlStatus.getReposLastChangedRevision() == null) {
folders.add(jhlStatus);
}
}
for (int i = 0; i < statuses.length; i++) {
JhlStatus jhlStatus = statuses[i];
if (jhlStatus.getLastChangedRevision() != null) {
for (Iterator iter = folders.iterator(); iter.hasNext();) {
JhlStatus folder = (JhlStatus) iter.next();
if (jhlStatus.getUrlString().startsWith(folder.getUrlString() + "/")) {
if (folder.getLastChangedRevision() == null ||
folder.getLastChangedRevision().getNumber() < jhlStatus.getLastChangedRevision().getNumber()) {
folder.updateFromStatus(jhlStatus);
}
}
}
}
}
return statuses;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#copy(java.io.File, java.io.File)
*/
public void copy(File srcPath, File destPath) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.COPY);
String src = fileToSVNPath(srcPath, false);
String dest = fileToSVNPath(destPath, false);
notificationHandler.logCommandLine("copy " + src + " " + dest);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(new File[] {srcPath,destPath }));
CopySource[] copySources = { new CopySource(src, Revision.WORKING, Revision.WORKING) };
svnClient.copy(copySources, dest, null, true, true, null);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#copy(java.io.File, org.tigris.subversion.svnclientadapter.SVNUrl, java.lang.String)
*/
public void copy(File srcPath, SVNUrl destUrl, String message)
throws SVNClientException {
try {
String fixedMessage = fixSVNString(message);
if (fixedMessage == null)
fixedMessage = "";
notificationHandler.setCommand(ISVNNotifyListener.Command.COPY);
String src = fileToSVNPath(srcPath, false);
String dest = destUrl.toString();
notificationHandler.logCommandLine("copy " + src + " " + dest);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(srcPath));
svnClient.copy(src, dest, fixedMessage, Revision.WORKING);
// last parameter is not used
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#copy(java.io.File[], org.tigris.subversion.svnclientadapter.SVNUrl, java.lang.String, boolean, boolean)
*/
public void copy(File[] srcPaths, SVNUrl destUrl, String message, boolean copyAsChild, boolean makeParents)
throws SVNClientException {
String fixedMessage = fixSVNString(message);
// This is a hack for now since copy of multiple isolated WC's is currently not working.
if (srcPaths.length > 1) {
mkdir(destUrl, makeParents, fixedMessage);
for (int i = 0; i < srcPaths.length; i++) {
File[] file = { srcPaths[i] };
copy(file, destUrl, fixedMessage, copyAsChild, makeParents);
}
return;
}
try {
if (fixedMessage == null)
fixedMessage = "";
notificationHandler.setCommand(ISVNNotifyListener.Command.COPY);
CopySource[] copySources = new CopySource[srcPaths.length];
for (int i = 0; i < srcPaths.length; i++)
copySources[i] = new CopySource(fileToSVNPath(srcPaths[i], false), Revision.WORKING, Revision.WORKING);
String dest = destUrl.toString();
String commandLine = "copy";
String[] paths = new String[srcPaths.length];
for (int i = 0; i < srcPaths.length; i++) {
paths[i] = fileToSVNPath(srcPaths[i], false);
}
commandLine = appendPaths(commandLine, paths) + " " + dest;
notificationHandler.logCommandLine(commandLine.toString());
notificationHandler.setBaseDir();
svnClient.copy(copySources, dest, fixedMessage, copyAsChild, makeParents, null);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#copy(org.tigris.subversion.svnclientadapter.SVNUrl, java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision)
*/
public void copy(SVNUrl srcUrl, File destPath, SVNRevision revision)
throws SVNClientException {
copy(srcUrl, destPath, revision, true, false);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#copy(org.tigris.subversion.svnclientadapter.SVNUrl, java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, boolean, boolean)
*/
public void copy(SVNUrl srcUrl, File destPath, SVNRevision revision, boolean copyAsChild, boolean makeParents)
throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.COPY);
String dest = fileToSVNPath(destPath, false);
CopySource[] sources = { new CopySource(srcUrl.toString(), JhlConverter.convert(revision), Revision.HEAD) };
notificationHandler.logCommandLine("copy " + srcUrl + " " + dest);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(destPath));
svnClient.copy(sources, dest, null, copyAsChild, makeParents, null);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#copy(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNUrl, java.lang.String, org.tigris.subversion.svnclientadapter.SVNRevision)
*/
public void copy(
SVNUrl srcUrl,
SVNUrl destUrl,
String message,
SVNRevision revision)
throws SVNClientException {
copy (srcUrl, destUrl, message, revision, false);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#copy(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNUrl, java.lang.String, org.tigris.subversion.svnclientadapter.SVNRevision)
*/
public void copy(
SVNUrl srcUrl,
SVNUrl destUrl,
String message,
SVNRevision revision,
boolean makeParents)
throws SVNClientException {
copy(new SVNUrl[] { srcUrl }, destUrl, message, revision, true, makeParents);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#copy(org.tigris.subversion.svnclientadapter.SVNUrl[], org.tigris.subversion.svnclientadapter.SVNUrl, java.lang.String, org.tigris.subversion.svnclientadapter.SVNRevision, boolean, boolean)
*/
public void copy(
SVNUrl[] srcUrls,
SVNUrl destUrl,
String message,
SVNRevision revision,
boolean copyAsChild,
boolean makeParents)
throws SVNClientException {
try {
String fixedMessage = fixSVNString(message);
if (fixedMessage == null)
fixedMessage = "";
notificationHandler.setCommand(ISVNNotifyListener.Command.COPY);
CopySource[] copySources = new CopySource[srcUrls.length];
for (int i = 0; i < srcUrls.length; i++) copySources[i] = new CopySource(srcUrls[i].toString(), JhlConverter.convert(revision), JhlConverter.convert(SVNRevision.HEAD));
String dest = destUrl.toString();
String commandLine = "copy -r" + revision.toString();
String[] paths = new String[srcUrls.length];
for (int i = 0; i < srcUrls.length; i++) {
paths[i] = srcUrls[i].toString();
}
commandLine = appendPaths(commandLine, paths) + " " + dest;
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir();
svnClient.copy(copySources, dest, fixedMessage, copyAsChild, makeParents, null);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#remove(org.tigris.subversion.svnclientadapter.SVNUrl[], java.lang.String)
*/
public void remove(SVNUrl url[], String message) throws SVNClientException {
try {
String fixedMessage = fixSVNString(message);
if (fixedMessage == null)
fixedMessage = "";
notificationHandler.setCommand(ISVNNotifyListener.Command.REMOVE);
String commandLine = "delete -m \""+getFirstMessageLine(fixedMessage)+"\"";
String targets[] = new String[url.length];
for (int i = 0; i < url.length;i++) {
targets[i] = url[i].toString();
}
commandLine = appendPaths(commandLine, targets);
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir();
svnClient.remove(targets,fixedMessage,false);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#remove(java.io.File[], boolean)
*/
public void remove(File file[], boolean force) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.REMOVE);
String commandLine = "delete"+(force?" --force":"");
String targets[] = new String[file.length];
for (int i = 0; i < file.length;i++) {
targets[i] = fileToSVNPath(file[i], false);
}
commandLine = appendPaths(commandLine, targets);
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(file));
svnClient.remove(targets,"",force);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#doExport(org.tigris.subversion.svnclientadapter.SVNUrl, java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, boolean)
*/
public void doExport(
SVNUrl srcUrl,
File destPath,
SVNRevision revision,
boolean force)
throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.EXPORT);
String src = srcUrl.toString();
String dest = fileToSVNPath(destPath, false);
notificationHandler.logCommandLine(
"export -r " + revision.toString() + ' ' + src + ' ' + dest);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(destPath));
svnClient.doExport(src, dest, JhlConverter.convert(revision), force);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#doExport(java.io.File, java.io.File, boolean)
*/
public void doExport(File srcPath, File destPath, boolean force)
throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.EXPORT);
String src = fileToSVNPath(srcPath, false);
String dest = fileToSVNPath(destPath, false);
notificationHandler.logCommandLine("export " + src + ' ' + dest);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(new File[]{srcPath,destPath }));
// in this case, revision is not used but must be valid
svnClient.doExport(src, dest, Revision.WORKING, force);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#doImport(java.io.File, org.tigris.subversion.svnclientadapter.SVNUrl, java.lang.String, boolean)
*/
public void doImport(
File path,
SVNUrl url,
String message,
boolean recurse)
throws SVNClientException {
try {
String fixedMessage = fixSVNString(message);
if (fixedMessage == null)
fixedMessage = "";
notificationHandler.setCommand(ISVNNotifyListener.Command.IMPORT);
String src = fileToSVNPath(path, false);
String dest = url.toString();
notificationHandler.logCommandLine(
"import -m \""
+ getFirstMessageLine(fixedMessage)
+ "\" "
+ (recurse ? "" : "-N ")
+ src
+ ' '
+ dest);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
svnClient.doImport(src, dest, fixedMessage, recurse);
notificationHandler.logCompleted(Messages.bind("notify.import.complete"));
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#mkdir(org.tigris.subversion.svnclientadapter.SVNUrl, java.lang.String)
*/
public void mkdir(SVNUrl url, String message) throws SVNClientException {
this.mkdir(url, false, message);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#mkdir(java.io.File)
*/
public void mkdir(File file) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.MKDIR);
String target = fileToSVNPath(file, false);
notificationHandler.logCommandLine(
"mkdir "+target);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(file));
svnClient.mkdir(new String[] { target },"");
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#move(java.io.File, java.io.File, boolean)
*/
public void move(File srcPath, File destPath, boolean force) throws SVNClientException {
// use force when you want to move file even if there are local modifications
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.MOVE);
String src = fileToSVNPath(srcPath, false);
String dest = fileToSVNPath(destPath, false);
notificationHandler.logCommandLine(
"move "+src+' '+dest);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(new File[] {srcPath, destPath}));
svnClient.move(src,dest,"",force);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#move(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNUrl, java.lang.String, org.tigris.subversion.svnclientadapter.SVNRevision)
*/
public void move(
SVNUrl srcUrl,
SVNUrl destUrl,
String message,
SVNRevision revision)
throws SVNClientException {
try {
String fixedMessage = fixSVNString(message);
// NOTE: The revision arg is ignored as you cannot move
// a specific revision, only HEAD.
if (fixedMessage == null)
fixedMessage = "";
notificationHandler.setCommand(ISVNNotifyListener.Command.MOVE);
String src = srcUrl.toString();
String dest = destUrl.toString();
notificationHandler.logCommandLine(
"move -m \""
+ getFirstMessageLine(fixedMessage)
+ ' '
+ src
+ ' '
+ dest);
notificationHandler.setBaseDir();
svnClient.move(src, dest, fixedMessage, false);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#update(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, boolean)
*/
public long update(File path, SVNRevision revision, boolean recurse)
throws SVNClientException {
return update(path, revision, Depth.unknownOrFiles(recurse), false, false, true);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#update(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, int, boolean, boolean, boolean)
*/
public long update(File path, SVNRevision revision, int depth, boolean setDepth, boolean ignoreExternals, boolean force)
throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.UPDATE);
String target = fileToSVNPath(path, false);
StringBuffer commandLine;
if (depth == Depth.exclude)
commandLine = new StringBuffer("update " + target + " --set-depth=exclude");
else {
commandLine = new StringBuffer("update " + target + " -r " +
revision.toString() + depthCommandLine(depth));
if (ignoreExternals) commandLine.append(" --ignore-externals");
if (force) commandLine.append(" --force");
}
notificationHandler.logCommandLine(commandLine.toString());
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
return svnClient.update(target, JhlConverter.convert(revision), depth, setDepth,
ignoreExternals, force);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#update(java.io.File[], org.tigris.subversion.svnclientadapter.SVNRevision, boolean, boolean)
*/
public long[] update(File[] path, SVNRevision revision, boolean recurse, boolean ignoreExternals)
throws SVNClientException
{
return update(path, revision, Depth.unknownOrFiles(recurse), false, ignoreExternals, true);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#update(java.io.File[], org.tigris.subversion.svnclientadapter.SVNRevision, int, boolean, boolean)
*/
public long[] update(File[] path, SVNRevision revision, int depth, boolean setDepth, boolean ignoreExternals, boolean force)
throws SVNClientException
{
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.UPDATE);
String[] targets = new String[path.length];
StringBuffer targetsString = new StringBuffer();
for (int i = 0; i < targets.length; i++) {
targets[i] = fileToSVNPath(path[i], false);
targetsString.append(targets[i]);
targetsString.append(" ");
}
StringBuffer commandLine = new StringBuffer("update " + targetsString.toString() + " -r " +
revision.toString() + depthCommandLine(depth));
if (ignoreExternals) commandLine.append(" --ignore-externals");
if (force) commandLine.append(" --force");
notificationHandler.logCommandLine(commandLine.toString());
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
notificationHandler.holdStats();
long[] rtnCode = svnClient.update(targets, JhlConverter.convert(revision), depth, setDepth, ignoreExternals, force);
notificationHandler.releaseStats();
return rtnCode;
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#revert(java.io.File, boolean)
*/
public void revert(File path, boolean recurse) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.REVERT);
String target = fileToSVNPath(path, false);
notificationHandler.logCommandLine(
"revert "+
(recurse?"":"-N ")+
target);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
svnClient.revert(target,recurse);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getContent(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision)
*/
public InputStream getContent(SVNUrl url, SVNRevision revision, SVNRevision pegRevision)
throws SVNClientException {
try {
notificationHandler.setCommand(
ISVNNotifyListener.Command.CAT);
notificationHandler.logCommandLine(
"cat -r "
+ revision.toString()
+ " "
+ url.toString());
notificationHandler.setBaseDir();
byte[] contents = svnClient.fileContent(url.toString(), JhlConverter.convert(revision), JhlConverter.convert(pegRevision));
InputStream input = new ByteArrayInputStream(contents);
return input;
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getContent(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision)
*/
public InputStream getContent(SVNUrl url, SVNRevision revision)
throws SVNClientException {
return getContent(url, revision, SVNRevision.HEAD);
}
/*
* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getContent(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision)
*/
public InputStream getContent(File path, SVNRevision revision)
throws SVNClientException {
try {
String target = fileToSVNPath(path, false);
notificationHandler.setCommand(
ISVNNotifyListener.Command.CAT);
notificationHandler.logCommandLine(
"cat -r "
+ revision.toString()
+ " "
+ target);
notificationHandler.setBaseDir();
if (revision.equals(SVNRevision.BASE)) {
// This is to work-around a JavaHL problem when trying to
// retrieve the base revision of a newly added file.
ISVNStatus status = getSingleStatus(path);
if (status.getTextStatus().equals(SVNStatusKind.ADDED))
return new ByteArrayInputStream(new byte[0]);
}
byte[] contents = svnClient.fileContent(target, JhlConverter.convert(revision));
InputStream input = new ByteArrayInputStream(contents);
return input;
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getProperties(java.io.File)
*/
public ISVNProperty[] getProperties(File path) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.PROPLIST);
String target = fileToSVNPath(path, false);
notificationHandler.logCommandLine(
"proplist "+ target);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
PropertyData[] propertiesData = svnClient.properties(target);
if (propertiesData == null) {
// no properties
return new JhlPropertyData[0];
}
JhlPropertyData[] svnProperties = new JhlPropertyData[propertiesData.length];
for (int i = 0; i < propertiesData.length;i++) {
svnProperties[i] = JhlPropertyData.newForFile(propertiesData[i]);
}
return svnProperties;
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getProperties(org.tigris.subversion.svnclientadapter.SVNUrl)
*/
public ISVNProperty[] getProperties(SVNUrl url) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.PROPLIST);
String target = url.toString();
notificationHandler.logCommandLine(
"proplist "+ target);
notificationHandler.setBaseDir();
PropertyData[] propertiesData = svnClient.properties(target);
if (propertiesData == null) {
// no properties
return new JhlPropertyData[0];
}
JhlPropertyData[] svnProperties = new JhlPropertyData[propertiesData.length];
for (int i = 0; i < propertiesData.length;i++) {
svnProperties[i] = JhlPropertyData.newForUrl(propertiesData[i]);
}
return svnProperties;
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#propertySet(java.io.File, java.lang.String, java.lang.String, boolean)
*/
public void propertySet(
File path,
String propertyName,
String propertyValue,
boolean recurse)
throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.PROPSET);
String target = fileToSVNPath(path, false);
notificationHandler.logCommandLine(
"propset "
+ (recurse?"-R ":"")
+ propertyName
+ " \""
+ propertyValue
+ "\" "
+ target);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
Set statusBefore = null;
if (recurse) {
statusBefore = new HashSet();
ISVNStatus[] statuses = getStatus(path,recurse,false);
for (int i = 0; i < statuses.length;i++) {
statusBefore.add(statuses[i].getFile().getAbsolutePath());
}
}
if (propertyName.startsWith("svn:")) {
// Normalize line endings in property value
svnClient.propertySet(target, propertyName, fixSVNString(propertyValue), recurse);
} else {
svnClient.propertySet(target, propertyName, propertyValue, recurse);
}
// there is no notification (Notify.notify is not called) when we set a property
// so we will do notification ourselves
if (recurse) {
ISVNStatus[] statuses = getStatus(path,recurse,false);
for (int i = 0; i < statuses.length;i++) {
String statusPath = statuses[i].getFile().getAbsolutePath();
notificationHandler.notifyListenersOfChange(statusPath);
statusBefore.remove(statusPath);
}
for (Iterator it = statusBefore.iterator(); it.hasNext();)
notificationHandler.notifyListenersOfChange((String)it.next());
} else {
notificationHandler.notifyListenersOfChange(path.getAbsolutePath());
}
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#propertySet(java.io.File, java.lang.String, java.io.File, boolean)
*/
public void propertySet(
File path,
String propertyName,
File propertyFile,
boolean recurse)
throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.PROPSET);
String target = fileToSVNPath(path, false);
notificationHandler.logCommandLine(
"propset "
+ (recurse?"-R ":"")
+ propertyName
+ "-F \""
+ propertyFile.toString()
+ "\" "
+ target);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
byte[] propertyBytes = new byte[(int) propertyFile.length()];
FileInputStream is = null;
try {
is = new FileInputStream(propertyFile);
is.read(propertyBytes);
}
catch (IOException ioe) {
throw new SVNClientException(ioe);
}
finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
// ignore
}
}
}
Set statusBefore = null;
if (recurse) {
statusBefore = new HashSet();
ISVNStatus[] statuses = getStatus(path,recurse,false);
for (int i = 0; i < statuses.length;i++) {
statusBefore.add(statuses[i].getFile().getAbsolutePath());
}
}
svnClient.propertySet(target, propertyName, propertyBytes, recurse);
// there is no notification (Notify.notify is not called) when we set a property
// so we will do notification ourselves
if (recurse) {
ISVNStatus[] statuses = getStatus(path,recurse,false);
for (int i = 0; i < statuses.length;i++) {
String statusPath = statuses[i].getFile().getAbsolutePath();
notificationHandler.notifyListenersOfChange(statusPath);
statusBefore.remove(statusPath);
}
for (Iterator it = statusBefore.iterator(); it.hasNext();)
notificationHandler.notifyListenersOfChange((String)it.next());
} else {
notificationHandler.notifyListenersOfChange(path.getAbsolutePath());
}
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#propertyGet(java.io.File, java.lang.String)
*/
public ISVNProperty propertyGet(File path, String propertyName)
throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.PROPGET);
String target = fileToSVNPath(path, false);
notificationHandler.logCommandLine(
"propget " + propertyName + " " + target);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
PropertyData propData = svnClient.propertyGet(target, propertyName);
if (propData == null)
return null;
else
return JhlPropertyData.newForFile(propData);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#propertyGet(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, java.lang.String)
*/
public ISVNProperty propertyGet(SVNUrl url, SVNRevision revision,
SVNRevision peg, String propertyName) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.PROPGET);
String target = url.toString();
String commandLine = "propget -r " + revision.toString() + " " +
propertyName + " " + target;
if (!peg.equals(SVNRevision.HEAD))
commandLine += "@" + peg.toString();
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir();
PropertyData propData = svnClient.propertyGet(target, propertyName, JhlConverter.convert(revision),
JhlConverter.convert(peg));
if (propData == null)
return null;
else
return JhlPropertyData.newForUrl(propData);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#propertyDel(java.io.File, java.lang.String, boolean)
*/
public void propertyDel(File path, String propertyName,boolean recurse) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.PROPDEL);
String target = fileToSVNPath(path, false);
notificationHandler.logCommandLine("propdel "+propertyName+" "+target);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
Set statusBefore = null;
if (recurse) {
statusBefore = new HashSet();
ISVNStatus[] statuses = getStatus(path,recurse,false);
for (int i = 0; i < statuses.length;i++) {
statusBefore.add(statuses[i].getFile().getAbsolutePath());
}
}
// propertyRemove is on repository, this will be present on next version of javahl
// svnClient.propertyRemove(target, propertyName,recurse);
// @TODO : change this method when svnjavahl will be upgraded
// for now we use this workaround
PropertyData propData = svnClient.propertyGet(target,propertyName);
propData.remove(recurse);
// there is no notification (Notify.notify is not called) when we set a property
// so we will do notification ourselves
if (recurse) {
ISVNStatus[] statuses = getStatus(path,recurse,false);
for (int i = 0; i < statuses.length;i++) {
String statusPath = statuses[i].getFile().getAbsolutePath();
notificationHandler.notifyListenersOfChange(statusPath);
statusBefore.remove(statusPath);
}
for (Iterator it = statusBefore.iterator(); it.hasNext();)
notificationHandler.notifyListenersOfChange((String)it.next());
} else {
notificationHandler.notifyListenersOfChange(path.getAbsolutePath());
}
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#diff(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, boolean)
*/
public void diff(File oldPath, SVNRevision oldPathRevision,
File newPath, SVNRevision newPathRevision,
File outFile, boolean recurse) throws SVNClientException {
diff(oldPath, oldPathRevision, newPath, newPathRevision, outFile, recurse, true, false, false);
}
private void diffRelative(File oldPath, SVNRevision oldPathRevision,
File newPath, SVNRevision newPathRevision,
File outFile, boolean recurse, boolean ignoreAncestry,
boolean noDiffDeleted, boolean force, File relativeTo) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.DIFF);
if (oldPath == null)
oldPath = new File(".");
if (newPath == null)
newPath = oldPath;
if (oldPathRevision == null)
oldPathRevision = SVNRevision.BASE;
if (newPathRevision == null)
newPathRevision = SVNRevision.WORKING;
// we don't want canonical file path (otherwise the complete file name
// would be in the patch). This way the user can choose to use a relative
// path
String oldTarget = fileToSVNPath(oldPath, false);
String newTarget = fileToSVNPath(newPath, false);
String svnOutFile = fileToSVNPath(outFile, false);
String relativeToDir = fileToSVNPath(relativeTo, false);
String commandLine = "diff ";
if ( (oldPathRevision.getKind() != RevisionKind.base) ||
(newPathRevision.getKind() != RevisionKind.working) )
{
commandLine += "-r "+oldPathRevision.toString();
if (newPathRevision.getKind() != RevisionKind.working)
commandLine+= ":"+newPathRevision.toString();
commandLine += " ";
}
if (!oldPath.equals(new File(".")))
commandLine += "--old "+oldTarget+" ";
if (!newPath.equals(oldPath))
commandLine += "--new "+newTarget+" ";
int depth = Depth.empty;
if (recurse)
depth = Depth.infinity;
else {
if (oldPath.isFile())
depth = Depth.files;
}
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(new File[]{oldPath,newPath}));
svnClient.diff(oldTarget,JhlConverter.convert(oldPathRevision),newTarget,JhlConverter.convert(newPathRevision), relativeToDir, svnOutFile, depth, null, ignoreAncestry, noDiffDeleted, force);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#diff(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, boolean, boolean, boolean, boolean)
*/
public void diff(File oldPath, SVNRevision oldPathRevision,
File newPath, SVNRevision newPathRevision,
File outFile, boolean recurse, boolean ignoreAncestry,
boolean noDiffDeleted, boolean force) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.DIFF);
if (oldPath == null)
oldPath = new File(".");
if (newPath == null)
newPath = oldPath;
if (oldPathRevision == null)
oldPathRevision = SVNRevision.BASE;
if (newPathRevision == null)
newPathRevision = SVNRevision.WORKING;
// we don't want canonical file path (otherwise the complete file name
// would be in the patch). This way the user can choose to use a relative
// path
String oldTarget = fileToSVNPath(oldPath, false);
String newTarget = fileToSVNPath(newPath, false);
String svnOutFile = fileToSVNPath(outFile, false);
String commandLine = "diff ";
if ( (oldPathRevision.getKind() != RevisionKind.base) ||
(newPathRevision.getKind() != RevisionKind.working) )
{
commandLine += "-r "+oldPathRevision.toString();
if (newPathRevision.getKind() != RevisionKind.working)
commandLine+= ":"+newPathRevision.toString();
commandLine += " ";
}
if (!oldPath.equals(new File(".")))
commandLine += "--old "+oldTarget+" ";
if (!newPath.equals(oldPath))
commandLine += "--new "+newTarget+" ";
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(new File[]{oldPath,newPath}));
svnClient.diff(oldTarget,JhlConverter.convert(oldPathRevision),newTarget,JhlConverter.convert(newPathRevision), svnOutFile, recurse, ignoreAncestry, noDiffDeleted, force);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#diff(java.io.File, java.io.File, boolean)
*/
public void diff(File path, File outFile, boolean recurse) throws SVNClientException {
diff(path, null,null,null,outFile,recurse);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#diff(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, boolean)
*/
public void diff(SVNUrl oldUrl, SVNRevision oldUrlRevision,
SVNUrl newUrl, SVNRevision newUrlRevision,
File outFile, boolean recurse) throws SVNClientException {
diff(oldUrl, oldUrlRevision, newUrl, newUrlRevision, outFile, recurse, true, false, false);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#diff(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, int, boolean, boolean, boolean)
*/
public void diff(SVNUrl target, SVNRevision pegRevision, SVNRevision startRevision, SVNRevision endRevision,
File outFile, int depth, boolean ignoreAncestry,
boolean noDiffDeleted, boolean force) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.DIFF);
if (pegRevision == null)
pegRevision = SVNRevision.HEAD;
if (startRevision == null)
startRevision = SVNRevision.HEAD;
if (endRevision == null)
endRevision = SVNRevision.HEAD;
String commandLine = "diff ";
commandLine += depthCommandLine(depth);
if (ignoreAncestry)
commandLine += " --ignoreAncestry";
commandLine += " -r " + startRevision + ":" + endRevision + " " + target;
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir();
svnClient.diff(target.toString(), JhlConverter.convert(pegRevision), JhlConverter.convert(startRevision), JhlConverter.convert(endRevision),
null, outFile.getAbsolutePath(), depth, null, ignoreAncestry, noDiffDeleted, force);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#diff(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, boolean)
*/
public void diff(SVNUrl target, SVNRevision pegRevision, SVNRevision startRevision, SVNRevision endRevision,
File outFile, boolean recurse) throws SVNClientException {
diff(target, pegRevision, startRevision, endRevision, outFile, Depth.infinityOrImmediates(recurse), true, false, false);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#diff(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, boolean, boolean, boolean, boolean)
*/
public void diff(SVNUrl oldUrl, SVNRevision oldUrlRevision,
SVNUrl newUrl, SVNRevision newUrlRevision,
File outFile, boolean recurse, boolean ignoreAncestry,
boolean noDiffDeleted, boolean force) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.DIFF);
if (newUrl == null)
newUrl = oldUrl;
if (oldUrlRevision == null)
oldUrlRevision = SVNRevision.HEAD;
if (newUrlRevision == null)
newUrlRevision = SVNRevision.HEAD;
String svnOutFile = fileToSVNPath(outFile, false);
String commandLine = "diff ";
if ( (oldUrlRevision.getKind() != RevisionKind.head) ||
(newUrlRevision.getKind() != RevisionKind.head) )
{
commandLine += "-r "+oldUrlRevision.toString();
if (newUrlRevision.getKind() != RevisionKind.head)
commandLine+= ":"+newUrlRevision.toString();
commandLine += " ";
}
commandLine += oldUrl+" ";
if (!newUrl.equals(oldUrl))
commandLine += newUrl+" ";
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir();
svnClient.diff(oldUrl.toString(),JhlConverter.convert(oldUrlRevision),newUrl.toString(),JhlConverter.convert(newUrlRevision), svnOutFile, recurse, ignoreAncestry, noDiffDeleted, force);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#diff(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, boolean)
*/
public void diff(SVNUrl url, SVNRevision oldUrlRevision, SVNRevision newUrlRevision,
File outFile, boolean recurse) throws SVNClientException {
diff(url,oldUrlRevision,url,newUrlRevision,outFile,recurse);
}
public ISVNAnnotations annotate(File file, SVNRevision revisionStart,
SVNRevision revisionEnd, boolean ignoreMimeType,
boolean includeMergedRevisions) throws SVNClientException {
String target = fileToSVNPath(file, false);
//If the file is an uncommitted rename/move, we have to refer to original/source, not the new copy.
ISVNInfo info = getInfoFromWorkingCopy(file);
if ((SVNScheduleKind.ADD == info.getSchedule()) && (info.getCopyUrl() != null)) {
target = info.getCopyUrl().toString();
}
return annotate(target, revisionStart, revisionEnd, ignoreMimeType, includeMergedRevisions);
}
public ISVNAnnotations annotate(SVNUrl url, SVNRevision revisionStart,
SVNRevision revisionEnd, boolean ignoreMimeType,
boolean includeMergedRevisions) throws SVNClientException {
return annotate(url.toString(), revisionStart, revisionEnd, ignoreMimeType, includeMergedRevisions);
}
private ISVNAnnotations annotate(String target, SVNRevision revisionStart, SVNRevision revisionEnd,
boolean ignoreMimeType, boolean includeMergedRevisions)
throws SVNClientException
{
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.ANNOTATE);
if(revisionStart == null)
revisionStart = new SVNRevision.Number(1);
if(revisionEnd == null)
revisionEnd = SVNRevision.HEAD;
String commandLine = "blame ";
if (includeMergedRevisions)
commandLine += "-g ";
commandLine = commandLine + "-r " + revisionStart.toString() + ":" + revisionEnd.toString() + " ";
commandLine = commandLine + target + "@HEAD";
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir();
JhlAnnotations annotations = new JhlAnnotations();
svnClient.blame(target, Revision.HEAD, JhlConverter.convert(revisionStart), JhlConverter.convert(revisionEnd), ignoreMimeType, includeMergedRevisions, annotations);
return annotations;
} catch (ClientException e) {
if (includeMergedRevisions && ((ClientException)e).getAprError() == SVNClientException.UNSUPPORTED_FEATURE) {
return annotate(target, revisionStart, revisionEnd, ignoreMimeType, false);
}
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#annotate(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision)
*/
public ISVNAnnotations annotate(SVNUrl url, SVNRevision revisionStart, SVNRevision revisionEnd)
throws SVNClientException
{
return annotate(url.toString(), revisionStart, revisionEnd, false, false);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#annotate(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision)
*/
public ISVNAnnotations annotate(File file, SVNRevision revisionStart, SVNRevision revisionEnd)
throws SVNClientException
{
String target = fileToSVNPath(file, false);
//If the file is an uncommitted rename/move, we have to refer to original/source, not the new copy.
ISVNInfo info = getInfoFromWorkingCopy(file);
if ((SVNScheduleKind.ADD == info.getSchedule()) && (info.getCopyUrl() != null)) {
target = info.getCopyUrl().toString();
}
return annotate(target, revisionStart, revisionEnd, false, false);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#resolved(java.io.File)
*/
public void resolved(File path)
throws SVNClientException
{
this.resolve(path, ISVNConflictResolver.Choice.chooseMerged);
}
public void resolve(File path, int result) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.RESOLVE);
String target = fileToSVNPath(path, true);
String commandLine = "resolve ";
switch (result) {
case ISVNConflictResolver.Choice.chooseMerged:
commandLine += "--accept=working ";
break;
case ISVNConflictResolver.Choice.chooseBase:
commandLine += "--accept=base ";
break;
case ISVNConflictResolver.Choice.chooseTheirsFull:
commandLine += "--accept=theirs-full ";
break;
case ISVNConflictResolver.Choice.chooseMineFull:
commandLine += "--accept=mine-full ";
break;
default:
break;
}
commandLine += target;
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
svnClient.resolve(target, Depth.empty, result);
} catch (SubversionException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/*
* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#cancelOperation()
*/
public void cancelOperation() throws SVNClientException {
try {
svnClient.cancelOperation();
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getInfoFromWorkingCopy(java.io.File)
*/
public ISVNInfo getInfoFromWorkingCopy(File path) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.INFO);
String target = fileToSVNPath(path, false);
notificationHandler.logCommandLine("info "+target);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
Info info = svnClient.info(target);
if (info == null) {
return new SVNInfoUnversioned(path);
}
return new JhlInfo(path, info);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getInfo(java.io.File)
*/
public ISVNInfo getInfo(File path) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.INFO);
String target = fileToSVNPath(path, false);
notificationHandler.logCommandLine("info "+target);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
//Call the simple info() first to check whether the resource actually exists in repositiory.
//If yes, the call info2() later to get more data from the repository.
Info info = svnClient.info(target);
if (info == null) {
return new SVNInfoUnversioned(path);
} else if (info.getLastChangedRevision() == Revision.SVN_INVALID_REVNUM)
{
//Item is not in repository (yet or anymore ?)
return new JhlInfo(path, info);
}
Info2[] info2 = svnClient.info2(target, Revision.HEAD, Revision.HEAD, false);
if (info2 == null || info2.length == 0) {
return new SVNInfoUnversioned(path);
} else {
return new JhlInfo2(path,info2[0]);
}
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getInfo(java.io.File, boolean)
*/
public ISVNInfo[] getInfo(File path, boolean descend) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.INFO);
String target = fileToSVNPath(path, false);
if (descend) notificationHandler.logCommandLine("info " + target + " --depth=infinity");
else notificationHandler.logCommandLine("info " + target);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
List infoList = new ArrayList();
Info info = svnClient.info(target);
if (info == null) {
infoList.add(new SVNInfoUnversioned(path));
} else {
Info2[] infos = svnClient.info2(target, null, null, true);
if (infos == null || infos.length == 0) {
infoList.add(new SVNInfoUnversioned(path));
} else {
for (int i = 0; i < infos.length; i++)
infoList.add(new JhlInfo2(path,infos[i]));
}
}
ISVNInfo[] infoArray = new ISVNInfo[infoList.size()];
infoList.toArray(infoArray);
return infoArray;
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getInfo(org.tigris.subversion.svnclientadapter.SVNUrl)
*/
public ISVNInfo getInfo(SVNUrl url, SVNRevision revision, SVNRevision peg) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.INFO);
String target = url.toString();
notificationHandler.logCommandLine("info "+target);
// notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(url));
Info2[] info = svnClient.info2(target, JhlConverter.convert(revision), JhlConverter.convert(peg), false);
if (info == null || info.length == 0) {
return new SVNInfoUnversioned(null);
} else {
return new JhlInfo2(null, info[0]);
}
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/*
* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#switchUrl(org.tigris.subversion.svnclientadapter.SVNUrl, java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, boolean)
*/
public void switchToUrl(File path, SVNUrl url, SVNRevision revision, boolean recurse) throws SVNClientException {
switchToUrl(path, url, revision, Depth.unknownOrFiles(recurse), false, false, true);
}
/*
* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#switchUrl(org.tigris.subversion.svnclientadapter.SVNUrl, java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, int, boolean, boolean, boolean)
*/
public void switchToUrl(File path, SVNUrl url, SVNRevision revision, int depth, boolean setDepth, boolean ignoreExternals, boolean force) throws SVNClientException {
switchToUrl(path, url, revision, revision, depth, setDepth, ignoreExternals, force);
}
/*
* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#switchUrl(org.tigris.subversion.svnclientadapter.SVNUrl, java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, int, boolean, boolean, boolean)
*/
public void switchToUrl(File path, SVNUrl url, SVNRevision revision, SVNRevision pegRevision, int depth, boolean setDepth, boolean ignoreExternals, boolean force) throws SVNClientException {
if (depth == Depth.exclude) {
update(path, pegRevision, depth, true, ignoreExternals, force);
return;
}
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.SWITCH);
String target = fileToSVNPath(path, false);
StringBuffer commandLine = new StringBuffer("switch " + url + " " + target + " -r " + revision.toString() +
depthCommandLine(depth));
if (ignoreExternals) commandLine.append(" --ignore-externals");
if (force) commandLine.append(" --force");
notificationHandler.logCommandLine(commandLine.toString());
File baseDir = SVNBaseDir.getBaseDir(path);
notificationHandler.setBaseDir(baseDir);
Revision rev = JhlConverter.convert(revision);
Revision pegRev = JhlConverter.convert(pegRevision);
svnClient.doSwitch(target, url.toString(),rev,pegRev,depth, setDepth, ignoreExternals, force);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#setConfigDirectory(java.io.File)
*/
public void setConfigDirectory(File dir) throws SVNClientException {
try {
svnClient.setConfigDirectory(fileToSVNPath(dir,false));
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#cleanup(java.io.File)
*/
public void cleanup(File path) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.CLEANUP);
String target = fileToSVNPath(path, false);
String commandLine = "cleanup " + target;
notificationHandler.logCommandLine(commandLine);
svnClient.cleanup(target);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#merge(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, boolean, boolean, boolean, boolean)
*/
public void merge(SVNUrl path1, SVNRevision revision1, SVNUrl path2,
SVNRevision revision2, File localPath, boolean force,
boolean recurse, boolean dryRun, boolean ignoreAncestry) throws SVNClientException {
merge(path1, revision1, path2, revision2, localPath, force, Depth.infinityOrFiles(recurse), dryRun, ignoreAncestry, false);
}
public void merge(SVNUrl path1, SVNRevision revision1, SVNUrl path2,
SVNRevision revision2, SVNRevision pegRevision, File localPath, boolean force,
int depth, boolean dryRun, boolean ignoreAncestry, boolean recordOnly) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.MERGE);
String target = fileToSVNPath(localPath, false);
String commandLine = "merge";
boolean samePath = false;
if (dryRun) {
commandLine += " --dry-run";
}
commandLine += depthCommandLine(depth);
if (force) {
commandLine += " --force";
}
if (ignoreAncestry) {
commandLine += " --ignore-ancestry";
}
if (path1.toString().equals(path2.toString())) {
samePath = true;
if (revision1 == null || revision2 == null) commandLine += " " + path1;
else commandLine += " -r" + revision1.toString() + ":" + revision2.toString() + " " + path1;
} else {
commandLine += " " + path1 + "@" + revision1.toString() + " " + path2 + "@" + revision2.toString();
}
commandLine += " " + target;
notificationHandler.logCommandLine(commandLine);
File baseDir = SVNBaseDir.getBaseDir(localPath);
notificationHandler.setBaseDir(baseDir);
if (samePath) {
Revision rev1;
Revision rev2;
if (revision1 == null)
rev1 = Revision.START;
else
rev1 = JhlConverter.convert(revision1);
if (revision2 == null)
rev2 = Revision.START;
else
rev2 = JhlConverter.convert(revision2);
RevisionRange[] revisionRanges = { new RevisionRange(rev1, rev2) };
svnClient.merge(path1.toString(), JhlConverter.convert(pegRevision), revisionRanges, target, force, depth, ignoreAncestry, dryRun, recordOnly );
} else
svnClient.merge(path1.toString(), JhlConverter.convert(revision1), path2.toString(), JhlConverter.convert(revision2), target, force, depth, ignoreAncestry, dryRun, recordOnly );
if (dryRun)
notificationHandler.logCompleted("Dry-run merge complete.");
else
notificationHandler.logCompleted("Merge complete.");
} catch (ClientException e) {
notificationHandler.logException(e);
if (dryRun)
notificationHandler.logCompleted("Dry-run merge completed abnormally.");
else
notificationHandler.logCompleted("Merge completed abnormally.");
SVNClientException svnClientException = new SVNClientException(e);
svnClientException.setAprError(e.getAprError());
throw svnClientException;
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#merge(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, boolean, int, boolean, boolean)
*/
public void merge(SVNUrl path1, SVNRevision revision1, SVNUrl path2,
SVNRevision revision2, File localPath, boolean force,
int depth, boolean dryRun, boolean ignoreAncestry, boolean recordOnly) throws SVNClientException {
SVNUrlWithPegRevision svnUrlWithPegRevision = new SVNUrlWithPegRevision(path1);
SVNRevision pegRevision = svnUrlWithPegRevision.getPegRevision();
if (pegRevision == null) {
if (revision2 == null) pegRevision = SVNRevision.HEAD;
else pegRevision = revision2;
}
merge(svnUrlWithPegRevision.getUrl(), revision1, new SVNUrlWithPegRevision(path2).getUrl(), revision2, pegRevision, localPath, force, depth, dryRun, ignoreAncestry, recordOnly);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#mergeReintegrate(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, boolean, boolean)
*/
public void mergeReintegrate(SVNUrl path, SVNRevision pegRevision,
File localPath, boolean force, boolean dryRun) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.MERGE);
String target = fileToSVNPath(localPath, false);
String commandLine = "merge -reintegrate";
if (dryRun) {
commandLine += " --dry-run";
}
if (force) {
commandLine += " --force";
}
commandLine += " " + path + " " + target;
notificationHandler.logCommandLine(commandLine);
File baseDir = SVNBaseDir.getBaseDir(localPath);
notificationHandler.setBaseDir(baseDir);
Revision peg = JhlConverter.convert(pegRevision);
if (peg == null) peg = Revision.HEAD;
svnClient.mergeReintegrate(path.toString(), peg, target, dryRun);
if (dryRun)
notificationHandler.logCompleted("Dry-run merge complete.");
else
notificationHandler.logCompleted("Merge complete.");
} catch (ClientException e) {
notificationHandler.logException(e);
if (dryRun)
notificationHandler.logCompleted("Dry-run merge completed abnormally.");
else
notificationHandler.logCompleted("Merge completed abnormally.");
SVNClientException svnClientException = new SVNClientException(e);
svnClientException.setAprError(e.getAprError());
throw svnClientException;
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#addPasswordCallback(org.tigris.subversion.svnclientadapter.ISVNPromptUserPassword)
*/
public void addPasswordCallback(ISVNPromptUserPassword callback) {
if (callback != null) {
JhlPromptUserPassword prompt = new JhlPromptUserPassword(callback);
this.setPromptUserPassword(prompt);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#lock(org.tigris.subversion.svnclientadapter.SVNUrl[], java.lang.String, boolean)
*/
public void lock(SVNUrl[] uris, String comment, boolean force)
throws SVNClientException {
notImplementedYet();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#unlock(org.tigris.subversion.svnclientadapter.SVNUrl[], boolean)
*/
public void unlock(SVNUrl[] uris, boolean force)
throws SVNClientException {
notImplementedYet();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#lock(java.lang.String[], java.lang.String, boolean)
*/
public void lock(File[] paths, String comment, boolean force)
throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.LOCK);
String[] files = new String[paths.length];
String commandLine = "lock -m \""+comment+"\"";
if (force)
commandLine+=" --force";
for (int i = 0; i < paths.length; i++) {
files[i] = fileToSVNPath(paths[i], false);
}
commandLine = appendPaths(commandLine, files);
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(paths));
svnClient.lock(files, comment, force);
for (int i = 0; i < files.length; i++) {
notificationHandler.notifyListenersOfChange(files[i]);
}
} catch (ClientException e) {
notificationHandler.logException(e);
// throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#unlock(java.io.File[], boolean)
*/
public void unlock(File[] paths, boolean force) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.LOCK);
String[] files = new String[paths.length];
String commandLine = "unlock ";
if (force)
commandLine+=" --force";
for (int i = 0; i < paths.length; i++) {
files[i] = fileToSVNPath(paths[i], false);
}
commandLine = appendPaths(commandLine, files);
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(paths));
svnClient.unlock(files, force);
for (int i = 0; i < files.length; i++) {
notificationHandler.notifyListenersOfChange(files[i]);
}
} catch (ClientException e) {
notificationHandler.logException(e);
// throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#setRevProperty(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision.Number, java.lang.String, java.lang.String, boolean)
*/
public void setRevProperty(SVNUrl url, SVNRevision.Number revisionNo, String propName, String propertyData, boolean force) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.PROPSET);
notificationHandler.logCommandLine(
"propset --revprop -r " + revisionNo.toString()
+ (force ? "--force " : "")
+ " \""
+ propName
+ "\" \""
+ propertyData
+ "\" "
+ url.toString());
notificationHandler.setBaseDir();
svnClient.setRevProperty(url.toString(), propName, Revision.getInstance(revisionNo.getNumber()), propertyData, true);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getAdminDirectoryName()
*/
public String getAdminDirectoryName() {
return svnClient.getAdminDirectoryName();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#isAdminDirectory(java.lang.String)
*/
public boolean isAdminDirectory(String name) {
return svnClient.isAdminDirectory(name);
}
private void getLogMessages(String target, SVNRevision pegRevision, SVNRevision revisionStart, SVNRevision revisionEnd, boolean stopOnCopy, boolean fetchChangePath, long limit, boolean includeMergedRevisions, String[] requestedProperties, ISVNLogMessageCallback worker) throws SVNClientException {
try {
notificationHandler.setCommand(
ISVNNotifyListener.Command.LOG);
String logExtras = "";
if (includeMergedRevisions)
logExtras = logExtras + " -g";
if (stopOnCopy)
logExtras = logExtras + " --stop-on-copy";
if (limit > 0 )
logExtras = logExtras + " --limit " + limit;
notificationHandler.logCommandLine(
"log -r "
+ revisionStart.toString()
+ ":"
+ revisionEnd.toString()
+ " "
+ target
+ logExtras);
JhlLogMessageCallback callback = new JhlLogMessageCallback(worker);
svnClient.logMessages(target, JhlConverter.convert(pegRevision),
JhlConverter.convert(revisionStart),
JhlConverter.convert(revisionEnd),
stopOnCopy, fetchChangePath, includeMergedRevisions,
requestedProperties, limit, callback);
} catch (ClientException e) {
if (e.getAprError() == ErrorCodes.unsupportedFeature && includeMergedRevisions) {
getLogMessages(target, pegRevision, revisionStart, revisionEnd, stopOnCopy, fetchChangePath, limit, false, requestedProperties, worker);
} else {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
}
public void getLogMessages(
File path,
SVNRevision pegRevision,
SVNRevision revisionStart,
SVNRevision revisionEnd,
boolean stopOnCopy,
boolean fetchChangePath,
long limit,
boolean includeMergedRevisions,
String [] requestedProperties,
ISVNLogMessageCallback worker)
throws SVNClientException {
String target = fileToSVNPath(path, false);
notificationHandler.setBaseDir();
this.getLogMessages(target, pegRevision, revisionStart, revisionEnd, stopOnCopy, fetchChangePath, limit, includeMergedRevisions, requestedProperties, worker);
}
public void getLogMessages(
SVNUrl url,
SVNRevision pegRevision,
SVNRevision revisionStart,
SVNRevision revisionEnd,
boolean stopOnCopy,
boolean fetchChangePath,
long limit,
boolean includeMergedRevisions,
String [] requestedProperties,
ISVNLogMessageCallback worker)
throws SVNClientException {
String target = url.toString();
notificationHandler.setBaseDir();
this.getLogMessages(target, pegRevision, revisionStart, revisionEnd, stopOnCopy, fetchChangePath, limit, includeMergedRevisions, requestedProperties, worker);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#relocate(java.lang.String, java.lang.String, java.lang.String, boolean)
*/
public void relocate(String from, String to, String path, boolean recurse)
throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.RELOCATE);
if (recurse)
notificationHandler.logCommandLine("switch --relocate "+ from + " " + to + " " + path);
else
notificationHandler.logCommandLine("switch --relocate -N"+ from + " " + to + " " + path);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(new File(path)));
svnClient.relocate(from, to, path, recurse);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#diff(java.io.File, org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, boolean)
*/
public void diff(File path, SVNUrl url, SVNRevision urlRevision,
File outFile, boolean recurse) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.DIFF);
// we don't want canonical file path (otherwise the complete file name
// would be in the patch). This way the user can choose to use a relative
// path
String wcPath = fileToSVNPath(path, false);
String svnOutFile = fileToSVNPath(outFile, false);
String commandLine = "diff --old " + wcPath + " ";
commandLine += "--new " + url.toString();
if (!urlRevision.equals(SVNRevision.HEAD))
commandLine += "@"+ urlRevision.toString();
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
svnClient.diff(wcPath,Revision.WORKING,url.toString(),JhlConverter.convert(urlRevision), svnOutFile, recurse);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
public void mkdir(SVNUrl url, boolean makeParents, String message)
throws SVNClientException {
try {
String fixedMessage = fixSVNString(message);
if (fixedMessage == null)
fixedMessage = "";
notificationHandler.setCommand(ISVNNotifyListener.Command.MKDIR);
String target = url.toString();
if (makeParents)
notificationHandler.logCommandLine(
"mkdir --parents -m \""+getFirstMessageLine(fixedMessage)+"\" "+target);
else
notificationHandler.logCommandLine(
"mkdir -m \""+getFirstMessageLine(fixedMessage)+"\" "+target);
notificationHandler.setBaseDir();
svnClient.mkdir(new String[] { target },fixedMessage, makeParents, null);
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
public void merge(SVNUrl url, SVNRevision pegRevision, SVNRevisionRange[] revisions, File localPath, boolean force, int depth, boolean ignoreAncestry, boolean dryRun, boolean recordOnly) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.MERGE);
String target = fileToSVNPath(localPath, false);
String commandLine = "merge";
if (dryRun) {
commandLine += " --dry-run";
}
commandLine += depthCommandLine(depth);
if (force) {
commandLine += " --force";
}
if (ignoreAncestry) {
commandLine += " --ignore-ancestry";
}
RevisionRange[] range = JhlConverter.convert(revisions);
for (int i = 0; i < revisions.length; i++) {
commandLine += " " + revisions[i].toMergeString();
}
commandLine += " " + url.toString();
commandLine += " " + target;
notificationHandler.logCommandLine(commandLine);
File baseDir = SVNBaseDir.getBaseDir(localPath);
notificationHandler.setBaseDir(baseDir);
Revision peg = JhlConverter.convert(pegRevision);
if (peg == null) peg = Revision.HEAD;
svnClient.merge(url.toString(), peg, range, target, force, depth, ignoreAncestry, dryRun, recordOnly);
if (dryRun)
notificationHandler.logCompleted("Dry-run merge complete.");
else
notificationHandler.logCompleted("Merge complete.");
} catch (ClientException e) {
notificationHandler.logException(e);
if (dryRun)
notificationHandler.logCompleted("Dry-run merge completed abnormally.");
else
notificationHandler.logCompleted("Merge completed abnormally.");
SVNClientException svnClientException = new SVNClientException(e);
svnClientException.setAprError(e.getAprError());
throw svnClientException;
}
}
private String depthCommandLine(int depth) {
switch (depth) {
case Depth.empty:
return " --depth=empty";
case Depth.files:
return " --depth=files";
case Depth.immediates:
return " --depth=immediates";
case Depth.infinity:
return " --depth=infinity";
default:
return "";
}
}
public ISVNMergeInfo getMergeInfo(File path, SVNRevision revision) throws SVNClientException {
return this.getMergeInfo(fileToSVNPath(path, false), JhlConverter.convert(revision));
}
public ISVNMergeInfo getMergeInfo(SVNUrl url, SVNRevision revision) throws SVNClientException {
return this.getMergeInfo(url.toString(), JhlConverter.convert(revision));
}
private ISVNMergeInfo getMergeInfo(String path, Revision revision) throws SVNClientException {
try {
Mergeinfo info = svnClient.getMergeinfo(path, revision);
if (info == null) return null;
return new JhlMergeInfo(info);
} catch (SubversionException e) {
throw new SVNClientException(e);
}
}
public void addConflictResolutionCallback(ISVNConflictResolver callback) {
if (callback == null)
conflictResolver = null;
else
conflictResolver = new JhlConflictResolver(callback);
svnClient.setConflictResolver(conflictResolver);
}
public void setProgressListener(ISVNProgressListener listener) {
progressListener.setWorker(listener);
}
private SVNDiffSummary[] diffSummarize(String target1, SVNRevision revision1,
String target2, SVNRevision revision2, int depth,
boolean ignoreAncestry)
throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.DIFF);
if (revision1 == null)
revision1 = SVNRevision.HEAD;
if (revision2 == null)
revision2 = SVNRevision.HEAD;
String commandLine = "diff --summarize";
commandLine += depthCommandLine(depth);
if (ignoreAncestry)
commandLine += " --ignoreAncestry";
commandLine += " " + target1 + "@" + revision1 + " " + target2 + "@" + revision2;
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir();
JhlDiffSummaryReceiver callback = new JhlDiffSummaryReceiver();
svnClient.diffSummarize(target1, JhlConverter.convert(revision1), target2, JhlConverter.convert(revision2), depth, null, ignoreAncestry, callback);
return callback.getDiffSummary();
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
private SVNDiffSummary[] diffSummarize(String target, SVNRevision pegRevision,
SVNRevision startRevision, SVNRevision endRevision, int depth,
boolean ignoreAncestry)
throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.DIFF);
if (pegRevision == null)
pegRevision = SVNRevision.HEAD;
if (startRevision == null)
startRevision = SVNRevision.HEAD;
if (endRevision == null)
endRevision = SVNRevision.HEAD;
String commandLine = "diff --summarize";
commandLine += depthCommandLine(depth);
if (ignoreAncestry)
commandLine += " --ignoreAncestry";
commandLine += " -r " + startRevision + ":" + endRevision + " " + target;
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir();
JhlDiffSummaryReceiver callback = new JhlDiffSummaryReceiver();
svnClient.diffSummarize(target, JhlConverter.convert(pegRevision), JhlConverter.convert(startRevision), JhlConverter.convert(endRevision),
depth, null, ignoreAncestry, callback);
return callback.getDiffSummary();
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
public SVNDiffSummary[] diffSummarize(File path, SVNRevision pegRevision,
SVNRevision startRevision, SVNRevision endRevision, int depth,
boolean ignoreAncestry) throws SVNClientException {
String target = fileToSVNPath(path, false);
return this.diffSummarize(target, pegRevision,
startRevision, endRevision, depth, ignoreAncestry);
}
public SVNDiffSummary[] diffSummarize(SVNUrl url,
SVNRevision pegRevision, SVNRevision startRevision,
SVNRevision endRevision, int depth, boolean ignoreAncestry)
throws SVNClientException {
return this.diffSummarize(url.toString(), pegRevision,
startRevision, endRevision, depth, ignoreAncestry);
}
public SVNDiffSummary[] diffSummarize(File target1, SVNRevision revision1,
SVNUrl target2, SVNRevision revision2, int depth,
boolean ignoreAncestry) throws SVNClientException {
return diffSummarize(fileToSVNPath(target1, false), revision1,
target2.toString(), revision2, depth,
ignoreAncestry);
}
public SVNDiffSummary[] diffSummarize(SVNUrl target1,
SVNRevision revision1, SVNUrl target2, SVNRevision revision2,
int depth, boolean ignoreAncestry) throws SVNClientException {
return diffSummarize(target1.toString(), revision1,
target2.toString(), revision2, depth,
ignoreAncestry);
}
public String[] suggestMergeSources(File path) throws SVNClientException {
try {
return svnClient.suggestMergeSources(fileToSVNPath(path, false), Revision.HEAD);
} catch (SubversionException e) {
throw new SVNClientException(e);
}
}
public String[] suggestMergeSources(SVNUrl url, SVNRevision peg) throws SVNClientException {
try {
return svnClient.suggestMergeSources(url.toString(), JhlConverter.convert(peg));
} catch (SubversionException e) {
throw new SVNClientException(e);
}
}
public void createPatch(File[] paths, File relativeToPath, File outFile,
boolean recurse) throws SVNClientException {
FileOutputStream os = null;
try {
ArrayList tempFiles = new ArrayList();
for (int i = 0; i < paths.length; i++) {
File tempFile = File.createTempFile("tempDiff", ".txt");
tempFile.deleteOnExit();
this.diffRelative(paths[i], SVNRevision.BASE, paths[i], SVNRevision.WORKING,
tempFile, recurse, false, false, false,
relativeToPath);
tempFiles.add(tempFile);
}
os = new FileOutputStream(outFile);
Iterator iter = tempFiles.iterator();
while (iter.hasNext()) {
File tempFile = (File)iter.next();
FileInputStream is = new FileInputStream(tempFile);
byte[] buffer = new byte[4096];
int bytes_read;
while ((bytes_read = is.read(buffer)) != -1)
os.write(buffer, 0, bytes_read);
is.close();
}
} catch (Exception e) {
throw new SVNClientException(e);
} finally {
if (os != null) try {os.close();} catch (IOException e) {}
}
}
public void dispose() {
svnClient.dispose();
}
public ISVNLogMessage[] getMergeinfoLog(int kind, File path,
SVNRevision pegRevision, SVNUrl mergeSourceUrl,
SVNRevision srcPegRevision, boolean discoverChangedPaths)
throws SVNClientException {
return this.getMergeinfoLog(kind, fileToSVNPath(path, false), pegRevision, mergeSourceUrl, srcPegRevision, discoverChangedPaths);
}
public ISVNLogMessage[] getMergeinfoLog(int kind, SVNUrl url,
SVNRevision pegRevision, SVNUrl mergeSourceUrl,
SVNRevision srcPegRevision, boolean discoverChangedPaths)
throws SVNClientException {
return this.getMergeinfoLog(kind, url.toString(), pegRevision, mergeSourceUrl, srcPegRevision, discoverChangedPaths);
}
private ISVNLogMessage[] getMergeinfoLog(int kind, String target,
SVNRevision pegRevision, SVNUrl mergeSourceUrl,
SVNRevision srcPegRevision, boolean discoverChangedPaths)
throws SVNClientException {
try {
notificationHandler.setCommand(
ISVNNotifyListener.Command.MERGEINFO);
String show = "";
if (kind == ISVNMergeinfoLogKind.eligible)
show = show + " --show-revs eligible ";
if (kind == ISVNMergeinfoLogKind.merged)
show = show + " --show-revs merged ";
notificationHandler.logCommandLine(
"mergeinfo "
+ show
+ mergeSourceUrl.toString()
+ " "
+ target);
SVNLogMessageCallback worker = new SVNLogMessageCallback();
JhlLogMessageCallback callback = new JhlLogMessageCallback(worker);
svnClient.getMergeinfoLog(kind, target, JhlConverter.convert(pegRevision),
mergeSourceUrl.toString(), JhlConverter.convert(srcPegRevision),
discoverChangedPaths, ISVNClientAdapter.DEFAULT_LOG_PROPERTIES, callback);
return worker.getLogMessages();
} catch (ClientException e) {
if (e.getAprError() == ErrorCodes.unsupportedFeature) {
return this.getLogMessages(mergeSourceUrl, srcPegRevision, new SVNRevision.Number(0), SVNRevision.HEAD, true, discoverChangedPaths, 0, false);
}
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
private String appendPaths(String commandLine, String[] paths) {
StringBuffer stringBuffer = new StringBuffer(commandLine);
if (paths.length > 5) stringBuffer.append(" (" + paths.length + " paths specified)");
else {
for (int i = 0; i < paths.length; i++) stringBuffer.append(" " + paths[i]);
}
return stringBuffer.toString();
}
private String getFirstMessageLine(String message) {
StringTokenizer tokenizer = new StringTokenizer(message, "\n");
int count = tokenizer.countTokens();
if (count > 1) return tokenizer.nextToken() + "...";
else return message;
}
/**
* Applies any SVN rules to strings (commit messages and property values).
* Currently that means making all line-endings LF
* @param message
* @return
*/
protected String fixSVNString(String message) {
if (message == null)
return null;
// Normalize all line endings to LF
return message.replaceAll("\r\n", "\n").replaceAll("\r", "\n");
}
}
././@LongLink 0000000 0000000 0000000 00000000153 00000000000 011564 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlLock.java libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlLoc0000644 0000000 0000000 00000004644 10613664631 032646 0 ustar root root /*******************************************************************************
* Copyright (c) 2005, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.javahl;
import java.util.Date;
import org.tigris.subversion.javahl.Lock;
import org.tigris.subversion.svnclientadapter.ISVNLock;
/**
* A JavaHL based implementation of {@link ISVNLock}.
* Actually just an adapter from {@link org.tigris.subversion.javahl.Lock}
*
* @author Mark Phippard
*/
public class JhlLock implements ISVNLock {
private Lock _l;
/**
* Constructor
* @param lock
*/
public JhlLock(Lock lock) {
super();
_l = lock;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNLock#getOwner()
*/
public String getOwner() {
return _l.getOwner();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNLock#getPath()
*/
public String getPath() {
return _l.getPath();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNLock#getToken()
*/
public String getToken() {
return _l.getToken();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNLock#getComment()
*/
public String getComment() {
return _l.getComment();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNLock#getCreationDate()
*/
public Date getCreationDate() {
return _l.getCreationDate();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNLock#getExpirationDate()
*/
public Date getExpirationDate() {
return _l.getExpirationDate();
}
}
././@LongLink 0000000 0000000 0000000 00000000153 00000000000 011564 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlInfo.java libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlInf0000644 0000000 0000000 00000013353 11154264136 032637 0 ustar root root /*******************************************************************************
* Copyright (c) 2005, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.javahl;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Date;
import org.tigris.subversion.javahl.Depth;
import org.tigris.subversion.javahl.Info;
import org.tigris.subversion.svnclientadapter.ISVNInfo;
import org.tigris.subversion.svnclientadapter.SVNNodeKind;
import org.tigris.subversion.svnclientadapter.SVNScheduleKind;
import org.tigris.subversion.svnclientadapter.SVNUrl;
import org.tigris.subversion.svnclientadapter.SVNRevision.Number;
/**
* A JavaHL based implementation of {@link ISVNInfo}.
* Actually just an adapter from {@link org.tigris.subversion.javahl.Info}
*
* @author Cédric Chabanois
*/
public class JhlInfo implements ISVNInfo {
private Info info;
private File file;
/**
* Constructor
* @param file
* @param info
*/
public JhlInfo(File file, Info info) {
super();
this.file = file;
this.info = info;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getFile()
*/
public File getFile() {
try {
return file.getCanonicalFile();
} catch (IOException e) {
return null;
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getUrl()
*/
public SVNUrl getUrl() {
try {
return new SVNUrl(info.getUrl());
} catch (MalformedURLException e) {
//should never happen.
return null;
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getUrlString()
*/
public String getUrlString() {
return info.getUrl();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getUuid()
*/
public String getUuid() {
return info.getUuid();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getRepository()
*/
public SVNUrl getRepository() {
try {
return new SVNUrl(info.getRepository());
} catch (MalformedURLException e) {
//should never happen.
return null;
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getSchedule()
*/
public SVNScheduleKind getSchedule() {
return JhlConverter.convertScheduleKind(info.getSchedule());
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getNodeKind()
*/
public SVNNodeKind getNodeKind() {
return JhlConverter.convertNodeKind(info.getNodeKind());
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getAuthor()
*/
public String getLastCommitAuthor() {
return info.getAuthor();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getRevision()
*/
public Number getRevision() {
return JhlConverter.convertRevisionNumber(info.getRevision());
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLastChangedRevision()
*/
public Number getLastChangedRevision() {
return JhlConverter.convertRevisionNumber(info.getLastChangedRevision());
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLastChangedDate()
*/
public Date getLastChangedDate() {
return info.getLastChangedDate();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLastDateTextUpdate()
*/
public Date getLastDateTextUpdate() {
return info.getLastDateTextUpdate();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLastDatePropsUpdate()
*/
public Date getLastDatePropsUpdate() {
return info.getLastDatePropsUpdate();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#isCopied()
*/
public boolean isCopied() {
return (info.getCopyRev() > 0);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getCopyRev()
*/
public Number getCopyRev() {
return JhlConverter.convertRevisionNumber(info.getCopyRev());
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getCopyUrl()
*/
public SVNUrl getCopyUrl() {
try {
return new SVNUrl(info.getCopyUrl());
} catch (MalformedURLException e) {
//should never happen.
return null;
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLockCreationDate()
*/
public Date getLockCreationDate() {
//Not available in info(1)
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLockOwner()
*/
public String getLockOwner() {
//Not available in info(1)
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLockComment()
*/
public String getLockComment() {
//Not available in info(1)
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getDepth()
*/
public int getDepth() {
//Not available in info(1)
return Depth.unknown;
}
}
././@LongLink 0000000 0000000 0000000 00000000157 00000000000 011570 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlDirEntry.java libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlDir0000644 0000000 0000000 00000005374 10613664631 032650 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.javahl;
import java.util.Date;
import org.tigris.subversion.javahl.DirEntry;
import org.tigris.subversion.svnclientadapter.ISVNDirEntry;
import org.tigris.subversion.svnclientadapter.SVNNodeKind;
import org.tigris.subversion.svnclientadapter.SVNRevision;
/**
* A JavaHL based implementation of {@link ISVNDirEntry}.
* Actually just an adapter from {@link org.tigris.subversion.javahl.DirEntry}
*
* @author philip schatz
*/
public class JhlDirEntry implements ISVNDirEntry {
private DirEntry _d;
/**
* Constructor
* @param d
*/
public JhlDirEntry(DirEntry d) {
super();
_d = d;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNDirEntry#getNodeKind()
*/
public SVNNodeKind getNodeKind() {
return JhlConverter.convertNodeKind(_d.getNodeKind());
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNDirEntry#getHasProps()
*/
public boolean getHasProps() {
return _d.getHasProps();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNDirEntry#getLastChangedRevision()
*/
public SVNRevision.Number getLastChangedRevision() {
return (SVNRevision.Number)JhlConverter.convert(_d.getLastChangedRevision());
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNDirEntry#getLastChangedDate()
*/
public Date getLastChangedDate() {
return _d.getLastChanged();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNDirEntry#getLastCommitAuthor()
*/
public String getLastCommitAuthor() {
return _d.getLastAuthor();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNDirEntry#getPath()
*/
public String getPath() {
return _d.getPath();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNDirEntry#getSize()
*/
public long getSize() {
return _d.getSize();
}
}
././@LongLink 0000000 0000000 0000000 00000000167 00000000000 011571 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlConflictResolver.java libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlCon0000644 0000000 0000000 00000002045 10710401364 032627 0 ustar root root package org.tigris.subversion.svnclientadapter.javahl;
import org.tigris.subversion.javahl.ConflictDescriptor;
import org.tigris.subversion.javahl.ConflictResolverCallback;
import org.tigris.subversion.javahl.ConflictResult;
import org.tigris.subversion.javahl.SubversionException;
import org.tigris.subversion.svnclientadapter.ISVNConflictResolver;
import org.tigris.subversion.svnclientadapter.SVNClientException;
import org.tigris.subversion.svnclientadapter.SVNConflictResult;
public class JhlConflictResolver implements ConflictResolverCallback {
ISVNConflictResolver worker;
public JhlConflictResolver(ISVNConflictResolver worker) {
super();
this.worker = worker;
}
public ConflictResult resolve(ConflictDescriptor descrip)
throws SubversionException {
try {
SVNConflictResult svnConflictResult = worker.resolve(JhlConverter.convertConflictDescriptor(descrip));
return new ConflictResult(svnConflictResult.getChoice(), svnConflictResult.getMergedPath());
} catch (SVNClientException e) {
throw new JhlException(e);
}
}
}
././@LongLink 0000000 0000000 0000000 00000000172 00000000000 011565 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlDiffSummaryReceiver.java libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlDif0000644 0000000 0000000 00000001222 10664574003 032617 0 ustar root root package org.tigris.subversion.svnclientadapter.javahl;
import java.util.ArrayList;
import java.util.List;
import org.tigris.subversion.javahl.DiffSummary;
import org.tigris.subversion.javahl.DiffSummaryReceiver;
import org.tigris.subversion.svnclientadapter.SVNDiffSummary;
public class JhlDiffSummaryReceiver implements DiffSummaryReceiver {
List summary = new ArrayList();
public void onSummary(DiffSummary descriptor) {
summary.add(JhlConverter.convert(descriptor));
}
public SVNDiffSummary[] getDiffSummary() {
SVNDiffSummary[] diffSummary = new SVNDiffSummary[summary.size()];
summary.toArray(diffSummary);
return diffSummary;
}
}
././@LongLink 0000000 0000000 0000000 00000000171 00000000000 011564 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/SVNUrlWithPegRevision.java libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/SVNUrl0000644 0000000 0000000 00000002112 10773024562 032610 0 ustar root root package org.tigris.subversion.svnclientadapter.javahl;
import java.net.MalformedURLException;
import java.text.ParseException;
import org.tigris.subversion.svnclientadapter.SVNRevision;
import org.tigris.subversion.svnclientadapter.SVNUrl;
public class SVNUrlWithPegRevision {
private SVNUrl url;
private SVNRevision pegRevision;
public SVNUrlWithPegRevision(SVNUrl url) {
parse(url);
}
public SVNUrl getUrl() {
return url;
}
public SVNRevision getPegRevision() {
return pegRevision;
}
private void parse(SVNUrl url) {
String urlString = url.toString();
if (!urlString.endsWith("@")) {
int index = urlString.lastIndexOf("@");
if (index != -1) {
String rev = urlString.substring(index + 1);
try {
pegRevision = SVNRevision.getRevision(rev);
} catch (ParseException e) {}
if (pegRevision != null) {
urlString = urlString.substring(0, index);
try {
this.url = new SVNUrl(urlString);
} catch (MalformedURLException e) {
this.url = url;
pegRevision = null;
}
return;
}
}
}
this.url = url;
}
}
././@LongLink 0000000 0000000 0000000 00000000160 00000000000 011562 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlMergeInfo.java libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlMer0000644 0000000 0000000 00000004777 10776470217 032670 0 ustar root root /*******************************************************************************
* Copyright (c) 2007 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.javahl;
import java.util.Iterator;
import java.util.List;
import org.tigris.subversion.javahl.Mergeinfo;
import org.tigris.subversion.javahl.RevisionRange;
import org.tigris.subversion.svnclientadapter.ISVNMergeInfo;
import org.tigris.subversion.svnclientadapter.SVNRevisionRange;
public class JhlMergeInfo implements ISVNMergeInfo {
Mergeinfo info;
public JhlMergeInfo() {
super();
info = new Mergeinfo();
}
public JhlMergeInfo(Mergeinfo info) {
super();
this.info = info;
}
public void addRevisionRange(String path, SVNRevisionRange range) {
if (info == null)
info = new Mergeinfo();
info.addRevisionRange(path, JhlConverter.convert(range));
}
public void addRevisions(String path, SVNRevisionRange[] range) {
if (info == null)
info = new Mergeinfo();
info.addRevisions(path, JhlConverter.convert(range));
}
public String[] getPaths() {
if (info == null)
return null;
return info.getPaths();
}
public SVNRevisionRange[] getRevisionRange(String path) {
if (info == null)
return null;
return JhlConverter.convert(info.getRevisionRange(path));
}
public SVNRevisionRange[] getRevisions(String path) {
if (info == null)
return null;
List rangeList = info.getRevisions(path);
SVNRevisionRange[] range = new SVNRevisionRange[rangeList.size()];
int i = 0;
for (Iterator iter = rangeList.iterator(); iter.hasNext();) {
range[i] = JhlConverter.convert((RevisionRange) iter.next());
}
return range;
}
public void loadFromMergeInfoProperty(String mergeInfo) {
if (info == null)
info = new Mergeinfo();
info.loadFromMergeinfoProperty(mergeInfo);
}
}
././@LongLink 0000000 0000000 0000000 00000000173 00000000000 011566 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlClientAdapterFactory.java libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlCli0000644 0000000 0000000 00000030476 11164447205 032640 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.javahl;
import org.tigris.subversion.javahl.SVNClient;
import org.tigris.subversion.javahl.SVNClientInterface;
import org.tigris.subversion.javahl.Version;
import org.tigris.subversion.svnclientadapter.ISVNClientAdapter;
import org.tigris.subversion.svnclientadapter.SVNClientAdapterFactory;
import org.tigris.subversion.svnclientadapter.SVNClientException;
/**
* Concrete implementation of SVNClientAdapterFactory for javahl interface.
* To register this factory, just call {@link JhlClientAdapterFactory#setup()}
*/
public class JhlClientAdapterFactory extends SVNClientAdapterFactory {
private static boolean availabilityCached = false;
private static boolean available;
private static StringBuffer javaHLErrors = new StringBuffer("Failed to load JavaHL Library.\nThese are the errors that were encountered:\n");
/** Client adapter implementation identifier */
public static final String JAVAHL_CLIENT = "javahl";
/**
* Private constructor.
* Clients are expected the use {@link #createSVNClientImpl()}, res.
* ask the {@link SVNClientAdapterFactory}
*/
private JhlClientAdapterFactory() {
super();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.SVNClientAdapterFactory#createSVNClientImpl()
*/
protected ISVNClientAdapter createSVNClientImpl() {
return new JhlClientAdapter();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.SVNClientAdapterFactory#getClientType()
*/
protected String getClientType() {
return JAVAHL_CLIENT;
}
/**
* Setup the client adapter implementation and register it in the adapters factory
* @throws SVNClientException
*/
public static void setup() throws SVNClientException {
if (!isAvailable()) {
throw new SVNClientException("Javahl client adapter is not available");
}
SVNClientAdapterFactory.registerAdapterFactory(new JhlClientAdapterFactory());
}
public static boolean isAvailable() {
if (!availabilityCached) {
Class c = null;
try {
// load a JavaHL class to see if it is found. Do not use SVNClient as
// it will try to load native libraries and we do not want that yet
c = Class.forName("org.tigris.subversion.javahl.ClientException");
if (c == null)
return false;
} catch (Throwable t) {
availabilityCached = true;
return false;
}
// if library is already loaded, it will not be reloaded
//workaround to solve Subclipse ISSUE #83
// we will ignore these exceptions to handle scenarios where
// javaHL was built diffently. Ultimately, if javaHL fails to load
// because of a problem in one of these libraries the proper behavior
// will still occur -- meaning JavaHL adapter is disabled.
if(isOsWindows()) {
StringBuffer bdbErrors = new StringBuffer();
boolean bdbLoaded = false;
// try {
// System.loadLibrary("libapr");
// } catch (Exception e) {
// javaHLErrors.append(e.getMessage()).append("\n");
// } catch (UnsatisfiedLinkError e) {
// javaHLErrors.append(e.getMessage()).append("\n");
// }
try {
System.loadLibrary("libapr-1");
} catch (Exception e) {
javaHLErrors.append(e.getMessage()).append("\n");
} catch (UnsatisfiedLinkError e) {
javaHLErrors.append(e.getMessage()).append("\n");
}
try {
System.loadLibrary("libapriconv-1");
} catch (Exception e) {
javaHLErrors.append(e.getMessage()).append("\n");
} catch (UnsatisfiedLinkError e) {
javaHLErrors.append(e.getMessage()).append("\n");
}
try {
System.loadLibrary("libeay32");
} catch (Exception e) {
javaHLErrors.append(e.getMessage()).append("\n");
} catch (UnsatisfiedLinkError e) {
javaHLErrors.append(e.getMessage()).append("\n");
}
try {
System.loadLibrary("libdb44");
bdbLoaded = true;
} catch (Exception e) {
bdbErrors.append(e.getMessage()).append("\n");
} catch (UnsatisfiedLinkError e) {
bdbErrors.append(e.getMessage()).append("\n");
}
// try {
// System.loadLibrary("libdb43");
// bdbLoaded = true;
// } catch (Exception e) {
// bdbErrors.append(e.getMessage()).append("\n");
// } catch (UnsatisfiedLinkError e) {
// bdbErrors.append(e.getMessage()).append("\n");
// }
if (!bdbLoaded) {
javaHLErrors.append(bdbErrors.toString());
}
try {
System.loadLibrary("ssleay32");
} catch (Exception e) {
javaHLErrors.append(e.getMessage()).append("\n");
} catch (UnsatisfiedLinkError e) {
javaHLErrors.append(e.getMessage()).append("\n");
}
// try {
// System.loadLibrary("libaprutil");
// } catch (Exception e) {
// javaHLErrors.append(e.getMessage()).append("\n");
// } catch (UnsatisfiedLinkError e) {
// javaHLErrors.append(e.getMessage()).append("\n");
// }
try {
System.loadLibrary("libaprutil-1");
} catch (Exception e) {
javaHLErrors.append(e.getMessage()).append("\n");
} catch (UnsatisfiedLinkError e) {
javaHLErrors.append(e.getMessage()).append("\n");
}
try {
System.loadLibrary("intl3_svn");
} catch (Exception e) {
javaHLErrors.append(e.getMessage()).append("\n");
} catch (UnsatisfiedLinkError e) {
javaHLErrors.append(e.getMessage()).append("\n");
}
try {
System.loadLibrary("dbghelp");
} catch (Exception e) {
javaHLErrors.append(e.getMessage()).append("\n");
} catch (UnsatisfiedLinkError e) {
javaHLErrors.append(e.getMessage()).append("\n");
}
try {
System.loadLibrary("libsasl");
} catch (Exception e) {
javaHLErrors.append(e.getMessage()).append("\n");
} catch (UnsatisfiedLinkError e) {
javaHLErrors.append(e.getMessage()).append("\n");
}
// Load DLL's for Subversion libraries -- as of 1.5
try {
System.loadLibrary("libsvn_subr-1");
} catch (Exception e) {
javaHLErrors.append(e.getMessage()).append("\n");
} catch (UnsatisfiedLinkError e) {
javaHLErrors.append(e.getMessage()).append("\n");
}
try {
System.loadLibrary("libsvn_delta-1");
} catch (Exception e) {
javaHLErrors.append(e.getMessage()).append("\n");
} catch (UnsatisfiedLinkError e) {
javaHLErrors.append(e.getMessage()).append("\n");
}
try {
System.loadLibrary("libsvn_diff-1");
} catch (Exception e) {
javaHLErrors.append(e.getMessage()).append("\n");
} catch (UnsatisfiedLinkError e) {
javaHLErrors.append(e.getMessage()).append("\n");
}
try {
System.loadLibrary("libsvn_wc-1");
} catch (Exception e) {
javaHLErrors.append(e.getMessage()).append("\n");
} catch (UnsatisfiedLinkError e) {
javaHLErrors.append(e.getMessage()).append("\n");
}
try {
System.loadLibrary("libsvn_fs-1");
} catch (Exception e) {
javaHLErrors.append(e.getMessage()).append("\n");
} catch (UnsatisfiedLinkError e) {
javaHLErrors.append(e.getMessage()).append("\n");
}
try {
System.loadLibrary("libsvn_repos-1");
} catch (Exception e) {
javaHLErrors.append(e.getMessage()).append("\n");
} catch (UnsatisfiedLinkError e) {
javaHLErrors.append(e.getMessage()).append("\n");
}
try {
System.loadLibrary("libsvn_ra-1");
} catch (Exception e) {
javaHLErrors.append(e.getMessage()).append("\n");
} catch (UnsatisfiedLinkError e) {
javaHLErrors.append(e.getMessage()).append("\n");
}
try {
System.loadLibrary("libsvn_client-1");
} catch (Exception e) {
javaHLErrors.append(e.getMessage()).append("\n");
} catch (UnsatisfiedLinkError e) {
javaHLErrors.append(e.getMessage()).append("\n");
}
}
//workaround to solve Subclipse ISSUE #83
available = false;
try {
/*
* see if the user has specified the fully qualified path to the native
* library
*/
try
{
String specifiedLibraryName =
System.getProperty("subversion.native.library");
if(specifiedLibraryName != null) {
System.load(specifiedLibraryName);
available = true;
}
}
catch(UnsatisfiedLinkError ex)
{
javaHLErrors.append(ex.getMessage()).append("\n");
}
if (!available) {
/*
* first try to load the library by the new name.
* if that fails, try to load the library by the old name.
*/
try
{
System.loadLibrary("libsvnjavahl-1");
}
catch(UnsatisfiedLinkError ex)
{
javaHLErrors.append(ex.getMessage() + "\n");
try
{
System.loadLibrary("svnjavahl-1");
}
catch (UnsatisfiedLinkError e)
{
javaHLErrors.append(e.getMessage()).append("\n");
System.loadLibrary("svnjavahl");
}
}
available = true;
}
} catch (Exception e) {
available = false;
javaHLErrors.append(e.getMessage()).append("\n");
} catch (UnsatisfiedLinkError e) {
available = false;
javaHLErrors.append(e.getMessage()).append("\n");
} finally {
availabilityCached = true;
}
if (!available) {
String libraryPath = System.getProperty("java.library.path");
if (libraryPath != null)
javaHLErrors.append("java.library.path = " + libraryPath);
// System.out.println(javaHLErrors.toString());
} else {
// At this point, the library appears to be available, but
// it could be too old version of JavaHL library. We have to try
// to get the version of the library to be sure.
try {
SVNClientInterface svnClient = new SVNClient();
Version version = svnClient.getVersion();
if (version.getMajor() == 1 && version.getMinor() == 6)
available = true;
else {
available = false;
javaHLErrors = new StringBuffer("Incompatible JavaHL library loaded. 1.6.x or later required.");
}
} catch (UnsatisfiedLinkError e) {
available = false;
javaHLErrors = new StringBuffer("Incompatible JavaHL library loaded. 1.6.x or later required.");
}
}
}
return available;
}
/**
* Answer whether running on Windows OS.
* (Actual code extracted from org.apache.commons.lang.SystemUtils.IS_OS_WINDOWS)
* (For such one simple method it does make sense to introduce dependency on whole commons-lang.jar)
* @return true when the underlying
*/
public static boolean isOsWindows()
{
try {
return System.getProperty("os.name").startsWith("Windows");
} catch (SecurityException ex) {
// we are not allowed to look at this property
return false;
}
}
/**
* @return an error string describing problems during loading platform native libraries (if any)
*/
public static String getLibraryLoadErrors() {
if (isAvailable())
return "";
else
return javaHLErrors.toString();
}
}
././@LongLink 0000000 0000000 0000000 00000000161 00000000000 011563 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlLogMessage.java libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlLog0000644 0000000 0000000 00000010224 11035734453 032640 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.javahl;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.tigris.subversion.javahl.ChangePath;
import org.tigris.subversion.javahl.LogDate;
import org.tigris.subversion.svnclientadapter.ISVNLogMessage;
import org.tigris.subversion.svnclientadapter.ISVNLogMessageChangePath;
import org.tigris.subversion.svnclientadapter.SVNRevision;
/**
* A JavaHL based implementation of {@link ISVNLogMessage}.
* Actually just an adapter from {@link org.tigris.subversion.javahl.LogMessage}
*
* @author philip schatz
*/
public class JhlLogMessage implements ISVNLogMessage {
private static final String EMPTY = "";
private List children;
private boolean hasChildren;
private ISVNLogMessageChangePath[] changedPaths;
private SVNRevision.Number revision;
private Map revprops;
private LogDate logDate;
public JhlLogMessage(ChangePath[] changedPaths, long revision, Map revprops, boolean hasChildren) {
this.changedPaths = JhlConverter.convert(changedPaths);
this.revision = new SVNRevision.Number(revision);
this.revprops = revprops;
if (this.revprops == null) {
this.revprops = new HashMap(2); // avoid NullPointerErrors
this.revprops.put(AUTHOR, EMPTY);
this.revprops.put(MESSAGE, EMPTY);
}
this.hasChildren = hasChildren;
try {
logDate = new LogDate((String) this.revprops.get(DATE));
} catch (ParseException e) {
}
}
public void addChild(ISVNLogMessage msg) {
if (children == null)
children = new ArrayList();
children.add(msg);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNLogMessage#getRevision()
*/
public SVNRevision.Number getRevision() {
return revision;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNLogMessage#getAuthor()
*/
public String getAuthor() {
return (String) revprops.get(AUTHOR);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNLogMessage#getDate()
*/
public Date getDate() {
if (logDate == null)
return new Date(0L);
return logDate.getDate();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNLogMessage#getMessage()
*/
public String getMessage() {
return (String) revprops.get(MESSAGE);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNLogMessage#getChangedPaths()
*/
public ISVNLogMessageChangePath[] getChangedPaths() {
return changedPaths;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
return getMessage();
}
public ISVNLogMessage[] getChildMessages() {
if (hasChildren && children != null) {
ISVNLogMessage[] childArray = new JhlLogMessage[children.size()];
children.toArray(childArray);
return childArray;
} else
return null;
}
public long getNumberOfChildren() {
if (hasChildren && children != null)
return children.size();
else
return 0L;
}
public long getTimeMillis() {
if (logDate == null)
return 0L;
return logDate.getTimeMillis();
}
public long getTimeMicros() {
if (logDate == null)
return 0L;
return logDate.getTimeMicros();
}
public boolean hasChildren() {
return hasChildren;
}
}
././@LongLink 0000000 0000000 0000000 00000000160 00000000000 011562 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlConverter.java libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlCon0000644 0000000 0000000 00000027357 11147073645 032660 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.javahl;
import java.util.logging.Logger;
import org.tigris.subversion.javahl.ChangePath;
import org.tigris.subversion.javahl.ConflictDescriptor;
import org.tigris.subversion.javahl.ConflictResult;
import org.tigris.subversion.javahl.DiffSummary;
import org.tigris.subversion.javahl.DirEntry;
import org.tigris.subversion.javahl.Lock;
import org.tigris.subversion.javahl.NodeKind;
import org.tigris.subversion.javahl.Revision;
import org.tigris.subversion.javahl.RevisionKind;
import org.tigris.subversion.javahl.RevisionRange;
import org.tigris.subversion.javahl.ScheduleKind;
import org.tigris.subversion.javahl.Status;
import org.tigris.subversion.javahl.StatusKind;
import org.tigris.subversion.svnclientadapter.ISVNLogMessageChangePath;
import org.tigris.subversion.svnclientadapter.SVNConflictDescriptor;
import org.tigris.subversion.svnclientadapter.SVNConflictResult;
import org.tigris.subversion.svnclientadapter.SVNConflictVersion;
import org.tigris.subversion.svnclientadapter.SVNDiffSummary;
import org.tigris.subversion.svnclientadapter.SVNLogMessageChangePath;
import org.tigris.subversion.svnclientadapter.SVNNodeKind;
import org.tigris.subversion.svnclientadapter.SVNRevision;
import org.tigris.subversion.svnclientadapter.SVNRevisionRange;
import org.tigris.subversion.svnclientadapter.SVNScheduleKind;
import org.tigris.subversion.svnclientadapter.SVNStatusKind;
/**
* Convert from javahl types to subversion.svnclientadapter.* types
*
* @author philip schatz
*/
public class JhlConverter {
private static final Logger log = Logger.getLogger(JhlConverter.class.getName());
private JhlConverter() {
//non-instantiable
}
/**
* Convert clientAdapter's {@link SVNRevision} into JavaHL's {@link Revision}
* @param svnRevision
* @return a {@link Revision} representing suppplied SVNRevision
*/
public static Revision convert(SVNRevision svnRevision) {
if (svnRevision == null)
return null;
switch(svnRevision.getKind()) {
case SVNRevision.Kind.base : return Revision.BASE;
case SVNRevision.Kind.committed : return Revision.COMMITTED;
case SVNRevision.Kind.date : return new Revision.DateSpec(((SVNRevision.DateSpec)svnRevision).getDate());
case SVNRevision.Kind.head : return Revision.HEAD;
case SVNRevision.Kind.number : return new Revision.Number(((SVNRevision.Number)svnRevision).getNumber());
case SVNRevision.Kind.previous : return Revision.PREVIOUS;
case SVNRevision.Kind.unspecified : return Revision.START;
case SVNRevision.Kind.working : return Revision.WORKING;
default: {
log.severe("unknown revision kind :"+svnRevision.getKind());
return Revision.START; // should never go here
}
}
}
/**
* Convert clientAdapter's {@link SVNRevisionRange} into JavaHL's {@link RevisionRange}
* @param svnRevisionRange
* @return a {@link RevisionRange} representing suppplied SVNRevisionRange
*/
public static RevisionRange convert(SVNRevisionRange svnRevisionRange) {
return new RevisionRange(JhlConverter.convert(svnRevisionRange.getFromRevision()), JhlConverter.convert(svnRevisionRange.getToRevision()));
}
/**
* Convert JavaHL's {@link RevisionRange} into clientAdapter's {@link SVNRevisionRange}
* @param RevisionRange
* @return a {@link SVNRevisionRange} representing suppplied RevisionRange
*/
public static SVNRevisionRange convert(RevisionRange svnRevisionRange) {
return new SVNRevisionRange(JhlConverter.convert(svnRevisionRange.getFromRevision()), JhlConverter.convert(svnRevisionRange.getToRevision()));
}
public static SVNRevisionRange[] convert(RevisionRange[] jhlRange) {
SVNRevisionRange[] range = new SVNRevisionRange[jhlRange.length];
for(int i=0; i < jhlRange.length; i++) {
range[i] = JhlConverter.convert(jhlRange[i]);
}
return range;
}
public static RevisionRange[] convert(SVNRevisionRange[] range) {
RevisionRange[] jhlRange = new RevisionRange[range.length];
for(int i=0; i < range.length; i++) {
jhlRange[i] = JhlConverter.convert(range[i]);
}
return jhlRange;
}
/**
* Convert JavaHL's {@link Revision} into clientAdapter's {@link SVNRevision}
* @param rev
* @return a {@link SVNRevision} representing suppplied Revision
*/
public static SVNRevision convert(Revision rev) {
if (rev == null) return null;
switch (rev.getKind()) {
case RevisionKind.base :
return SVNRevision.BASE;
case RevisionKind.committed :
return SVNRevision.COMMITTED;
case RevisionKind.number :
Revision.Number n = (Revision.Number) rev;
if (n.getNumber() == -1) {
// we return null when resource is not managed ...
return null;
} else {
return new SVNRevision.Number(n.getNumber());
}
case RevisionKind.previous :
return SVNRevision.PREVIOUS;
case RevisionKind.working :
return SVNRevision.WORKING;
default :
return SVNRevision.HEAD;
}
}
static SVNRevision.Number convertRevisionNumber(long revisionNumber) {
if (revisionNumber == -1) {
return null;
} else {
return new SVNRevision.Number(revisionNumber);
}
}
public static SVNNodeKind convertNodeKind(int javahlNodeKind) {
switch(javahlNodeKind) {
case NodeKind.dir : return SVNNodeKind.DIR;
case NodeKind.file : return SVNNodeKind.FILE;
case NodeKind.none : return SVNNodeKind.NONE;
case NodeKind.unknown : return SVNNodeKind.UNKNOWN;
default: {
log.severe("unknown node kind :"+javahlNodeKind);
return SVNNodeKind.UNKNOWN; // should never go here
}
}
}
public static JhlStatus convert(Status status) {
return new JhlStatus(status);
}
public static SVNStatusKind convertStatusKind(int kind) {
switch (kind) {
case StatusKind.none :
return SVNStatusKind.NONE;
case StatusKind.normal :
return SVNStatusKind.NORMAL;
case StatusKind.added :
return SVNStatusKind.ADDED;
case StatusKind.missing :
return SVNStatusKind.MISSING;
case StatusKind.incomplete :
return SVNStatusKind.INCOMPLETE;
case StatusKind.deleted :
return SVNStatusKind.DELETED;
case StatusKind.replaced :
return SVNStatusKind.REPLACED;
case StatusKind.modified :
return SVNStatusKind.MODIFIED;
case StatusKind.merged :
return SVNStatusKind.MERGED;
case StatusKind.conflicted :
return SVNStatusKind.CONFLICTED;
case StatusKind.obstructed :
return SVNStatusKind.OBSTRUCTED;
case StatusKind.ignored :
return SVNStatusKind.IGNORED;
case StatusKind.external:
return SVNStatusKind.EXTERNAL;
case StatusKind.unversioned :
return SVNStatusKind.UNVERSIONED;
default : {
log.severe("unknown status kind :"+kind);
return SVNStatusKind.NONE;
}
}
}
/**
* Wrap everything up.
* @param dirEntry
* @return an JhlDirEntry[] array constructed from the given DirEntry[]
*/
static JhlDirEntry[] convert(DirEntry[] dirEntry) {
JhlDirEntry[] entries = new JhlDirEntry[dirEntry.length];
for(int i=0; i < dirEntry.length; i++) {
entries[i] = new JhlDirEntry(dirEntry[i]);
}
return entries;
}
static JhlDirEntry convert(DirEntry dirEntry) {
return new JhlDirEntry(dirEntry);
}
public static JhlStatus[] convert(Status[] status) {
JhlStatus[] jhlStatus = new JhlStatus[status.length];
for(int i=0; i < status.length; i++) {
jhlStatus[i] = new JhlStatus(status[i]);
}
return jhlStatus;
}
static ISVNLogMessageChangePath[] convert(ChangePath[] changePaths) {
if (changePaths == null)
return new SVNLogMessageChangePath[0];
SVNLogMessageChangePath[] jhlChangePaths = new SVNLogMessageChangePath[changePaths.length];
for(int i=0; i < changePaths.length; i++) {
jhlChangePaths[i] = new JhlLogMessageChangePath(changePaths[i]);
}
return jhlChangePaths;
}
public static SVNScheduleKind convertScheduleKind(int kind) {
switch (kind) {
case ScheduleKind.normal:
return SVNScheduleKind.NORMAL;
case ScheduleKind.delete:
return SVNScheduleKind.DELETE;
case ScheduleKind.add:
return SVNScheduleKind.ADD;
case ScheduleKind.replace:
return SVNScheduleKind.REPLACE;
default : {
log.severe("unknown schedule kind :"+kind);
return SVNScheduleKind.NORMAL;
}
}
}
public static JhlLock convertLock(Lock lock) {
return new JhlLock(lock);
}
public static SVNConflictDescriptor convertConflictDescriptor(ConflictDescriptor d) {
if (d == null) return null;
SVNConflictVersion srcLeftVersion = null;
if (d.getSrcLeftVersion() != null) {
srcLeftVersion = new SVNConflictVersion(d.getSrcLeftVersion().getReposURL(), d.getSrcLeftVersion().getPegRevision(), d.getSrcLeftVersion().getPathInRepos(), d.getSrcLeftVersion().getNodeKind());
}
SVNConflictVersion srcRightVersion = null;
if (d.getSrcRightVersion() != null) {
srcRightVersion = new SVNConflictVersion(d.getSrcRightVersion().getReposURL(), d.getSrcRightVersion().getPegRevision(), d.getSrcRightVersion().getPathInRepos(), d.getSrcRightVersion().getNodeKind());
}
return new SVNConflictDescriptor(d.getPath(), d.getKind(), d.getNodeKind(),
d.getPropertyName(), d.isBinary(),
d.getMIMEType(), d.getAction(), d.getReason(), d.getOperation(),
srcLeftVersion, srcRightVersion,
d.getBasePath(), d.getTheirPath(),
d.getMyPath(), d.getMergedPath());
}
public static SVNConflictResult convertConflictResult(ConflictResult r) {
return new SVNConflictResult(r.getChoice(), r.getMergedPath());
}
public static SVNDiffSummary convert(DiffSummary d) {
return new SVNDiffSummary(d.getPath(), JhlConverter.convert(d.getDiffKind()),
d.propsChanged(), d.getNodeKind());
}
public static SVNDiffSummary.SVNDiffKind convert(DiffSummary.DiffKind d) {
if (d == DiffSummary.DiffKind.ADDED) {
return SVNDiffSummary.SVNDiffKind.ADDED;
} else if (d == DiffSummary.DiffKind.MODIFIED) {
return SVNDiffSummary.SVNDiffKind.MODIFIED;
} else if (d == DiffSummary.DiffKind.DELETED) {
return SVNDiffSummary.SVNDiffKind.DELETED;
} else {
return SVNDiffSummary.SVNDiffKind.NORMAL;
}
}
}
././@LongLink 0000000 0000000 0000000 00000000154 00000000000 011565 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlInfo2.java libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlInf0000644 0000000 0000000 00000013616 11154264136 032641 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.javahl;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Date;
import org.tigris.subversion.javahl.Depth;
import org.tigris.subversion.javahl.Info2;
import org.tigris.subversion.svnclientadapter.ISVNInfo;
import org.tigris.subversion.svnclientadapter.SVNNodeKind;
import org.tigris.subversion.svnclientadapter.SVNScheduleKind;
import org.tigris.subversion.svnclientadapter.SVNUrl;
import org.tigris.subversion.svnclientadapter.SVNRevision.Number;
/**
* A JavaHL based implementation of {@link ISVNInfo}.
* Actually just an adapter from {@link org.tigris.subversion.javahl.Info2}
*
* @author Cédric Chabanois
*/
public class JhlInfo2 implements ISVNInfo {
private Info2 info;
private File file;
/**
* Constructor
* @param file
* @param info
*/
public JhlInfo2(File file, Info2 info) {
super();
this.file = file;
this.info = info;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getFile()
*/
public File getFile() {
if (file == null) return null;
try {
return file.getCanonicalFile();
} catch (IOException e) {
return null;
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getUrl()
*/
public SVNUrl getUrl() {
try {
return new SVNUrl(info.getUrl());
} catch (MalformedURLException e) {
//should never happen.
return null;
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getUrlString()
*/
public String getUrlString() {
return info.getUrl();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getUuid()
*/
public String getUuid() {
return info.getReposUUID();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getRepository()
*/
public SVNUrl getRepository() {
try {
return new SVNUrl(info.getReposRootUrl());
} catch (MalformedURLException e) {
//should never happen.
return null;
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getSchedule()
*/
public SVNScheduleKind getSchedule() {
return JhlConverter.convertScheduleKind(info.getSchedule());
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getNodeKind()
*/
public SVNNodeKind getNodeKind() {
return JhlConverter.convertNodeKind(info.getKind());
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getAuthor()
*/
public String getLastCommitAuthor() {
return info.getLastChangedAuthor();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getRevision()
*/
public Number getRevision() {
return JhlConverter.convertRevisionNumber(info.getRev());
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLastChangedRevision()
*/
public Number getLastChangedRevision() {
return JhlConverter.convertRevisionNumber(info.getLastChangedRev());
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLastChangedDate()
*/
public Date getLastChangedDate() {
return info.getLastChangedDate();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLastDateTextUpdate()
*/
public Date getLastDateTextUpdate() {
return info.getTextTime();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLastDatePropsUpdate()
*/
public Date getLastDatePropsUpdate() {
return info.getPropTime();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#isCopied()
*/
public boolean isCopied() {
return (info.getCopyFromRev() > 0);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getCopyRev()
*/
public Number getCopyRev() {
return JhlConverter.convertRevisionNumber(info.getCopyFromRev());
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getCopyUrl()
*/
public SVNUrl getCopyUrl() {
try {
return new SVNUrl(info.getCopyFromUrl());
} catch (MalformedURLException e) {
//should never happen.
return null;
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLockCreationDate()
*/
public Date getLockCreationDate() {
if (info.getLock() == null)
return null;
else
return info.getLock().getCreationDate();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLockOwner()
*/
public String getLockOwner() {
if (info.getLock() == null)
return null;
else
return info.getLock().getOwner();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLockComment()
*/
public String getLockComment() {
if (info.getLock() == null)
return null;
else
return info.getLock().getComment();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getDepth()
*/
public int getDepth() {
return info.getDepth();
}
}
././@LongLink 0000000 0000000 0000000 00000000162 00000000000 011564 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlAnnotations.java libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlAnn0000644 0000000 0000000 00000004137 10754122357 032642 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.javahl;
import java.util.Date;
import org.tigris.subversion.javahl.BlameCallback;
import org.tigris.subversion.javahl.BlameCallback2;
import org.tigris.subversion.svnclientadapter.Annotations;
/**
* JavaHL specific subclass of {@link Annotations}.
* It implements a {@link org.tigris.subversion.javahl.BlameCallback}
* as means of constructing the annotation records.
*
*/
public class JhlAnnotations extends Annotations implements BlameCallback, BlameCallback2 {
/* (non-Javadoc)
* @see org.tigris.subversion.javahl.BlameCallback#singleLine(java.util.Date, long, java.lang.String, java.lang.String)
*/
public void singleLine(Date changed, long revision, String author,
String line) {
addAnnotation(new Annotation(revision, author, changed, line));
}
public void singleLine(Date changed, long revision, String author,
Date merged_date, long merged_revision, String merged_author,
String mergedPath, String line) {
if (merged_revision == -1 || revision <= merged_revision)
addAnnotation(new Annotation(revision, author, changed, line));
else
addAnnotation(new Annotation(merged_revision, merged_author, merged_date, line));
}
}
././@LongLink 0000000 0000000 0000000 00000000167 00000000000 011571 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlProgressListener.java libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlPro0000644 0000000 0000000 00000001246 10756626207 032671 0 ustar root root package org.tigris.subversion.svnclientadapter.javahl;
import org.tigris.subversion.javahl.ProgressEvent;
import org.tigris.subversion.javahl.ProgressListener;
import org.tigris.subversion.svnclientadapter.ISVNProgressListener;
import org.tigris.subversion.svnclientadapter.SVNProgressEvent;
public class JhlProgressListener implements ProgressListener {
ISVNProgressListener worker;
public JhlProgressListener() {
super();
}
public void onProgress(ProgressEvent event) {
if (worker != null )
worker.onProgress(new SVNProgressEvent(event.getProgress(), event.getTotal()));
}
public void setWorker(ISVNProgressListener worker) {
this.worker = worker;
}
}
././@LongLink 0000000 0000000 0000000 00000000163 00000000000 011565 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlPropertyData.java libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlPro0000644 0000000 0000000 00000006576 10613664631 032677 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.javahl;
import java.io.File;
import java.net.MalformedURLException;
import org.tigris.subversion.javahl.PropertyData;
import org.tigris.subversion.svnclientadapter.ISVNProperty;
import org.tigris.subversion.svnclientadapter.SVNUrl;
/**
* A JavaHL based implementation of {@link ISVNProperty}.
* Actually just an adapter from {@link org.tigris.subversion.javahl.PropertyData}
*
* @author philip schatz
*/
public class JhlPropertyData implements ISVNProperty
{
private PropertyData _propertyData;
private boolean isForUrl;
/**
* Factory method for properties on local resource (file or dir)
* @param propertyData
* @return a JhlPropertyData constructed from supplied propertyData
*/
public static JhlPropertyData newForFile(PropertyData propertyData)
{
return new JhlPropertyData(propertyData, false);
}
/**
* Factory method for properties on remote resource (url)
* @param propertyData
* @return a JhlPropertyData constructed from supplied propertyData
*/
public static JhlPropertyData newForUrl(PropertyData propertyData)
{
return new JhlPropertyData(propertyData, true);
}
/**
* Constructor
* @param propertyData
*/
private JhlPropertyData(PropertyData propertyData, boolean isForUrl)
{
this._propertyData = propertyData;
this.isForUrl = isForUrl;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNProperty#getName()
*/
public String getName()
{
return _propertyData.getName();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNProperty#getValue()
*/
public String getValue()
{
return _propertyData.getValue();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNProperty#getFile()
*/
public File getFile()
{
return isForUrl ? null : new File(_propertyData.getPath()).getAbsoluteFile();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNProperty#getUrl()
*/
public SVNUrl getUrl()
{
try {
return isForUrl ? new SVNUrl(_propertyData.getPath()) : null;
} catch (MalformedURLException e) {
//should never happen.
return null;
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNProperty#getData()
*/
public byte[] getData()
{
return _propertyData.getData();
}
}
././@LongLink 0000000 0000000 0000000 00000000171 00000000000 011564 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlPromptUserPassword.java libnb-svnclientadapter-java-6.7.orig/src/javahl/org/tigris/subversion/svnclientadapter/javahl/JhlPro0000644 0000000 0000000 00000007345 10613664631 032672 0 ustar root root /*******************************************************************************
* Copyright (c) 2005, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.javahl;
import org.tigris.subversion.javahl.PromptUserPassword3;
import org.tigris.subversion.svnclientadapter.ISVNPromptUserPassword;
/**
* A JavaHL's PromptUserPassword3 implementation.
* Actually an adapter to {@link ISVNPromptUserPassword}
*/
public class JhlPromptUserPassword implements PromptUserPassword3 {
private ISVNPromptUserPassword worker;
/**
* Constructor
* @param arg0
*/
public JhlPromptUserPassword(ISVNPromptUserPassword arg0) {
super();
this.worker = arg0;
}
/* (non-Javadoc)
* @see org.tigris.subversion.javahl.PromptUserPassword3#prompt(java.lang.String, java.lang.String, boolean)
*/
public boolean prompt(String realm, String username, boolean maySave) {
return this.worker.prompt(realm, username, maySave);
}
/* (non-Javadoc)
* @see org.tigris.subversion.javahl.PromptUserPassword3#askQuestion(java.lang.String, java.lang.String, boolean, boolean)
*/
public String askQuestion(String realm, String question, boolean showAnswer, boolean maySave) {
return this.worker.askQuestion(realm, question, showAnswer, maySave);
}
/* (non-Javadoc)
* @see org.tigris.subversion.javahl.PromptUserPassword3#userAllowedSave()
*/
public boolean userAllowedSave() {
return this.worker.userAllowedSave();
}
/* (non-Javadoc)
* @see org.tigris.subversion.javahl.PromptUserPassword2#askTrustSSLServer(java.lang.String, boolean)
*/
public int askTrustSSLServer(String info, boolean allowPermanently) {
return this.worker.askTrustSSLServer(info, allowPermanently);
}
/* (non-Javadoc)
* @see org.tigris.subversion.javahl.PromptUserPassword#prompt(java.lang.String, java.lang.String)
*/
public boolean prompt(String realm, String username) {
return this.prompt(realm, username, true);
}
/* (non-Javadoc)
* @see org.tigris.subversion.javahl.PromptUserPassword#askYesNo(java.lang.String, java.lang.String, boolean)
*/
public boolean askYesNo(String realm, String question, boolean yesIsDefault) {
return this.worker.askYesNo(realm, question, yesIsDefault);
}
/* (non-Javadoc)
* @see org.tigris.subversion.javahl.PromptUserPassword#askQuestion(java.lang.String, java.lang.String, boolean)
*/
public String askQuestion(String realm, String question, boolean showAnswer) {
return this.askQuestion(realm, question, showAnswer, true);
}
/* (non-Javadoc)
* @see org.tigris.subversion.javahl.PromptUserPassword#getUsername()
*/
public String getUsername() {
return this.worker.getUsername();
}
/* (non-Javadoc)
* @see org.tigris.subversion.javahl.PromptUserPassword#getPassword()
*/
public String getPassword() {
return this.worker.getPassword();
}
}
libnb-svnclientadapter-java-6.7.orig/src/svnkit/ 0000755 0000000 0000000 00000000000 11240243242 020473 5 ustar root root libnb-svnclientadapter-java-6.7.orig/src/svnkit/org/ 0000755 0000000 0000000 00000000000 11240243242 021262 5 ustar root root libnb-svnclientadapter-java-6.7.orig/src/svnkit/org/tigris/ 0000755 0000000 0000000 00000000000 11240243242 022563 5 ustar root root libnb-svnclientadapter-java-6.7.orig/src/svnkit/org/tigris/subversion/ 0000755 0000000 0000000 00000000000 11240243242 024762 5 ustar root root libnb-svnclientadapter-java-6.7.orig/src/svnkit/org/tigris/subversion/svnclientadapter/ 0000755 0000000 0000000 00000000000 11240243242 030330 5 ustar root root libnb-svnclientadapter-java-6.7.orig/src/svnkit/org/tigris/subversion/svnclientadapter/svnkit/ 0000755 0000000 0000000 00000000000 11240243242 031646 5 ustar root root ././@LongLink 0000000 0000000 0000000 00000000176 00000000000 011571 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/svnkit/org/tigris/subversion/svnclientadapter/svnkit/SvnKitClientAdapterFactory.java libnb-svnclientadapter-java-6.7.orig/src/svnkit/org/tigris/subversion/svnclientadapter/svnkit/SvnKit0000644 0000000 0000000 00000005451 10613664631 033030 0 ustar root root /*******************************************************************************
* Copyright (c) 2005, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.svnkit;
import org.tigris.subversion.svnclientadapter.ISVNClientAdapter;
import org.tigris.subversion.svnclientadapter.SVNClientAdapterFactory;
import org.tigris.subversion.svnclientadapter.SVNClientException;
/**
* Concrete implementation of SVNClientAdapterFactory for SVNKit interface.
* To register this factory, just call {@link SvnKitClientAdapterFactory#setup()}
*/
public class SvnKitClientAdapterFactory extends SVNClientAdapterFactory {
/** Client adapter implementation identifier */
public static final String SVNKIT_CLIENT = "svnkit";
/**
* Private constructor.
* Clients are expected the use {@link #createSVNClientImpl()}, res.
* ask the {@link SVNClientAdapterFactory}
*/
private SvnKitClientAdapterFactory() {
super();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.SVNClientAdapterFactory#createSVNClientImpl()
*/
protected ISVNClientAdapter createSVNClientImpl() {
return new SvnKitClientAdapter();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.SVNClientAdapterFactory#getClientType()
*/
protected String getClientType() {
return SVNKIT_CLIENT;
}
public static boolean isAvailable() {
try {
Class c = Class.forName("org.tmatesoft.svn.core.javahl.SVNClientImpl");
if (c != null)
return true;
else
return false;
} catch (Throwable t) {
return false;
}
}
/**
* Setup the client adapter implementation and register it in the adapters factory
* @throws SVNClientException
*/
public static void setup() throws SVNClientException {
if (!isAvailable()) {
throw new SVNClientException("SVNKit client adapter is not available");
}
SVNClientAdapterFactory.registerAdapterFactory(new SvnKitClientAdapterFactory());
}
}
././@LongLink 0000000 0000000 0000000 00000000167 00000000000 011571 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/svnkit/org/tigris/subversion/svnclientadapter/svnkit/SvnKitClientAdapter.java libnb-svnclientadapter-java-6.7.orig/src/svnkit/org/tigris/subversion/svnclientadapter/svnkit/SvnKit0000644 0000000 0000000 00000015606 11164230117 033021 0 ustar root root /*******************************************************************************
* Copyright (c) 2005, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.svnkit;
import java.io.File;
import org.tigris.subversion.javahl.ClientException;
import org.tigris.subversion.javahl.SVNClient;
import org.tigris.subversion.svnclientadapter.ISVNNotifyListener;
import org.tigris.subversion.svnclientadapter.ISVNPromptUserPassword;
import org.tigris.subversion.svnclientadapter.ISVNStatus;
import org.tigris.subversion.svnclientadapter.SVNClientException;
import org.tigris.subversion.svnclientadapter.SVNStatusUnversioned;
import org.tigris.subversion.svnclientadapter.javahl.AbstractJhlClientAdapter;
import org.tigris.subversion.svnclientadapter.javahl.JhlNotificationHandler;
import org.tigris.subversion.svnclientadapter.javahl.JhlProgressListener;
import org.tmatesoft.svn.core.SVNException;
import org.tmatesoft.svn.core.internal.io.dav.http.IHTTPConnectionFactory;
import org.tmatesoft.svn.core.internal.io.svn.ISVNConnectorFactory;
import org.tmatesoft.svn.core.io.SVNRepositoryFactory;
import org.tmatesoft.svn.core.javahl.SVNClientImpl;
/**
* The SVNKit Adapter works by providing an implementation of the
* JavaHL SVNClientInterface. This allows to provide a common
* JavaHL implementation (AbstractJhlClientAdapter) where the specific
* adapters just need to initialize the correct underlying classes.
*
*/
public class SvnKitClientAdapter extends AbstractJhlClientAdapter {
public SvnKitClientAdapter() {
this(null, null, null);
}
public SvnKitClientAdapter(SVNClient owner,
IHTTPConnectionFactory httpConnectionFactory,
ISVNConnectorFactory svnConnectorFactory) {
svnClient = SVNClientImpl.newInstance(owner, httpConnectionFactory, svnConnectorFactory);
notificationHandler = new JhlNotificationHandler();
progressListener = new JhlProgressListener();
svnClient.notification2(notificationHandler);
svnClient.setPrompt(new DefaultPromptUserPassword());
svnClient.setProgressListener(progressListener);
}
public boolean isThreadsafe() {
return false;
}
public void createRepository(File path, String repositoryType)
throws SVNClientException {
if (REPOSITORY_FSTYPE_BDB.equalsIgnoreCase(repositoryType))
throw new SVNClientException("SVNKit only supports fsfs repository type.");
try {
boolean force = false;
boolean enableRevisionProperties = false;
SVNRepositoryFactory.createLocalRepository(path, enableRevisionProperties, force);
} catch (SVNException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
public void addPasswordCallback(ISVNPromptUserPassword callback) {
if (callback != null) {
SvnKitPromptUserPassword prompt = new SvnKitPromptUserPassword(callback);
this.setPromptUserPassword(prompt);
}
}
public boolean statusReturnsRemoteInfo() {
return true;
}
public long[] commitAcrossWC(File[] paths, String message, boolean recurse,
boolean keepLocks, boolean atomic) throws SVNClientException {
try {
String fixedMessage = fixSVNString(message);
if (fixedMessage == null)
fixedMessage = "";
notificationHandler.setCommand(ISVNNotifyListener.Command.COMMIT);
String[] files = new String[paths.length];
String commandLine = "commit -m \""+fixedMessage+"\"";
if (!recurse)
commandLine+=" -N";
if (keepLocks)
commandLine+=" --no-unlock";
for (int i = 0; i < paths.length; i++) {
files[i] = fileToSVNPath(paths[i], false);
commandLine+=" "+ files[i];
}
notificationHandler.logCommandLine(commandLine);
notificationHandler.setBaseDir();
long[] newRev = ((SVNClientImpl)svnClient).commit(files, fixedMessage, recurse, keepLocks, atomic);
return newRev;
} catch (ClientException e) {
notificationHandler.logException(e);
throw new SVNClientException(e);
}
}
public boolean canCommitAcrossWC() {
return true;
}
/**
* Returns the status of files and directory recursively.
* Overrides method from parent class to work around SVNKit bug when status on resource within ignored folder
* does not yield any status.
*
* @param path File to gather status.
* @param descend get recursive status information
* @param getAll get status information for all files
* @param contactServer contact server to get remote changes
* @param ignoreExternals
*
* @return a Status
* @throws SVNClientException
*/
public ISVNStatus[] getStatus(File path, boolean descend, boolean getAll, boolean contactServer, boolean ignoreExternals) throws SVNClientException {
//Call the standard status first.
ISVNStatus[] statuses = super.getStatus(path, descend, getAll, contactServer, ignoreExternals);
//If status call return empty array it is either correct - the getAll was not specified and there's not
//interesting status in WC, or it is the bug on getting status on unversioned with ignored.
if (statuses.length == 0) {
if (getAll) {
//If the getAll was called and it returned nothing, it is probably the bug case
return new ISVNStatus[] { new SVNStatusUnversioned(path) };
} else {
//If the getAll was not called, we have to find out, so let's call it again with getAll set.
ISVNStatus[] reCheckStatuses = super.getStatus(path, false, true, false, true);
if (reCheckStatuses.length == 0) {
//If event after getAll the result is empty, we assume it's the bug.
return new ISVNStatus[] { new SVNStatusUnversioned(path) };
} else {
//The result after getAll was not empty, so the very first empty result was OK, there's nothing interesting in WC.
return new ISVNStatus[0];
}
}
} else {
return statuses;
}
}
}
././@LongLink 0000000 0000000 0000000 00000000174 00000000000 011567 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/svnkit/org/tigris/subversion/svnclientadapter/svnkit/SvnKitPromptUserPassword.java libnb-svnclientadapter-java-6.7.orig/src/svnkit/org/tigris/subversion/svnclientadapter/svnkit/SvnKit0000644 0000000 0000000 00000011403 10613664631 033022 0 ustar root root /*******************************************************************************
* Copyright (c) 2005, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.svnkit;
import org.tigris.subversion.svnclientadapter.ISVNPromptUserPassword;
import org.tmatesoft.svn.core.javahl.PromptUserPasswordSSH;
import org.tmatesoft.svn.core.javahl.PromptUserPasswordSSL;
import org.tmatesoft.svn.core.javahl.PromptUserPasswordUser;
/**
* A SVNKit's PromptUserPassword3 implementation.
*/
public class SvnKitPromptUserPassword implements PromptUserPasswordSSH, PromptUserPasswordSSL, PromptUserPasswordUser {
private ISVNPromptUserPassword worker;
/**
* Constructor
* @param arg0
*/
public SvnKitPromptUserPassword(ISVNPromptUserPassword arg0) {
super();
this.worker = arg0;
}
/* (non-Javadoc)
* @see org.tigris.subversion.javahl.PromptUserPassword3#prompt(java.lang.String, java.lang.String, boolean)
*/
public boolean prompt(String realm, String username, boolean maySave) {
return this.worker.prompt(realm, username, maySave);
}
/* (non-Javadoc)
* @see org.tigris.subversion.javahl.PromptUserPassword3#askQuestion(java.lang.String, java.lang.String, boolean, boolean)
*/
public String askQuestion(String realm, String question, boolean showAnswer, boolean maySave) {
return this.worker.askQuestion(realm, question, showAnswer, maySave);
}
/* (non-Javadoc)
* @see org.tigris.subversion.javahl.PromptUserPassword3#userAllowedSave()
*/
public boolean userAllowedSave() {
return this.worker.userAllowedSave();
}
/* (non-Javadoc)
* @see org.tigris.subversion.javahl.PromptUserPassword2#askTrustSSLServer(java.lang.String, boolean)
*/
public int askTrustSSLServer(String info, boolean allowPermanently) {
return this.worker.askTrustSSLServer(info, allowPermanently);
}
/* (non-Javadoc)
* @see org.tigris.subversion.javahl.PromptUserPassword#prompt(java.lang.String, java.lang.String)
*/
public boolean prompt(String realm, String username) {
return this.prompt(realm, username, true);
}
/* (non-Javadoc)
* @see org.tigris.subversion.javahl.PromptUserPassword#askYesNo(java.lang.String, java.lang.String, boolean)
*/
public boolean askYesNo(String realm, String question, boolean yesIsDefault) {
return this.worker.askYesNo(realm, question, yesIsDefault);
}
/* (non-Javadoc)
* @see org.tigris.subversion.javahl.PromptUserPassword#askQuestion(java.lang.String, java.lang.String, boolean)
*/
public String askQuestion(String realm, String question, boolean showAnswer) {
return this.askQuestion(realm, question, showAnswer, true);
}
/* (non-Javadoc)
* @see org.tigris.subversion.javahl.PromptUserPassword#getUsername()
*/
public String getUsername() {
return this.worker.getUsername();
}
/* (non-Javadoc)
* @see org.tigris.subversion.javahl.PromptUserPassword#getPassword()
*/
public String getPassword() {
return this.worker.getPassword();
}
public int getSSHPort() {
return this.worker.getSSHPort();
}
public String getSSHPrivateKeyPassphrase() {
return this.worker.getSSHPrivateKeyPassphrase();
}
public String getSSHPrivateKeyPath() {
return this.worker.getSSHPrivateKeyPath();
}
public boolean promptSSH(String realm, String username, int sshPort,
boolean maySave) {
return this.worker.promptSSH(realm, username, sshPort, maySave);
}
public String getSSLClientCertPassword() {
return this.worker.getSSLClientCertPassword();
}
public String getSSLClientCertPath() {
return this.worker.getSSLClientCertPath();
}
public boolean promptSSL(String realm, boolean maySave) {
return this.worker.promptSSL(realm, maySave);
}
public boolean promptUser(String realm, String user, boolean maySave) {
return this.worker.promptUser(realm, user, maySave);
}
}
libnb-svnclientadapter-java-6.7.orig/src/main/ 0000755 0000000 0000000 00000000000 11240243237 020105 5 ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/ 0000755 0000000 0000000 00000000000 11240243237 020674 5 ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/ 0000755 0000000 0000000 00000000000 11240243237 022175 5 ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/ 0000755 0000000 0000000 00000000000 11240243237 024374 5 ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ 0000755 0000000 0000000 00000000000 11240243240 027734 5 ustar root root ././@LongLink 0000000 0000000 0000000 00000000154 00000000000 011565 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNClientAdapter.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNClientAdapt0000644 0000000 0000000 00000162230 11160535207 032563 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
/**
* High level API for Subversion
*
*/
public interface ISVNClientAdapter {
/** constant identifying the "bdb" repository type */
public final static String REPOSITORY_FSTYPE_BDB = "bdb";
/** constant identifying the "fsfs" repository type */
public final static String REPOSITORY_FSTYPE_FSFS = "fsfs";
public final static String[] DEFAULT_LOG_PROPERTIES = new String[] {"svn:author", "svn:date", "svn:log"};
/**
* Returns whether the client adapter implementation is threadsafe
*/
public abstract boolean isThreadsafe();
/**
* Add a notification listener
* @param listener
*/
public abstract void addNotifyListener(ISVNNotifyListener listener);
/**
* Remove a notification listener
* @param listener
*/
public abstract void removeNotifyListener(ISVNNotifyListener listener);
/**
* @return the notification handler
*/
public abstract SVNNotificationHandler getNotificationHandler();
/**
* Sets the username.
* @param username
*/
public abstract void setUsername(String username);
/**
* Sets the password.
* @param password
*/
public abstract void setPassword(String password);
/**
* Add a callback for prompting for username, password SSL etc...
* @param callback
*/
public abstract void addPasswordCallback(ISVNPromptUserPassword callback);
/**
* Add a callback for resolving conflicts during up/sw/merge
* @param callback
*/
public abstract void addConflictResolutionCallback(ISVNConflictResolver callback);
/**
* Set a progress listener
* @param progressListener
*/
public abstract void setProgressListener(ISVNProgressListener progressListener);
/**
* Adds a file (or directory) to the repository.
* @param file
* @throws SVNClientException
*/
public abstract void addFile(File file) throws SVNClientException;
/**
* Adds a directory to the repository.
* @param dir
* @param recurse
* @throws SVNClientException
*/
public abstract void addDirectory(File dir, boolean recurse)
throws SVNClientException;
/**
* Adds a directory to the repository.
* @param dir
* @param recurse
* @param force
* @throws SVNClientException
*/
public abstract void addDirectory(File dir, boolean recurse, boolean force)
throws SVNClientException;
/**
* Executes a revision checkout.
* @param moduleName name of the module to checkout.
* @param destPath destination directory for checkout.
* @param revision the revision number to checkout. If the number is -1
* then it will checkout the latest revision.
* @param recurse whether you want it to checkout files recursively.
* @exception SVNClientException
*/
public abstract void checkout(
SVNUrl moduleName,
File destPath,
SVNRevision revision,
boolean recurse)
throws SVNClientException;
/**
* Executes a revision checkout.
* @param moduleName name of the module to checkout.
* @param destPath destination directory for checkout.
* @param revision the revision number to checkout. If the number is -1
* then it will checkout the latest revision.
* @param depth how deep to checkout files recursively.
* @param ignoreExternals if externals are ignored during checkout.
* @param force allow unversioned paths that obstruct adds.
* @exception SVNClientException
*/
public abstract void checkout(
SVNUrl moduleName,
File destPath,
SVNRevision revision,
int depth,
boolean ignoreExternals,
boolean force)
throws SVNClientException;
/**
* Commits changes to the repository. This usually requires
* authentication, see Auth.
* @return Returns a long representing the revision. It returns a
* -1 if the revision number is invalid.
* @param paths files to commit.
* @param message log message.
* @param recurse whether the operation should be done recursively.
* @exception SVNClientException
*/
public abstract long commit(File[] paths, String message, boolean recurse)
throws SVNClientException;
/**
* Commits changes to the repository. This usually requires
* authentication, see Auth.
* @return Returns a long representing the revision. It returns a
* -1 if the revision number is invalid.
* @param paths files to commit.
* @param message log message.
* @param recurse whether the operation should be done recursively.
* @param keepLocks
* @exception SVNClientException
*/
public abstract long commit(File[] paths, String message, boolean recurse, boolean keepLocks)
throws SVNClientException;
/**
* Commits changes to the repository. This usually requires
* authentication, see Auth.
*
* This differs from the normal commit method in that it can accept paths from
* more than one working copy.
*
* @return Returns an array of longs representing the revisions. It returns a
* -1 if the revision number is invalid.
* @param paths files to commit.
* @param message log message.
* @param recurse whether the operation should be done recursively.
* @param keepLocks whether to keep locks on files that are committed.
* @param atomic whether to attempt to perform the commit from multiple
* working copies atomically. Files from the same repository will be
* processed with one commit operation. If files span multiple repositories
* they will be processed in multiple commits.
* When atomic is false, you will get one commit per WC.
* @exception SVNClientException
*/
public abstract long[] commitAcrossWC(File[] paths, String message, boolean recurse, boolean keepLocks, boolean atomic)
throws SVNClientException;
/**
* List directory entries of a URL
* @param url
* @param revision
* @param recurse
* @return an array of ISVNDirEntries
* @throws SVNClientException
*/
public abstract ISVNDirEntry[] getList(
SVNUrl url,
SVNRevision revision,
boolean recurse)
throws SVNClientException;
/**
* List directory entries of a URL
* @param url
* @param revision
* @param pegRevision
* @param recurse
* @return an array of ISVNDirEntries
* @throws SVNClientException
*/
public abstract ISVNDirEntry[] getList(
SVNUrl url,
SVNRevision revision,
SVNRevision pegRevision,
boolean recurse)
throws SVNClientException;
/**
* List directory entries of a directory
* @param path
* @param revision
* @param recurse
* @return an array of ISVNDirEntries
* @throws SVNClientException
*/
public ISVNDirEntry[] getList(File path, SVNRevision revision, boolean recurse)
throws SVNClientException;
/**
* List directory entries of a directory
* @param path
* @param revision
* @param pegRevision
* @param recurse
* @return an array of ISVNDirEntries
* @throws SVNClientException
*/
public ISVNDirEntry[] getList(File path, SVNRevision revision, SVNRevision pegRevision, boolean recurse)
throws SVNClientException;
/**
* get the dirEntry for the given url
* @param url
* @param revision
* @return an ISVNDirEntry
* @throws SVNClientException
*/
public ISVNDirEntry getDirEntry(SVNUrl url, SVNRevision revision)
throws SVNClientException;
/**
* get the dirEntry for the given directory
* @param path
* @param revision
* @return an ISVNDirEntry
* @throws SVNClientException
*/
public ISVNDirEntry getDirEntry(File path, SVNRevision revision)
throws SVNClientException;
/**
* Returns the status of a single file in the path.
*
* @param path File to gather status.
* @return a Status
* @throws SVNClientException
*/
public abstract ISVNStatus getSingleStatus(File path)
throws SVNClientException;
/**
* Returns the status of given resources
* @param path
* @return the status of given resources
* @throws SVNClientException
*/
public abstract ISVNStatus[] getStatus(File[] path)
throws SVNClientException;
/**
* Returns the status of path and its children.
* If descend is true, recurse fully, else do only immediate children.
* If getAll is set, retrieve all entries; otherwise, retrieve only
* "interesting" entries (local mods and/or out-of-date).
*
* @param path File to gather status.
* @param descend get recursive status information
* @param getAll get status information for all files
* @return a Status
* @throws SVNClientException
*/
public abstract ISVNStatus[] getStatus(File path, boolean descend, boolean getAll)
throws SVNClientException;
/**
* Returns the status of path and its children.
* If descend is true, recurse fully, else do only immediate children.
* If getAll is set, retrieve all entries; otherwise, retrieve only
* "interesting" entries (local mods and/or out-of-date). Use the
* contactServer option to get server change information.
*
* @param path File to gather status.
* @param descend get recursive status information
* @param getAll get status information for all files
* @param contactServer contact server to get remote changes
* @return a Status
* @throws SVNClientException
*/
public abstract ISVNStatus[] getStatus(File path, boolean descend, boolean getAll, boolean contactServer)
throws SVNClientException;
/**
* Returns the status of path and its children.
* If descend is true, recurse fully, else do only immediate children.
* If getAll is set, retrieve all entries; otherwise, retrieve only
* "interesting" entries (local mods and/or out-of-date). Use the
* contactServer option to get server change information.
*
* @param path File to gather status.
* @param descend get recursive status information
* @param getAll get status information for all files
* @param contactServer contact server to get remote changes
* @param ignoreExternals if externals are ignored during status
* @return a Status
* @throws SVNClientException
*/
public abstract ISVNStatus[] getStatus(File path, boolean descend, boolean getAll, boolean contactServer, boolean ignoreExternals)
throws SVNClientException;
/**
* copy and schedule for addition (with history)
* @param srcPath
* @param destPath
* @throws SVNClientException
*/
public abstract void copy(File srcPath, File destPath)
throws SVNClientException;
/**
* immediately commit a copy of WC to URL
* @param srcPath
* @param destUrl
* @param message
* @throws SVNClientException
*/
public abstract void copy(File srcPath, SVNUrl destUrl, String message)
throws SVNClientException;
/**
* immediately commit a copy of WC to URL
* @param srcPaths
* @param destUrl
* @param message
* @param copyAsChild
* @param makeParents
* @throws SVNClientException
*/
public abstract void copy(File[] srcPaths, SVNUrl destUrl, String message, boolean copyAsChild, boolean makeParents)
throws SVNClientException;
/**
* check out URL into WC, schedule for addition
* @param srcUrl
* @param destPath
* @param revision
* @throws SVNClientException
*/
public abstract void copy(SVNUrl srcUrl, File destPath, SVNRevision revision)
throws SVNClientException;
/**
* check out URL into WC, schedule for addition
* @param srcUrl
* @param destPath
* @param revision
* @param boolean
* @param boolean
* @throws SVNClientException
*/
public abstract void copy(SVNUrl srcUrl, File destPath, SVNRevision revision, boolean copyAsChild, boolean makeParents)
throws SVNClientException;
/**
* complete server-side copy; used to branch & tag
* @param srcUrl
* @param destUrl
* @param message
* @param revision
* @throws SVNClientException
*/
public abstract void copy(
SVNUrl srcUrl,
SVNUrl destUrl,
String message,
SVNRevision revision)
throws SVNClientException;
/**
* complete server-side copy with option to create intermediate folders; used to branch & tag
* @param srcUrl
* @param destUrl
* @param message
* @param revision
* @param make parents
* @throws SVNClientException
*/
public abstract void copy(
SVNUrl srcUrl,
SVNUrl destUrl,
String message,
SVNRevision revision,
boolean makeParents)
throws SVNClientException;
/**
* complete server-side copy with option to create intermediate folders; used to branch & tag
* @param srcUrl
* @param destUrl
* @param message
* @param revision
* @param copyAsChild
* @param make parents
* @throws SVNClientException
*/
public abstract void copy(
SVNUrl[] srcUrls,
SVNUrl destUrl,
String message,
SVNRevision revision,
boolean copyAsChild,
boolean makeParents)
throws SVNClientException;
/**
* item is deleted from the repository via an immediate commit.
* @param url
* @param message
* @throws SVNClientException
*/
public abstract void remove(SVNUrl url[], String message)
throws SVNClientException;
/**
* the item is scheduled for deletion upon the next commit.
* Files, and directories that have not been committed, are immediately
* removed from the working copy. The command will not remove TARGETs
* that are, or contain, unversioned or modified items;
* use the force option to override this behaviour.
* @param file
* @param force
* @throws SVNClientException
*/
public abstract void remove(File file[], boolean force)
throws SVNClientException;
/**
* Exports a clean directory tree from the repository specified by
* srcUrl, at revision revision
* @param srcUrl
* @param destPath
* @param revision
* @param force
* @throws SVNClientException
*/
public abstract void doExport(
SVNUrl srcUrl,
File destPath,
SVNRevision revision,
boolean force)
throws SVNClientException;
/**
* Exports a clean directory tree from the working copy specified by
* PATH1 into PATH2. all local changes will be preserved, but files
* not under revision control will not be copied.
* @param srcPath
* @param destPath
* @param force
* @throws SVNClientException
*/
public abstract void doExport(File srcPath, File destPath, boolean force)
throws SVNClientException;
/**
* Import file or directory PATH into repository directory URL at head
* @param path
* @param url
* @param message
* @param recurse
* @throws SVNClientException
*/
public abstract void doImport(
File path,
SVNUrl url,
String message,
boolean recurse)
throws SVNClientException;
/**
* Creates a directory directly in a repository
* @param url
* @param message
* @throws SVNClientException
*/
public abstract void mkdir(SVNUrl url, String message)
throws SVNClientException;
/**
* Creates a directory directly in a repository
* @param url
* @param makeParents
* @param message
* @throws SVNClientException
*/
public abstract void mkdir(SVNUrl url, boolean makeParents, String message)
throws SVNClientException;
/**
* creates a directory on disk and schedules it for addition.
* @param file
* @throws SVNClientException
*/
public abstract void mkdir(File file) throws SVNClientException;
/**
* Moves or renames a file.
* @param srcPath
* @param destPath
* @param force
* @throws SVNClientException
*/
public abstract void move(File srcPath, File destPath, boolean force)
throws SVNClientException;
/**
* Moves or renames a file.
* @param srcUrl
* @param destUrl
* @param message
* @param revision
* @throws SVNClientException
*/
public abstract void move(
SVNUrl srcUrl,
SVNUrl destUrl,
String message,
SVNRevision revision)
throws SVNClientException;
/**
* Update a file or a directory
* @param path
* @param revision
* @param recurse
* @return Returns a long representing the revision. It returns a
* -1 if the revision number is invalid.
* @throws SVNClientException
*/
public abstract long update(File path, SVNRevision revision, boolean recurse)
throws SVNClientException;
/**
* Update a file or a directory
* @param path
* @param revision
* @param depth
* @param setDepth
* @param ignoreExternals
* @param force
* @return Returns a long representing the revision. It returns a
* -1 if the revision number is invalid.
* @throws SVNClientException
*/
public abstract long update(File path, SVNRevision revision, int depth, boolean setDepth, boolean ignoreExternals, boolean force)
throws SVNClientException;
/**
* Updates the directories or files from repository
* @param path array of target files.
* @param revision the revision number to update.
* @param recurse recursively update.
* @param ignoreExternals if externals are ignored during update
* @return Returns an array of longs representing the revision. It returns a
* -1 if the revision number is invalid.
* @throws SVNClientException
* @since 1.2
*/
public abstract long[] update(
File[] path,
SVNRevision revision,
boolean recurse,
boolean ignoreExternals)
throws SVNClientException;
/**
* Updates the directories or files from repository
* @param path array of target files.
* @param revision the revision number to update.
* @param depth the depth to recursively update.
* @param setDepth change working copy to specified depth
* @param ignoreExternals if externals are ignored during update.
* @param force allow unversioned paths that obstruct adds.
* @return Returns an array of longs representing the revision. It returns a
* -1 if the revision number is invalid.
* @throws SVNClientException
*/
public abstract long[] update(
File[] path,
SVNRevision revision,
int depth,
boolean setDepth,
boolean ignoreExternals,
boolean force)
throws SVNClientException;
/**
* Restore pristine working copy file (undo all local edits)
* @param path
* @param recurse
* @throws SVNClientException
*/
public abstract void revert(File path, boolean recurse)
throws SVNClientException;
/**
* Get the log messages for a set of revision(s)
* @param url
* @param revisionStart
* @param revisionEnd
* @return The list of log messages.
* @throws SVNClientException
*/
public abstract ISVNLogMessage[] getLogMessages(
SVNUrl url,
SVNRevision revisionStart,
SVNRevision revisionEnd)
throws SVNClientException;
/**
* Get the log messages for a set of revision(s)
* @param url
* @param revisionStart
* @param revisionEnd
* @param fetchChangePath Whether or not to interogate the
* repository for the verbose log information containing the list
* of paths touched by the delta specified by
* revisionStart
and revisionEnd
.
* Setting this to false
results in a more performant
* and memory efficient operation.
* @return The list of log messages.
* @throws SVNClientException
*/
public abstract ISVNLogMessage[] getLogMessages(
SVNUrl url,
SVNRevision revisionStart,
SVNRevision revisionEnd,
boolean fetchChangePath)
throws SVNClientException;
/**
* Get the log messages for a set paths and revision(s)
* @param url
* @param paths
* @param revStart
* @param revEnd
* @param stopOnCopy
* @param fetchChangePath
* @return The list of log messages.
* @throws SVNClientException
*/
public ISVNLogMessage[] getLogMessages(final SVNUrl url, final String [] paths,
SVNRevision revStart, SVNRevision revEnd,
boolean stopOnCopy, boolean fetchChangePath)
throws SVNClientException;
/**
* Get the log messages for a set of revision(s)
* @param path
* @param revisionStart
* @param revisionEnd
* @return The list of log messages.
* @throws SVNClientException
*/
public abstract ISVNLogMessage[] getLogMessages(
File path,
SVNRevision revisionStart,
SVNRevision revisionEnd)
throws SVNClientException;
/**
* Get the log messages for a set of revision(s)
* @param path
* @param revisionStart
* @param revisionEnd
* @param fetchChangePath Whether or not to interogate the
* repository for the verbose log information containing the list
* of paths touched by the delta specified by
* revisionStart
and revisionEnd
.
* Setting this to false
results in a more performant
* and memory efficient operation.
* @return The list of log messages.
* @throws SVNClientException
*/
public abstract ISVNLogMessage[] getLogMessages(
File path,
SVNRevision revisionStart,
SVNRevision revisionEnd,
boolean fetchChangePath)
throws SVNClientException;
/**
* Retrieve the log messages for an item
* @param path path or url to get the log message for.
* @param revisionStart first revision to show
* @param revisionEnd last revision to show
* @param stopOnCopy do not continue on copy operations
* @param fetchChangePath returns the paths of the changed items in the
* returned objects
* @return array of LogMessages
* @throws SVNClientException
*/
public abstract ISVNLogMessage[] getLogMessages(
File path,
SVNRevision revisionStart,
SVNRevision revisionEnd,
boolean stopOnCopy,
boolean fetchChangePath)
throws SVNClientException;
/**
* Retrieve the log messages for an item
* @param path path to get the log message for.
* @param revisionStart first revision to show
* @param revisionEnd last revision to show
* @param stopOnCopy do not continue on copy operations
* @param fetchChangePath returns the paths of the changed items in the
* returned objects
* @param limit limit the number of log messages (if 0 or less no
* limit)
* @return array of LogMessages
* @throws SVNClientException
*/
public abstract ISVNLogMessage[] getLogMessages(
File path,
SVNRevision revisionStart,
SVNRevision revisionEnd,
boolean stopOnCopy,
boolean fetchChangePath,
long limit)
throws SVNClientException;
/**
* Retrieve the log messages for an item
* @param path path to get the log message for.
* @param pegRevision peg revision for URL
* @param revisionStart first revision to show
* @param revisionEnd last revision to show
* @param stopOnCopy do not continue on copy operations
* @param fetchChangePath returns the paths of the changed items in the
* returned objects
* @param limit limit the number of log messages (if 0 or less no
* limit)
* @param includeMergedRevisions include revisions that were merged
* @return array of LogMessages
* @throws SVNClientException
*/
public abstract ISVNLogMessage[] getLogMessages(
File path,
SVNRevision pegRevision,
SVNRevision revisionStart,
SVNRevision revisionEnd,
boolean stopOnCopy,
boolean fetchChangePath,
long limit,
boolean includeMergedRevisions)
throws SVNClientException;
/**
* Retrieve the log messages for an item
* @param url url to get the log message for.
* @param pegRevision peg revision for URL
* @param revisionStart first revision to show
* @param revisionEnd last revision to show
* @param stopOnCopy do not continue on copy operations
* @param fetchChangePath returns the paths of the changed items in the
* returned objects
* @param limit limit the number of log messages (if 0 or less no
* limit)
* @return array of LogMessages
* @throws SVNClientException
*/
public abstract ISVNLogMessage[] getLogMessages(
SVNUrl url,
SVNRevision pegRevision,
SVNRevision revisionStart,
SVNRevision revisionEnd,
boolean stopOnCopy,
boolean fetchChangePath,
long limit)
throws SVNClientException;
/**
* Retrieve the log messages for an item
* @param url url to get the log message for.
* @param pegRevision peg revision for URL
* @param revisionStart first revision to show
* @param revisionEnd last revision to show
* @param stopOnCopy do not continue on copy operations
* @param fetchChangePath returns the paths of the changed items in the
* returned objects
* @param limit limit the number of log messages (if 0 or less no
* limit)
* @param includeMergedRevisions include revisions that were merged
* @return array of LogMessages
* @throws SVNClientException
*/
public abstract ISVNLogMessage[] getLogMessages(
SVNUrl url,
SVNRevision pegRevision,
SVNRevision revisionStart,
SVNRevision revisionEnd,
boolean stopOnCopy,
boolean fetchChangePath,
long limit,
boolean includeMergedRevisions)
throws SVNClientException;
/**
* Retrieve the log messages for an item
* @param path path to get the log message for.
* @param pegRevision peg revision for URL
* @param revisionStart first revision to show
* @param revisionEnd last revision to show
* @param stopOnCopy do not continue on copy operations
* @param fetchChangePath returns the paths of the changed items in the
* returned objects
* @param limit limit the number of log messages (if 0 or less no
* limit)
* @param includeMergedRevisions include revisions that were merged
* @param requestedProperties the revision properties to return for each entry
* @param callback callback class to receive log messages
* @throws SVNClientException
*/
public abstract void getLogMessages(
File path,
SVNRevision pegRevision,
SVNRevision revisionStart,
SVNRevision revisionEnd,
boolean stopOnCopy,
boolean fetchChangePath,
long limit,
boolean includeMergedRevisions,
String[] requestedProperties,
ISVNLogMessageCallback callback)
throws SVNClientException;
/**
* Retrieve the log messages for an item
* @param url url to get the log message for.
* @param pegRevision peg revision for URL
* @param revisionStart first revision to show
* @param revisionEnd last revision to show
* @param stopOnCopy do not continue on copy operations
* @param fetchChangePath returns the paths of the changed items in the
* returned objects
* @param limit limit the number of log messages (if 0 or less no
* limit)
* @param includeMergedRevisions include revisions that were merged
* @param requestedProperties the revision properties to return for each entry
* @param callback callback class to receive log messages
* @throws SVNClientException
*/
public abstract void getLogMessages(
SVNUrl url,
SVNRevision pegRevision,
SVNRevision revisionStart,
SVNRevision revisionEnd,
boolean stopOnCopy,
boolean fetchChangePath,
long limit,
boolean includeMergedRevisions,
String[] requestedProperties,
ISVNLogMessageCallback callback)
throws SVNClientException;
/**
* get the content of a file
* @param url
* @param revision
* @param peg revision
* @return the input stream with a content of the file
* @throws SVNClientException
*/
public abstract InputStream getContent(SVNUrl url, SVNRevision revision, SVNRevision pegRevision)
throws SVNClientException;
/**
* get the content of a file
* @param url
* @param revision
* @return the input stream with a content of the file
* @throws SVNClientException
*/
public abstract InputStream getContent(SVNUrl url, SVNRevision revision)
throws SVNClientException;
/**
* get the content of a file
* @param path
* @param revision
* @return the input stream with a content of the file
* @throws SVNClientException
*/
public InputStream getContent(File path, SVNRevision revision)
throws SVNClientException;
/**
* set a property
* @param path
* @param propertyName
* @param propertyValue
* @param recurse
* @throws SVNClientException
*/
public abstract void propertySet(
File path,
String propertyName,
String propertyValue,
boolean recurse)
throws SVNClientException;
/**
* set a property using the content of a file
* @param path
* @param propertyName
* @param propertyFile
* @param recurse
* @throws SVNClientException
* @throws IOException
*/
public abstract void propertySet(
File path,
String propertyName,
File propertyFile,
boolean recurse)
throws SVNClientException, IOException;
/**
* get a property or null if property is not found
* @param path
* @param propertyName
* @return a property or null
* @throws SVNClientException
*/
public abstract ISVNProperty propertyGet(File path, String propertyName)
throws SVNClientException;
/**
* get a property or null if property is not found
* @param url
* @param propertyName
* @return a property or null
* @throws SVNClientException
*/
public abstract ISVNProperty propertyGet(SVNUrl url, String propertyName)
throws SVNClientException;
/**
* get a property or null if property is not found
* @param url
* @param revision
* @param peg
* @param propertyName
* @return a property or null
* @throws SVNClientException
*/
public abstract ISVNProperty propertyGet(SVNUrl url, SVNRevision revision,
SVNRevision peg, String propertyName)
throws SVNClientException;
/**
* delete a property
* @param path
* @param propertyName
* @param recurse
* @throws SVNClientException
*/
public abstract void propertyDel(
File path,
String propertyName,
boolean recurse)
throws SVNClientException;
/**
* set the revision property for a given revision
* @param path
* @param revisionNo
* @param propName
* @param propertyData
* @param force
* @throws SVNClientException
*/
public abstract void setRevProperty(SVNUrl path,
SVNRevision.Number revisionNo, String propName,
String propertyData, boolean force) throws SVNClientException;
/**
* get the ignored patterns for the given directory
* if path is not a directory, returns null
* @param path
* @return list of ignored patterns
* @throws SVNClientException
*/
public abstract List getIgnoredPatterns(File path)
throws SVNClientException;
/**
* add a pattern to svn:ignore property
* @param path
* @param pattern
* @throws SVNClientException
*/
public abstract void addToIgnoredPatterns(File path, String pattern)
throws SVNClientException;
/**
* set the ignored patterns for the given directory
* @param path
* @param patterns
* @throws SVNClientException
*/
public abstract void setIgnoredPatterns(File path, List patterns)
throws SVNClientException;
/**
* display the differences between two paths.
* @param oldPath
* @param oldPathRevision
* @param newPath
* @param newPathRevision
* @param outFile
* @param recurse
* @throws SVNClientException
*/
public abstract void diff(
File oldPath,
SVNRevision oldPathRevision,
File newPath,
SVNRevision newPathRevision,
File outFile,
boolean recurse)
throws SVNClientException;
/**
* display the differences between two paths.
* @param oldPath
* @param oldPathRevision
* @param newPath
* @param newPathRevision
* @param outFile
* @param recurse
* @param ignoreAncestry
* @param noDiffDeleted
* @param force
* @throws SVNClientException
*/
public abstract void diff(
File oldPath,
SVNRevision oldPathRevision,
File newPath,
SVNRevision newPathRevision,
File outFile,
boolean recurse,
boolean ignoreAncestry,
boolean noDiffDeleted,
boolean force)
throws SVNClientException;
/**
* display the differences between two paths.
* @param path
* @param outFile
* @param recurse
* @throws SVNClientException
*/
public abstract void diff(
File path,
File outFile,
boolean recurse)
throws SVNClientException;
/**
* display the combined differences for an array of paths.
* @param paths
* @param outFile
* @param recurse
* @throws SVNClientException
*/
public abstract void diff(
File[] paths,
File outFile,
boolean recurse)
throws SVNClientException;
/**
* create a patch from local differences.
* @param paths
* @param relativeToPath - create patch relative to this location
* @param outFile
* @param recurse
* @throws SVNClientException
*/
public abstract void createPatch(
File[] paths,
File relativeToPath,
File outFile,
boolean recurse)
throws SVNClientException;
/**
* display the differences between two urls.
* @param oldUrl
* @param oldUrlRevision
* @param newUrl
* @param newUrlRevision
* @param outFile
* @param recurse
* @throws SVNClientException
*/
public abstract void diff(
SVNUrl oldUrl,
SVNRevision oldUrlRevision,
SVNUrl newUrl,
SVNRevision newUrlRevision,
File outFile,
boolean recurse)
throws SVNClientException;
/**
* display the differences between two urls.
* @param oldUrl
* @param oldUrlRevision
* @param newUrl
* @param newUrlRevision
* @param outFile
* @param recurse
* @param ignoreAncestry
* @param noDiffDeleted
* @param force
* @throws SVNClientException
*/
public abstract void diff(
SVNUrl oldUrl,
SVNRevision oldUrlRevision,
SVNUrl newUrl,
SVNRevision newUrlRevision,
File outFile,
boolean recurse,
boolean ignoreAncestry,
boolean noDiffDeleted,
boolean force)
throws SVNClientException;
/**
* Display the differences between two paths.
* @param target
* @param pegRevision
* @param startRevision
* @param endRevision
* @param outFile
* @param depth
* @param ignoreAncestry
* @param noDiffDeleted
* @param force
* @throws SVNClientException
*/
public abstract void diff(
SVNUrl target,
SVNRevision pegRevision,
SVNRevision startRevision,
SVNRevision endRevision,
File outFile,
int depth,
boolean ignoreAncestry,
boolean noDiffDeleted,
boolean force)
throws SVNClientException;
/**
* Display the differences between two paths.
* @param target
* @param pegRevision
* @param startRevision
* @param endRevision
* @param outFile
* @param recurse
* @throws SVNClientException
*/
public abstract void diff(
SVNUrl target,
SVNRevision pegRevision,
SVNRevision startRevision,
SVNRevision endRevision,
File outFile,
boolean recurse)
throws SVNClientException;
/**
* display the differences between two urls.
* @param url
* @param oldUrlRevision
* @param newUrlRevision
* @param outFile
* @param recurse
* @throws SVNClientException
*/
public abstract void diff(
SVNUrl url,
SVNRevision oldUrlRevision,
SVNRevision newUrlRevision,
File outFile,
boolean recurse)
throws SVNClientException;
/**
* display the differences between WC and url.
* @param path
* @param url
* @param urlRevision
* @param outFile
* @param recurse
* @throws SVNClientException
*/
public abstract void diff(
File path,
SVNUrl url,
SVNRevision urlRevision,
File outFile,
boolean recurse)
throws SVNClientException;
/**
* returns the keywords used for substitution for the given resource
* @param path
* @return the keywords used for substitution
* @throws SVNClientException
*/
public abstract SVNKeywords getKeywords(File path) throws SVNClientException;
/**
* set the keywords substitution for the given resource
* @param path
* @param keywords
* @param recurse
* @throws SVNClientException
*/
public abstract void setKeywords(File path, SVNKeywords keywords, boolean recurse) throws SVNClientException;
/**
* add some keyword to the keywords substitution list
* @param path
* @param keywords
* @return keywords valid after this method call
* @throws SVNClientException
*/
public abstract SVNKeywords addKeywords(File path, SVNKeywords keywords) throws SVNClientException;
/**
* remove some keywords to the keywords substitution list
* @param path
* @param keywords
* @return keywords valid after this method call
* @throws SVNClientException
*/
public SVNKeywords removeKeywords(File path, SVNKeywords keywords) throws SVNClientException;
/**
* Output the content of specified url with revision and
* author information in-line.
* @param url
* @param revisionStart
* @param revisionEnd
* @return annotations for the given url
* @throws SVNClientException
*/
public ISVNAnnotations annotate(SVNUrl url, SVNRevision revisionStart, SVNRevision revisionEnd)
throws SVNClientException;
/**
* Output the content of specified file with revision and
* author information in-line.
* @param file
* @param revisionStart
* @param revisionEnd
* @return annotations for the given file
* @throws SVNClientException
*/
public ISVNAnnotations annotate(File file, SVNRevision revisionStart, SVNRevision revisionEnd)
throws SVNClientException;
/**
* Output the content of specified url with revision and
* author information in-line.
* @param url
* @param revisionStart
* @param revisionEnd
* @param ignoreMimeType
* @param includeMergedRevisons
* @return annotations for the given url
* @throws SVNClientException
*/
public ISVNAnnotations annotate(SVNUrl url, SVNRevision revisionStart, SVNRevision revisionEnd,
boolean ignoreMimeType, boolean includeMergedRevisions)
throws SVNClientException;
/**
* Output the content of specified file with revision and
* author information in-line.
* @param file
* @param revisionStart
* @param revisionEnd
* @param ignoreMimeType
* @param includeMergedRevisons
* @return annotations for the given file
* @throws SVNClientException
*/
public ISVNAnnotations annotate(File file, SVNRevision revisionStart, SVNRevision revisionEnd,
boolean ignoreMimeType, boolean includeMergedRevisions)
throws SVNClientException;
/**
* Get all the properties for the given file or dir
* @param path
* @return the properties for the given url
* @throws SVNClientException
*/
public abstract ISVNProperty[] getProperties(File path) throws SVNClientException;
/**
* Get all the properties for the given url
* @param url
* @return the properties for the given url
* @throws SVNClientException
*/
public abstract ISVNProperty[] getProperties(SVNUrl url) throws SVNClientException;
/**
* Remove 'conflicted' state on working copy files or directories
* @param path
* @throws SVNClientException
*/
public abstract void resolved(File path) throws SVNClientException;
/**
* Remove 'conflicted' state on working copy files or directories
* @param path
* @param result - choose resolve option - {@link ISVNConflictResolver.Choice}
* @throws SVNClientException
*/
public abstract void resolve(File path, int result) throws SVNClientException;
/**
* Create a new, empty repository at path
*
* @param path
* @param repositoryType either {@link ISVNClientAdapter#REPOSITORY_FSTYPE_BDB} or
* {@link ISVNClientAdapter#REPOSITORY_FSTYPE_FSFS} or null (will use svnadmin default)
* @throws SVNClientException
*/
public abstract void createRepository(File path, String repositoryType) throws SVNClientException;
/**
* Cancel the current operation
*
* @throws SVNClientException
*/
public void cancelOperation() throws SVNClientException;
/**
* Get information about a file or directory from working copy.
* Uses info() call which does NOT contact the repository
* @param file
* @return information about a file or directory from working copy.
* @throws SVNClientException
*/
public ISVNInfo getInfoFromWorkingCopy(File file) throws SVNClientException;
/**
* Get information about a file or directory.
* Uses info2() call which contacts the repository
* @param file
* @return information about a file or directory.
* @throws SVNClientException
*/
public ISVNInfo getInfo(File file) throws SVNClientException;
/**
* Get information about a file or directory.
* Uses info2() call which contacts the repository
* @param file
* @param descend get recursive information
* @return information about a file or directory.
* @throws SVNClientException
*/
public ISVNInfo[] getInfo(File file, boolean descend) throws SVNClientException;
/**
* Get information about an URL.
* Uses info2() call which contacts the repository
* @param url
* @return information about an URL.
* @throws SVNClientException
*/
public ISVNInfo getInfo(SVNUrl url) throws SVNClientException;
/**
* Get information about an URL.
* Uses info2() call which contacts the repository
* @param url
* @param revision
* @param peg
* @return information about an URL.
* @throws SVNClientException
*/
public ISVNInfo getInfo(SVNUrl url, SVNRevision revision, SVNRevision peg) throws SVNClientException;
/**
* Update the working copy to mirror a new URL within the repository.
* This behaviour is similar to 'svn update', and is the way to
* move a working copy to a branch or tag within the same repository.
* @param url
* @param path
* @param revision
* @param recurse
* @throws SVNClientException
*/
public void switchToUrl(File path, SVNUrl url, SVNRevision revision, boolean recurse) throws SVNClientException;
/**
* Update the working copy to mirror a new URL within the repository.
* This behaviour is similar to 'svn update', and is the way to
* move a working copy to a branch or tag within the same repository.
* @param url
* @param path
* @param revision
* @param depth
* @param setDepth
* @param ignoreExternals
* @param force
* @throws SVNClientException
*/
public void switchToUrl(File path, SVNUrl url, SVNRevision revision, int depth, boolean setDepth, boolean ignoreExternals, boolean force) throws SVNClientException;
/**
* Update the working copy to mirror a new URL within the repository.
* This behaviour is similar to 'svn update', and is the way to
* move a working copy to a branch or tag within the same repository.
* @param url
* @param path
* @param revision
* @param pegRevision
* @param depth
* @param setDepth
* @param ignoreExternals
* @param force
* @throws SVNClientException
*/
public void switchToUrl(File path, SVNUrl url, SVNRevision revision, SVNRevision pegRevision, int depth, boolean setDepth, boolean ignoreExternals, boolean force) throws SVNClientException;
/**
* Set the configuration directory.
* @param dir
* @throws SVNClientException
*/
public void setConfigDirectory(File dir) throws SVNClientException;
/**
* Perform a clanup on the working copy. This will remove any stale transactions
* @param dir
* @throws SVNClientException
*/
public abstract void cleanup(File dir) throws SVNClientException;
/**
* Merge changes from two paths into a new local path.
* @param path1 first path or url
* @param revision1 first revision
* @param path2 second path or url
* @param revision2 second revision
* @param localPath target local path
* @param force overwrite local changes
* @param recurse traverse into subdirectories
* @exception SVNClientException
*/
public abstract void merge(SVNUrl path1, SVNRevision revision1, SVNUrl path2,
SVNRevision revision2, File localPath, boolean force,
boolean recurse) throws SVNClientException;
/**
* Merge changes from two paths into a new local path.
* @param path1 first path or url
* @param revision1 first revision
* @param path2 second path or url
* @param revision2 second revision
* @param localPath target local path
* @param force overwrite local changes
* @param recurse traverse into subdirectories
* @param dryRun do not update working copy
* @exception SVNClientException
*/
public abstract void merge(SVNUrl path1, SVNRevision revision1, SVNUrl path2,
SVNRevision revision2, File localPath, boolean force,
boolean recurse, boolean dryRun) throws SVNClientException;
/**
* Merge changes from two paths into a new local path.
* @param path1 first path or url
* @param revision1 first revision
* @param path2 second path or url
* @param revision2 second revision
* @param localPath target local path
* @param force overwrite local changes
* @param recurse traverse into subdirectories
* @param dryRun do not update working copy
* @param ignoreAncestry ignore ancestry when calculating merges
* @exception SVNClientException
*/
public abstract void merge(SVNUrl path1, SVNRevision revision1, SVNUrl path2,
SVNRevision revision2, File localPath, boolean force,
boolean recurse, boolean dryRun, boolean ignoreAncestry) throws SVNClientException;
/**
* Merge changes from two paths into a new local path.
* @param path1 first path or url
* @param revision1 first revision
* @param path2 second path or url
* @param revision2 second revision
* @param localPath target local path
* @param force overwrite local changes
* @param int depth
* @param dryRun do not update working copy
* @param ignoreAncestry ignore ancestry when calculating merges
* @param recordOnly just records mergeinfo, does not perform merge
* @exception SVNClientException
*/
public abstract void merge(SVNUrl path1, SVNRevision revision1, SVNUrl path2,
SVNRevision revision2, File localPath, boolean force,
int depth, boolean dryRun, boolean ignoreAncestry,
boolean recordOnly) throws SVNClientException;
/**
* Perform a reintegration merge of path into localPath.
* localPath must be a single-revision, infinite depth,
* pristine, unswitched working copy -- in other words, it must
* reflect a single revision tree, the "target". The mergeinfo on
* path must reflect that all of the target has been merged into it.
* Then this behaves like a merge from the target's URL to the
* localPath.
*
* The depth of the merge is always infinity.
* @param path path or url
* @param pegRevision revision to interpret path
* @param localPath target local path
* @param force THIS IS NOT CURRENTLY USED
* @param dryRun do not update working copy
* @exception SVNClientException
*/
public abstract void mergeReintegrate(SVNUrl path, SVNRevision pegRevision,
File localPath, boolean force, boolean dryRun) throws SVNClientException;
/**
* Lock a working copy item
* @param paths path of the items to lock
* @param comment
* @param force break an existing lock
* @throws SVNClientException
*/
public abstract void lock(SVNUrl[] paths, String comment, boolean force)
throws SVNClientException;
/**
* Unlock a working copy item
* @param paths path of the items to unlock
* @param force break an existing lock
* @throws SVNClientException
*/
public abstract void unlock(SVNUrl[] paths, boolean force)
throws SVNClientException;
/**
* Lock a working copy item
* @param paths path of the items to lock
* @param comment
* @param force break an existing lock
* @throws SVNClientException
*/
public abstract void lock(File[] paths, String comment, boolean force)
throws SVNClientException;
/**
* Unlock a working copy item
* @param paths path of the items to unlock
* @param force break an existing lock
* @throws SVNClientException
*/
public abstract void unlock(File[] paths, boolean force)
throws SVNClientException;
/**
* Indicates whether a status call that contacts the
* server includes the remote info in the status object
* @return true when the client adapter implementation delivers remote info within status
*/
public abstract boolean statusReturnsRemoteInfo();
/**
* Indicates whether the commitAcrossWC method is
* supported in the adapter
* @return true when the client adapter implementation supports commitAcrossWC
*/
public abstract boolean canCommitAcrossWC();
/**
* Returns the name of the Subversion administrative
* working copy directory. Typically will be ".svn".
* @return the name of the Subversion administrative wc dir
*/
public abstract String getAdminDirectoryName();
/**
* Returns whether the passed folder name is a Subversion
* administrative working copy directory. Will always return
* true if ".svn" is passed. Otherwise, will be based on the
* Subversion runtime
* @param name
* @return true whether the folder is a Subversion administrative dir
*/
public abstract boolean isAdminDirectory(String name);
/**
* Rewrite the url's in the working copy
* @param from old url
* @param to new url
* @param path working copy path
* @param recurse recurse into subdirectories
* @throws SVNClientException
*/
public abstract void relocate(String from, String to, String path, boolean recurse)
throws SVNClientException;
/**
* Merge set of revisions into a new local path.
* @param url url
* @param pegRevision revision to interpret path
* @param revisions revisions to merge (must be in the form N-1:M)
* @param localPath target local path
* @param force overwrite local changes
* @param depth how deep to traverse into subdirectories
* @param ignoreAncestry ignore if files are not related
* @param dryRun do not change anything
* @param recordOnly just records mergeinfo, does not perform merge
* @throws SVNClientException
*/
public abstract void merge(SVNUrl url, SVNRevision pegRevision, SVNRevisionRange[] revisions,
File localPath, boolean force, int depth,
boolean ignoreAncestry, boolean dryRun,
boolean recordOnly) throws SVNClientException;
/**
* Get merge info for path
at revision
.
* @param path Local Path.
* @param revision SVNRevision at which to get the merge info for
* path
.
* @throws SVNClientException
*/
public abstract ISVNMergeInfo getMergeInfo(File path, SVNRevision revision)
throws SVNClientException;
/**
* Get merge info for url
at revision
.
* @param url URL.
* @param revision SVNRevision at which to get the merge info for
* path
.
* @throws SVNClientException
*/
public abstract ISVNMergeInfo getMergeInfo(SVNUrl url, SVNRevision revision)
throws SVNClientException;
/**
* Retrieve either merged or eligible-to-be-merged revisions.
* @param kind kind of revisions to receive
* @param path target of merge
* @param pegRevision peg rev for path
* @param mergeSourceUrl the source of the merge
* @param srcPegRevision peg rev for mergeSourceUrl
* @param discoverChangedPaths return paths of changed items
* @return array of log messages
* @throws SVNClientException
*/
public abstract ISVNLogMessage[] getMergeinfoLog(int kind, File path,
SVNRevision pegRevision, SVNUrl mergeSourceUrl, SVNRevision srcPegRevision,
boolean discoverChangedPaths) throws SVNClientException;
/**
* Retrieve either merged or eligible-to-be-merged revisions.
* @param kind kind of revisions to receive
* @param url target of merge
* @param pegRevision peg rev for path
* @param mergeSourceUrl the source of the merge
* @param srcPegRevision peg rev for mergeSourceUrl
* @param discoverChangedPaths return paths of changed items
* @return array of log messages
* @throws SVNClientException
*/
public abstract ISVNLogMessage[] getMergeinfoLog(int kind, SVNUrl url,
SVNRevision pegRevision, SVNUrl mergeSourceUrl, SVNRevision srcPegRevision,
boolean discoverChangedPaths) throws SVNClientException;
/**
* Produce a diff summary which lists the items changed between
* path and revision pairs.
*
* @param target1 URL.
* @param revision1 Revision of target1
.
* @param target2 URL.
* @param revision2 Revision of target2
.
* @param depth how deep to recurse.
* @param ignoreAncestry Whether to ignore unrelated files during
* comparison. False positives may potentially be reported if
* this parameter false
, since a file might have been
* modified between two revisions, but still have the same
* contents.
* @return the list of differences
*
* @throws SVNClientException
*/
public abstract SVNDiffSummary[] diffSummarize(SVNUrl target1, SVNRevision revision1,
SVNUrl target2, SVNRevision revision2,
int depth, boolean ignoreAncestry)
throws SVNClientException;
/**
* Produce a diff summary which lists the items changed between
* path and revision pairs.
*
* @param target URL.
* @param pegRevision Revision at which to interpret
* target
. If {@link RevisionKind#unspecified} or
* null
, behave identically to {@link
* diffSummarize(String, Revision, String, Revision, boolean,
* boolean, DiffSummaryReceiver)}, using path
for
* both of that method's targets.
* @param startRevision Beginning of range for comparsion of
* target
.
* @param endRevision End of range for comparsion of
* target
.
* @param depth how deep to recurse.
* @param ignoreAncestry Whether to ignore unrelated files during
* comparison. False positives may potentially be reported if
* this parameter false
, since a file might have been
* modified between two revisions, but still have the same
* contents.
* @return the list of differences
*
* @throws SVNClientException
*/
public abstract SVNDiffSummary[] diffSummarize(SVNUrl target, SVNRevision pegRevision,
SVNRevision startRevision, SVNRevision endRevision,
int depth, boolean ignoreAncestry)
throws SVNClientException;
/**
* Return an ordered list of suggested merge source URLs.
* @param path The merge target path for which to suggest sources.
* @return The list of URLs, empty if there are no suggestions.
* @throws SVNClientException If an error occurs.
*/
public abstract String[] suggestMergeSources(File path)
throws SVNClientException;
/**
* Return an ordered list of suggested merge source URLs.
* @param url The merge target path for which to suggest sources.
* @param peg The peg revision for the URL
* @return The list of URLs, empty if there are no suggestions.
* @throws SVNClientException If an error occurs.
*/
public abstract String[] suggestMergeSources(SVNUrl url, SVNRevision peg)
throws SVNClientException;
/**
* release the native peer (should not depend on finalize)
*/
public abstract void dispose();
}
././@LongLink 0000000 0000000 0000000 00000000153 00000000000 011564 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNProgressEvent.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNProgressEven0000644 0000000 0000000 00000000606 10707474414 032712 0 ustar root root package org.tigris.subversion.svnclientadapter;
public class SVNProgressEvent {
private long progress;
private long total;
public final static long UNKNOWN = -1;
public SVNProgressEvent(long progress, long total) {
super();
this.progress = progress;
this.total = total;
}
public long getProgress() {
return progress;
}
public long getTotal() {
return total;
}
}
libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNInfo.java 0000644 0000000 0000000 00000007374 11160556772 032227 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.io.File;
import java.util.Date;
/**
* Give information about one subversion item (file or directory) in the
* working copy
*/
public interface ISVNInfo
{
/**
* file on which we get info
* @return file
*/
public File getFile();
/**
* Retrieves the url of the item
* @return url of the item
*/
public SVNUrl getUrl();
/**
* Retrieves the url (string) of the item
* @return url of the item
*/
public String getUrlString();
/**
* Retrieves the uuid of the repository
* @return uuid of the repository
*/
public String getUuid();
/**
* Retrieves the url of the repository
* @return url of the repository
*/
public SVNUrl getRepository();
/**
* Retrieves the schedule of the next commit
* @return schedule of the next commit
*/
public SVNScheduleKind getSchedule();
/**
* Retrieves the nodeKind
* @return nodeKind
*/
public SVNNodeKind getNodeKind();
/**
* Retrieves the author of the last commit
* @return author of the last commit
*/
public String getLastCommitAuthor();
/**
* Retrieves the last revision the item was updated to
* @return last revision the item was updated to
*/
public SVNRevision.Number getRevision();
/**
* Retrieves the revision of the last commit
* @return the revision of the last commit
*/
public SVNRevision.Number getLastChangedRevision();
/**
* Retrieves the date of the last commit
* @return the date of the last commit
*/
public Date getLastChangedDate();
/**
* Retrieves the last date the text content was changed
* @return last date the text content was changed
*/
public Date getLastDateTextUpdate();
/**
* Retrieves the last date the properties were changed
* @return last date the properties were changed
*/
public Date getLastDatePropsUpdate();
/**
* Retrieve if the item was copied
* @return the item was copied
*/
public boolean isCopied();
/**
* Retrieves the copy source revision
* @return copy source revision
*/
public SVNRevision.Number getCopyRev();
/**
* Retrieves the copy source url
* @return copy source url
*/
public SVNUrl getCopyUrl();
/**
* Retrieves the lock owner (may be null)
* @return lock owner
*/
public String getLockOwner();
/**
* Retrieves the lock creation date (may be null)
* @return lock creation date
*/
public Date getLockCreationDate();
/**
* Retrieves the lock comment (may be null)
* @return lock comment
*/
public String getLockComment();
/**
* Retrieves the depth of the item
* @return depth
*/
public int getDepth();
}
././@LongLink 0000000 0000000 0000000 00000000153 00000000000 011564 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNRevisionRange.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNRevisionRang0000644 0000000 0000000 00000017545 10725052116 032677 0 ustar root root /*******************************************************************************
* Copyright (c) 2007 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.util.ArrayList;
import java.util.Arrays;
/**
* Object that describes a revision range
*
* copied from JavaHL implementation
*
*/
public class SVNRevisionRange implements Comparable, java.io.Serializable
{
// Update the serialVersionUID when there is a incompatible change
// made to this class. See any of the following, depending upon
// the Java release.
// http://java.sun.com/j2se/1.3/docs/guide/serialization/spec/version.doc7.html
// http://java.sun.com/j2se/1.4/pdf/serial-spec.pdf
// http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/version.html#6678
// http://java.sun.com/javase/6/docs/platform/serialization/spec/version.html#6678
private static final long serialVersionUID = 1L;
private SVNRevision from;
private SVNRevision to;
public SVNRevisionRange(SVNRevision from, SVNRevision to)
{
this.from = from;
this.to = to;
}
public SVNRevisionRange(SVNRevision.Number from, SVNRevision.Number to, boolean convertToNMinusOne)
{
if (convertToNMinusOne) {
this.from = new SVNRevision.Number(from.getNumber() - 1);
} else
this.from = from;
this.to = to;
}
/**
* Accepts a string in one of these forms: n m-n Parses the results into a
* from and to revision
* @param revisionElement revision range or single revision
*/
public SVNRevisionRange(String revisionElement)
{
super();
if (revisionElement == null)
{
return;
}
int hyphen = revisionElement.indexOf('-');
if (hyphen > 0)
{
try
{
long fromRev = Long
.parseLong(revisionElement.substring(0, hyphen));
long toRev = Long.parseLong(revisionElement
.substring(hyphen + 1));
this.from = new SVNRevision.Number(fromRev);
this.to = new SVNRevision.Number(toRev);
}
catch (NumberFormatException e)
{
return;
}
}
else
{
try
{
long revNum = Long.parseLong(revisionElement.trim());
this.from = new SVNRevision.Number(revNum);
this.to = this.from;
}
catch (NumberFormatException e)
{
return;
}
}
}
public SVNRevision getFromRevision()
{
return from;
}
public SVNRevision getToRevision()
{
return to;
}
public String toString()
{
if (from != null && to != null)
{
if (from.equals(to))
return from.toString();
else
return from.toString() + '-' + to.toString();
}
return super.toString();
}
public static Long getRevisionAsLong(SVNRevision rev)
{
long val = 0;
if (rev != null && rev instanceof SVNRevision.Number)
{
val = ((SVNRevision.Number) rev).getNumber();
}
return new Long(val);
}
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((from == null) ? 0 : from.hashCode());
result = prime * result + ((to == null) ? 0 : to.hashCode());
return result;
}
/**
* @param range The RevisionRange to compare this object to.
*/
public boolean equals(Object range)
{
if (this == range)
return true;
if (!super.equals(range))
return false;
if (getClass() != range.getClass())
return false;
final SVNRevisionRange other = (SVNRevisionRange) range;
if (from == null)
{
if (other.from != null)
return false;
}
else if (!from.equals(other.from))
{
return false;
}
if (to == null)
{
if (other.to != null)
return false;
}
else if (!to.equals(other.to))
{
return false;
}
return true;
}
/**
* @param range The RevisionRange to compare this object to.
*/
public int compareTo(Object range)
{
if (this == range)
return 0;
SVNRevision other = ((SVNRevisionRange) range).getFromRevision();
return SVNRevisionRange.getRevisionAsLong(this.getFromRevision())
.compareTo(SVNRevisionRange.getRevisionAsLong(other));
}
public static SVNRevisionRange[] getRevisions(SVNRevision.Number[] selectedRevisions, SVNRevision.Number[] allRevisions) {
Arrays.sort(selectedRevisions);
Arrays.sort(allRevisions);
ArrayList svnRevisionRanges = new ArrayList();
SVNRevision.Number fromRevision = null;
SVNRevision.Number toRevision = null;
int j = 0;
for (int i = 0; i < selectedRevisions.length; i++) {
if (fromRevision == null) {
fromRevision = selectedRevisions[i];
while (allRevisions[j++].getNumber() != selectedRevisions[i].getNumber()) {}
} else {
if (selectedRevisions[i].getNumber() != allRevisions[j++].getNumber()) {
SVNRevisionRange revisionRange = new SVNRevisionRange(fromRevision, toRevision, true);
svnRevisionRanges.add(revisionRange);
fromRevision = selectedRevisions[i];
while (allRevisions[j++].getNumber() != selectedRevisions[i].getNumber()) {}
}
}
toRevision = selectedRevisions[i];
}
if (toRevision != null) {
SVNRevisionRange revisionRange = new SVNRevisionRange(fromRevision, toRevision, true);
svnRevisionRanges.add(revisionRange);
}
SVNRevisionRange[] revisionRangeArray = new SVNRevisionRange[svnRevisionRanges.size()];
svnRevisionRanges.toArray(revisionRangeArray);
return revisionRangeArray;
}
/**
* Returns boolean whether revision is contained in the range
* @param revision
* @param inclusiveFromRev - include an exact match of from revision
* @return
*/
public boolean contains(SVNRevision revision, boolean inclusiveFromRev) {
long fromRev = SVNRevisionRange.getRevisionAsLong(from).longValue();
long toRev = SVNRevisionRange.getRevisionAsLong(to).longValue();
long rev = SVNRevisionRange.getRevisionAsLong(revision).longValue();
if (inclusiveFromRev) {
if (rev >= fromRev && (to.equals(SVNRevision.HEAD) || rev <= toRev))
return true;
else
return false;
} else {
if (rev > fromRev && (to.equals(SVNRevision.HEAD) || rev <= toRev))
return true;
else
return false;
}
}
public String toMergeString() {
long fromRev = SVNRevisionRange.getRevisionAsLong(from).longValue();
long toRev = SVNRevisionRange.getRevisionAsLong(to).longValue();
if ((fromRev + 1) == toRev) {
return "-c " + toRev;
}
return "-r " + fromRev + ":" + toRev;
}
}
././@LongLink 0000000 0000000 0000000 00000000162 00000000000 011564 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNLogMessageChangePath.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNLogMessageCh0000644 0000000 0000000 00000005231 10613664631 032566 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
/**
* A generic implementation of the {@link ISVNLogMessageChangePath} interface.
*
*/
public class SVNLogMessageChangePath implements ISVNLogMessageChangePath
{
/** Path of commited item */
private String path;
/** Source revision of copy (if any). */
private SVNRevision.Number copySrcRevision;
/** Source path of copy (if any). */
private String copySrcPath;
/** 'A'dd, 'D'elete, 'R'eplace, 'M'odify */
private char action;
/**
* Constructor
* @param path
* @param copySrcRevision
* @param copySrcPath
* @param action
*/
public SVNLogMessageChangePath(String path, SVNRevision.Number copySrcRevision, String copySrcPath, char action)
{
this.path = path;
this.copySrcRevision = copySrcRevision;
this.copySrcPath = copySrcPath;
this.action = action;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNLogMessageChangePath#getPath()
*/
public String getPath()
{
return path;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNLogMessageChangePath#getCopySrcRevision()
*/
public SVNRevision.Number getCopySrcRevision()
{
return copySrcRevision;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNLogMessageChangePath#getCopySrcPath()
*/
public String getCopySrcPath()
{
return copySrcPath;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNLogMessageChangePath#getAction()
*/
public char getAction()
{
return action;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
return getPath();
}
}
././@LongLink 0000000 0000000 0000000 00000000157 00000000000 011570 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNMergeinfoLogKind.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNMergeinfoLo0000644 0000000 0000000 00000000356 10775754555 032625 0 ustar root root package org.tigris.subversion.svnclientadapter;
public interface ISVNMergeinfoLogKind {
/** does not exist */
public static final int eligible = 0;
/** exists, but uninteresting */
public static final int merged = 1;
}
././@LongLink 0000000 0000000 0000000 00000000146 00000000000 011566 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/Annotations.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/Annotations.jav0000644 0000000 0000000 00000014753 11066166231 032757 0 ustar root root /*******************************************************************************
* Copyright (c) 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* Generic implementation of {@link ISVNAnnotations} interface.
* It's expected to be filled with annotation data by
* {@link #addAnnotation(Annotations.Annotation)} method.
*
*/
public class Annotations implements ISVNAnnotations {
/** list of annotation records (lines) */
private List annotations = new ArrayList();
protected Annotation getAnnotation(int i) {
if (i >= this.annotations.size()) {
return null;
}
return (Annotation) this.annotations.get(i);
}
/**
* Append the given annotation record the list of annotation
* @param annotation
*/
public void addAnnotation(Annotation annotation)
{
this.annotations.add(annotation);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNAnnotations#getRevision(int)
*/
public long getRevision(int lineNumber) {
Annotation annotation = getAnnotation(lineNumber);
if (annotation == null) {
return -1;
} else {
return annotation.getRevision();
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNAnnotations#getAuthor(int)
*/
public String getAuthor(int lineNumber) {
Annotation annotation = getAnnotation(lineNumber);
if (annotation == null) {
return null;
} else {
return annotation.getAuthor();
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNAnnotations#getChanged(int)
*/
public Date getChanged(int lineNumber) {
Annotation annotation = getAnnotation(lineNumber);
if (annotation == null) {
return null;
} else {
return annotation.getChanged();
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNAnnotations#getLine(int)
*/
public String getLine(int lineNumber) {
Annotation annotation = getAnnotation(lineNumber);
if (annotation == null) {
return null;
} else {
return annotation.getLine();
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNAnnotations#getInputStream()
*/
public InputStream getInputStream() {
return new AnnotateInputStream(this);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNAnnotations#numberOfLines()
*/
public int numberOfLines() {
return this.annotations.size();
}
/**
* Class represeting one line of the annotations, i.e. an annotation record
*
*/
public static class Annotation {
private long revision;
private String author;
private Date changed;
private String line;
/**
* Constructor
*
* @param revision
* @param author
* @param changed
* @param line
*/
public Annotation(long revision, String author, Date changed,
String line) {
super();
if (revision == -1) {
this.revision = 0;
this.author = "No change";
this.changed = new Date();
} else {
this.revision = revision;
this.author = author;
this.changed = changed;
}
this.line = line;
}
/**
* @return Returns the author.
*/
public String getAuthor() {
return author;
}
/**
* @return Returns the changed.
*/
public Date getChanged() {
return changed;
}
/**
* @return Returns the line.
*/
public String getLine() {
return line;
}
/**
* @param line The line to set.
*/
public void setLine(String line) {
this.line = line;
}
/**
* @return Returns the revision.
*/
public long getRevision() {
return revision;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
return getRevision() + ":" + getAuthor() + ":" + getLine();
}
}
protected static class AnnotateInputStream extends InputStream {
private ISVNAnnotations annotations;
private int currentLineNumber;
private int currentPos;
private String currentLine;
private int available;
/**
* Constructor
* @param annotations
*/
public AnnotateInputStream(ISVNAnnotations annotations) {
this.annotations = annotations;
initialize();
}
private void initialize() {
currentLine = annotations.getLine(0);
currentLineNumber = 0;
currentPos = 0;
available = 0;
int annotationsSize = annotations.numberOfLines();
for (int i = 0; i < annotationsSize;i++) {
available += annotations.getLine(i).length();
if (i != annotationsSize-1) {
available++; // +1 for \n
}
}
}
private void getNextLine() {
currentLineNumber++;
currentPos = 0;
currentLine = annotations.getLine(currentLineNumber);
}
/* (non-Javadoc)
* @see java.io.InputStream#read()
*/
public int read() throws IOException {
if (currentLineNumber >= annotations.numberOfLines())
return -1; // end of stream
if (currentPos > currentLine.length()) {
getNextLine();
if (currentLineNumber >= annotations.numberOfLines())
return -1; // end of stream
}
int character;
if (currentPos == currentLine.length())
character = '\n';
else
character = currentLine.charAt(currentPos);
currentPos++;
available--;
return character;
}
/* (non-Javadoc)
* @see java.io.InputStream#available()
*/
public int available() throws IOException {
return available;
}
/* (non-Javadoc)
* @see java.io.InputStream#reset()
*/
public synchronized void reset() throws IOException {
initialize();
}
}
}
././@LongLink 0000000 0000000 0000000 00000000151 00000000000 011562 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNDiffSummary.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNDiffSummary.0000644 0000000 0000000 00000012325 10664574006 032575 0 ustar root root /*******************************************************************************
* Copyright (c) 2007 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.util.EventObject;
/**
* The event passed to the {@link
* DiffSummarizer.summarize(SVNDiffSummary)} API in response to path
* differences reported by {@link ISVNClientAdapter#diffSummarize}.
*
*/
public class SVNDiffSummary extends EventObject
{
// Update the serialVersionUID when there is a incompatible change
// made to this class. See any of the following, depending upon
// the Java release.
// http://java.sun.com/j2se/1.3/docs/guide/serialization/spec/version.doc7.html
// http://java.sun.com/j2se/1.4/pdf/serial-spec.pdf
// http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/version.html#6678
// http://java.sun.com/javase/6/docs/platform/serialization/spec/version.html#6678
private static final long serialVersionUID = 1L;
private SVNDiffKind diffKind;
private boolean propsChanged;
private int nodeKind;
/**
* This constructor is to be used by the native code.
*
* @param path The path we have a diff for.
* @param diffKind The kind of diff this describes.
* @param propChanged Whether any properties have changed.
* @param nodeKind The type of node which changed (corresponds to
* the {@link SVNNodeKind} enumeration).
*/
public SVNDiffSummary(String path, SVNDiffKind diffKind, boolean propsChanged,
int nodeKind)
{
super(path);
this.diffKind = diffKind;
this.propsChanged = propsChanged;
this.nodeKind = nodeKind;
}
/**
* @return The path we have a diff for.
*/
public String getPath()
{
return (String) super.source;
}
/**
* @return The kind of summary this describes.
*/
public SVNDiffKind getDiffKind()
{
return this.diffKind;
}
/**
* @return Whether any properties have changed.
*/
public boolean propsChanged()
{
return this.propsChanged;
}
/**
* @return The type of node which changed (corresponds to the
* {@link NodeKind} enumeration).
*/
public int getNodeKind()
{
return this.nodeKind;
}
/**
* @return The path.
*/
public String toString()
{
return getPath();
}
/**
* The type of difference being summarized.
*/
public static class SVNDiffKind
{
// Corresponds to the svn_client_diff_summarize_kind_t enum.
public static SVNDiffKind NORMAL = new SVNDiffKind(0);
public static SVNDiffKind ADDED = new SVNDiffKind(1);
public static SVNDiffKind MODIFIED = new SVNDiffKind(2);
public static SVNDiffKind DELETED = new SVNDiffKind(3);
private int kind;
private SVNDiffKind(int kind)
{
this.kind = kind;
}
/**
* @return The appropriate instance.
* @throws IllegalArgumentException If the diff kind is not
* recognized.
*/
public static SVNDiffKind getInstance(int diffKind)
throws IllegalArgumentException
{
switch (diffKind)
{
case 0:
return NORMAL;
case 1:
return ADDED;
case 2:
return MODIFIED;
case 3:
return DELETED;
default:
throw new IllegalArgumentException("Diff kind " + diffKind +
" not recognized");
}
}
/**
* @param diffKind A DiffKind for comparison.
* @return Whether both DiffKinds are of the same type.
*/
public boolean equals(Object diffKind)
{
return (((SVNDiffKind) diffKind).kind == this.kind);
}
public int hashCode()
{
// Equivalent to new Integer(this.kind).hashCode().
return this.kind;
}
/**
* @return A textual representation of the type of diff.
*/
public String toString()
{
switch (this.kind)
{
case 0:
return "normal";
case 1:
return "added";
case 2:
return "modified";
case 3:
return "deleted";
default:
return "unknown";
}
}
}
}
././@LongLink 0000000 0000000 0000000 00000000145 00000000000 011565 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNBaseDir.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNBaseDir.java0000644 0000000 0000000 00000013655 10616434350 032523 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.io.File;
import java.io.IOException;
import org.tigris.subversion.svnclientadapter.utils.StringUtils;
/**
* During notification (both with svn command line and javahl), the files and
* directories are sometimes relative (with svn commit for ex). However it is
* not relative to current directory but relative to the common parent of the
* current directory and the working copy target
*
* ex : if working copy is at /home/cedric/programmation/sources/test and
* current dir is /home/cedric/projects/subversion/subclipse
*
* $svn ci /home/cedric/programmation/sources/test/essai8 Adding
* programmation/sources/test/essai8
*
* @author Cedric Chabanois (cchab at tigris.org)
* @author John M Flinchbaugh (john at hjsoft.com)
*/
public class SVNBaseDir {
/**
* get the common directory between file1 and file2 or null if the files
* have nothing in common it always returns a directory unless file1 is the
* same file than file2
*
* @param file1
* @param file2
*/
protected static File getCommonPart(File file1, File file2) {
if (file1 == null)
return null;
if (file2 == null)
return null;
String file1AbsPath;
String file2AbsPath;
file1AbsPath = file1.getAbsolutePath();
file2AbsPath = file2.getAbsolutePath();
if (file1AbsPath.equals(file2AbsPath)) {
return new File(file1AbsPath);
}
String[] file1Parts = StringUtils.split(file1AbsPath,
File.separatorChar);
String[] file2Parts = StringUtils.split(file2AbsPath,
File.separatorChar);
if (file1Parts[0].equals(""))
file1Parts[0] = File.separator;
if (file2Parts[0].equals(""))
file2Parts[0] = File.separator;
int parts1Length = file1Parts.length;
int parts2Length = file2Parts.length;
int minLength = (parts1Length < parts2Length) ? parts1Length
: parts2Length;
String part1;
String part2;
StringBuffer commonsPart = new StringBuffer();
for (int i = 0; i < minLength; i++) {
part1 = file1Parts[i];
part2 = file2Parts[i];
if (!part1.equals(part2)) {
break;
}
if (i > 0) {
commonsPart.append(File.separatorChar);
}
commonsPart.append(part1);
}
if (commonsPart.length() == 0) {
return null; // the two files have nothing in common (one on disk c:
// and the other on d: for ex)
}
return new File(commonsPart.toString());
}
/**
* get the base directory for the given file
*
* @param file
* @return the base directory for the given file or null if there is no base
*/
static public File getBaseDir(File file) {
return getBaseDir(new File[] { file });
}
/**
* get the base directory for a set of files or null if there is no base
* directory for the set of files
*
* @param files
* @return the base directory for the given set of files or null if there is no base
*/
static public File getBaseDir(File[] files) {
File rootDir = getRootDir(files);
// get the common part between current directory and other files
File baseDir = getCommonPart(rootDir, new File("."));
return baseDir;
}
/**
* get the root directory for a set of files ie the ancestor of all given
* files
*
* @param files
* @return @throws
* SVNClientException
*/
static public File getRootDir(File[] files) {
if ((files == null) || (files.length == 0)) {
return null;
}
File[] canonicalFiles = new File[files.length];
for (int i = 0; i < files.length; i++) {
canonicalFiles[i] = files[i].getAbsoluteFile();
}
// first get the common part between all files
File commonPart = canonicalFiles[0];
for (int i = 0; i < files.length; i++) {
commonPart = getCommonPart(commonPart, canonicalFiles[i]);
if (commonPart == null) {
return null;
}
}
if (commonPart.isFile()) {
return commonPart.getParentFile();
} else {
return commonPart;
}
}
/**
* get path of file relative to rootDir
*
* @param rootDir
* @param file
* @return path of file relative to rootDir
* @throws SVNClientException
*/
static public String getRelativePath(File rootDir, File file)
throws SVNClientException {
try {
String rootPath = rootDir.getCanonicalPath();
String filePath = file.getCanonicalPath();
if (!filePath.startsWith(rootPath)) {
return null;
}
return filePath.substring(rootPath.length());
} catch (IOException e) {
throw SVNClientException.wrapException(e);
}
}
} ././@LongLink 0000000 0000000 0000000 00000000147 00000000000 011567 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNDirEntry.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNDirEntry.ja0000644 0000000 0000000 00000003433 10613664631 032531 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.util.Date;
/**
* An interface describing subversion directory entry.
* (E.g. a record returned by call to svn list)
*
* @author Cédric Chabanois
*/
public interface ISVNDirEntry {
/**
* @return the pathname of the entry
*/
String getPath();
/**
* @return the date of the last change
*/
Date getLastChangedDate();
/**
* @return the revision number of the last change
*/
SVNRevision.Number getLastChangedRevision();
/**
* @return true if the item has properties managed by subversion
*/
boolean getHasProps();
/**
* @return the name of the author of the last change
*/
String getLastCommitAuthor();
/**
* @return the kind of the node (directory or file)
*/
SVNNodeKind getNodeKind();
/**
* @return length of file text, or 0 for directories
*/
long getSize();
}
././@LongLink 0000000 0000000 0000000 00000000157 00000000000 011570 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNStatusUnversioned.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNStatusUnvers0000644 0000000 0000000 00000015043 11147073645 032757 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.io.File;
import java.util.Date;
/**
* A special {@link ISVNStatus} implementation that is used if a File/Folder is not versioned or is ignored.
*
* @author Philip Schatz (schatz at tigris)
* @author Cédric Chabanois (cchabanois at no-log.org)
*/
public class SVNStatusUnversioned implements ISVNStatus {
private File file;
private boolean isIgnored = false;
/**
* Constructor.
* @param file
* @param isIgnored true when creating {@link SVNStatusKind#IGNORED}, otherwise {@link SVNStatusKind#UNVERSIONED}
*/
public SVNStatusUnversioned(File file, boolean isIgnored) {
this.file = file;
// A file can be both unversioned and ignored.
this.isIgnored = isIgnored;
}
/**
* Constructor.
* Creates an unversioned status (i.e. not ignored)
* @param file
*/
public SVNStatusUnversioned(File file) {
this.file = file;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getPath()
*/
public String getPath() {
return file.getPath();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getFile()
*/
public File getFile() {
return file.getAbsoluteFile();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getUrl()
*/
public SVNUrl getUrl() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getUrlString()
*/
public String getUrlString()
{
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getLastChangedRevision()
*/
public SVNRevision.Number getLastChangedRevision() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getLastChangedDate()
*/
public Date getLastChangedDate() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getLastCommitAuthor()
*/
public String getLastCommitAuthor() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getTextStatus()
*/
public SVNStatusKind getTextStatus() {
if (isIgnored) {
return SVNStatusKind.IGNORED;
}
return SVNStatusKind.UNVERSIONED;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getPropStatus()
*/
public SVNStatusKind getPropStatus() {
//As this status does not describe a managed resource, we
//cannot pretend that there is property status, and thus always
//{@link SVNStatusKind#NONE}.
return SVNStatusKind.NONE;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getRepositoryTextStatus()
*/
public SVNStatusKind getRepositoryTextStatus() {
return SVNStatusKind.UNVERSIONED;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getRepositoryPropStatus()
*/
public SVNStatusKind getRepositoryPropStatus() {
return SVNStatusKind.UNVERSIONED;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getRevision()
*/
public SVNRevision.Number getRevision() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#isCopied()
*/
public boolean isCopied() {
return false;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#isWcLocked()
*/
public boolean isWcLocked() {
return false;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#isSwitched()
*/
public boolean isSwitched() {
return false;
}
/* (non-Javadoc)
* @see
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getNodeKind()
*/
public SVNNodeKind getNodeKind() {
//As this status does not describe a managed resource, we
//cannot pretend to know the node kind, and thus always return
//{@link SVNNodeKind#UNKNOWN}.
return SVNNodeKind.UNKNOWN;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getUrlCopiedFrom()
*/
public SVNUrl getUrlCopiedFrom() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getConflictNew()
*/
public File getConflictNew() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getConflictOld()
*/
public File getConflictOld() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getConflictWorking()
*/
public File getConflictWorking() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getLockComment()
*/
public String getLockComment() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getLockCreationDate()
*/
public Date getLockCreationDate() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getLockOwner()
*/
public String getLockOwner() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#getConflictDescriptor()
*/
public SVNConflictDescriptor getConflictDescriptor() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#hasTreeConflict()
*/
public boolean hasTreeConflict() {
// TODO Auto-generated method stub
return false;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNStatus#isFileExternal()
*/
public boolean isFileExternal() {
return false;
}
}
././@LongLink 0000000 0000000 0000000 00000000161 00000000000 011563 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNLogMessageCallback.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNLogMessageC0000644 0000000 0000000 00000003607 11035734453 032533 0 ustar root root /*******************************************************************************
* Copyright (c) 2008 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
/**
* This interface is used to receive every log message for the log
* messages found by a ISVNClientAdapter.getLogMessages call.
*
* All log messages are returned in a list, which is terminated by an
* invocation of this callback with the message set to NULL.
*
* If the includeMergedRevisions parameter to ISVNClientAdapter.getLogMessages
* is true, then messages returned through this callback may have the
* hasChildren parameter set. This parameter indicates that a separate list,
* which includes messages for merged revisions, will immediately follow.
* This list is also terminated with NULL, after which the
* previous log message list continues.
*
* Log message lists may be nested arbitrarily deep, depending on the ancestry
* of the requested paths.
*/
public interface ISVNLogMessageCallback {
/**
* The method will be called for every log message.
*
* @param message the log message
*/
public void singleMessage(ISVNLogMessage message);
}
././@LongLink 0000000 0000000 0000000 00000000152 00000000000 011563 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNScheduleKind.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNScheduleKind0000644 0000000 0000000 00000007727 10613664631 032643 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
/**
* Schedule kind an entry can be in.
* @see ISVNInfo#getSchedule()
*/
public class SVNScheduleKind {
private int kind;
private static final int normal = 0;
private static final int add = 1;
private static final int delete = 2;
private static final int replace = 3;
/** exists, but uninteresting */
public static final SVNScheduleKind NORMAL = new SVNScheduleKind(normal);
/** Slated for addition */
public static final SVNScheduleKind ADD = new SVNScheduleKind(add);
/** Slated for deletion */
public static final SVNScheduleKind DELETE = new SVNScheduleKind(delete);
/** Slated for replacement (delete + add) */
public static final SVNScheduleKind REPLACE = new SVNScheduleKind(replace);
private SVNScheduleKind(int kind) {
this.kind = kind;
}
/**
* @return an integer value representation of the scheduleKind
*/
public int toInt() {
return kind;
}
/**
* Returns the SVNScheduleKind corresponding to the given int representation.
* (As returned by {@link SVNScheduleKind#toInt()} method)
* @param scheduleKind
* @return SVNScheduleKind representing the int value
*/
public SVNScheduleKind fromInt(int scheduleKind) {
switch(scheduleKind)
{
case normal:
return NORMAL;
case add:
return ADD;
case delete:
return DELETE;
case replace:
return REPLACE;
default:
return null;
}
}
/**
* returns the ScheduleKind corresponding to the given string or null
* @param scheduleKind
* @return SVNScheduleKind representing the supplied string value
*/
public static SVNScheduleKind fromString(String scheduleKind) {
if (NORMAL.toString().equals(scheduleKind)) {
return NORMAL;
} else
if (ADD.toString().equals(scheduleKind)) {
return ADD;
} else
if (DELETE.toString().equals(scheduleKind)) {
return DELETE;
} else
if (REPLACE.toString().equals(scheduleKind)) {
return REPLACE;
} else
return null;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
switch(kind)
{
case normal:
return "normal";
case add:
return "add";
case delete:
return "delete";
case replace:
return "replace";
default:
return "";
}
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
if (!(obj instanceof SVNScheduleKind)) {
return false;
}
return ((SVNScheduleKind)obj).kind == kind;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
return new Integer(kind).hashCode();
}
}
././@LongLink 0000000 0000000 0000000 00000000157 00000000000 011570 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNProgressListener.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNProgressLis0000644 0000000 0000000 00000000227 10707474414 032654 0 ustar root root package org.tigris.subversion.svnclientadapter;
public interface ISVNProgressListener {
public void onProgress(SVNProgressEvent progressEvent);
}
././@LongLink 0000000 0000000 0000000 00000000160 00000000000 011562 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNConflictDescriptor.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNConflictDesc0000644 0000000 0000000 00000013664 11147073645 032640 0 ustar root root /*******************************************************************************
* Copyright (c) 2005, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
/**
* The description of a merge conflict, encountered during
* merge/update/switch operations.
*
* copied from JavaHL ConflictDescriptor
*/
public class SVNConflictDescriptor
{
private String path;
/**
* @see .Kind
*/
private int conflictKind;
/**
* @see org.tigris.subversion.javahl.NodeKind
*/
private int nodeKind;
private String propertyName;
private boolean isBinary;
private String mimeType;
private int action;
private int reason;
private int operation;
private SVNConflictVersion srcLeftVersion;
private SVNConflictVersion srcRightVersion;
// File paths, present only when the conflict involves the merging
// of two files descended from a common ancestor, here are the
// paths of up to four fulltext files that can be used to
// interactively resolve the conflict.
private String basePath;
private String theirPath;
private String myPath;
private String mergedPath;
public SVNConflictDescriptor(String path, int conflictKind, int nodeKind,
String propertyName, boolean isBinary,
String mimeType, int action, int reason, int operation,
SVNConflictVersion srcLeftVersion, SVNConflictVersion srcRightVersion,
String basePath, String theirPath,
String myPath, String mergedPath)
{
this.path = path;
this.conflictKind = conflictKind;
this.nodeKind = nodeKind;
this.propertyName = propertyName;
this.isBinary = isBinary;
this.mimeType = mimeType;
this.action = action;
this.reason = reason;
this.srcLeftVersion = srcLeftVersion;
this.srcRightVersion = srcRightVersion;
this.operation = operation;
this.basePath = basePath;
this.theirPath = theirPath;
this.myPath = myPath;
this.mergedPath = mergedPath;
}
public SVNConflictDescriptor(String path, int action, int reason, int operation, SVNConflictVersion srcLeftVersion, SVNConflictVersion srcRightVersion) {
this.path = path;
this.action = action;
this.reason = reason;
this.operation = operation;
this.srcLeftVersion = srcLeftVersion;
this.srcRightVersion = srcRightVersion;
}
public String getPath()
{
return path;
}
public int getConflictKind()
{
return conflictKind;
}
public int getNodeKind()
{
return nodeKind;
}
public String getPropertyName()
{
return propertyName;
}
public boolean isBinary()
{
return isBinary;
}
public String getMIMEType()
{
return mimeType;
}
public int getAction()
{
return action;
}
public int getReason()
{
return reason;
}
public int getOperation()
{
return operation;
}
public SVNConflictVersion getSrcLeftVersion()
{
return srcLeftVersion;
}
public SVNConflictVersion getSrcRightVersion()
{
return srcRightVersion;
}
public String getBasePath()
{
return basePath;
}
public String getTheirPath()
{
return theirPath;
}
public String getMyPath()
{
return myPath;
}
public String getMergedPath()
{
return mergedPath;
}
/**
* From JavaHL.
*/
public final class Kind
{
/**
* Attempting to change text or props.
*/
public static final int text = 0;
/**
* Attempting to add object.
*/
public static final int property = 1;
}
/**
* From JavaHL
*/
public final class Action
{
/**
* Attempting to change text or props.
*/
public static final int edit = 0;
/**
* Attempting to add object.
*/
public static final int add = 1;
/**
* Attempting to delete object.
*/
public static final int delete = 2;
}
/**
* From JavaHL
*/
public final class Reason
{
/**
* Local edits are already present.
*/
public static final int edited = 0;
/**
* Another object is in the way.
*/
public static final int obstructed = 1;
/**
* Object is already schedule-delete.
*/
public static final int deleted = 2;
/**
* Object is unknown or missing.
*/
public static final int missing = 3;
/**
* Object is unversioned.
*/
public static final int unversioned = 4;
/**
* Object is already added or schedule-add.
*/
public static final int added = 5;
}
public final class Operation
{
public static final int _none = 0;
public static final int _update = 1;
public static final int _switch = 2;
public static final int _merge = 3;
}
}
././@LongLink 0000000 0000000 0000000 00000000160 00000000000 011562 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/AbstractClientAdapter.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/AbstractClientA0000644 0000000 0000000 00000044537 11035734453 032714 0 ustar root root /*******************************************************************************
* Copyright (c) 2005, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
/**
* Default implementation of some of the methods of ISVNClientAdapter
*
* @author Cédric Chabanois (cchabanois at no-log.org)
* @author Panagiotis Korros (pkorros at bigfoot.com)
*/
public abstract class AbstractClientAdapter implements ISVNClientAdapter {
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#setKeywords(java.io.File, org.tigris.subversion.svnclientadapter.SVNKeywords, boolean)
*/
public void setKeywords(File path, SVNKeywords keywords, boolean recurse) throws SVNClientException {
propertySet(path, ISVNProperty.KEYWORDS, keywords.toString(), recurse);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#addKeywords(java.io.File, org.tigris.subversion.svnclientadapter.SVNKeywords)
*/
public SVNKeywords addKeywords(File path, SVNKeywords keywords) throws SVNClientException {
SVNKeywords currentKeywords = getKeywords(path);
if (keywords.isHeadUrl())
currentKeywords.setHeadUrl(true);
if (keywords.isId())
currentKeywords.setId(true);
if (keywords.isLastChangedBy())
currentKeywords.setLastChangedBy(true);
if (keywords.isLastChangedDate())
currentKeywords.setLastChangedBy(true);
if (keywords.isLastChangedRevision())
currentKeywords.setLastChangedRevision(true);
setKeywords(path,currentKeywords,false);
return currentKeywords;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#removeKeywords(java.io.File, org.tigris.subversion.svnclientadapter.SVNKeywords)
*/
public SVNKeywords removeKeywords(File path, SVNKeywords keywords) throws SVNClientException {
SVNKeywords currentKeywords = getKeywords(path);
if (keywords.isHeadUrl())
currentKeywords.setHeadUrl(false);
if (keywords.isId())
currentKeywords.setId(false);
if (keywords.isLastChangedBy())
currentKeywords.setLastChangedBy(false);
if (keywords.isLastChangedDate())
currentKeywords.setLastChangedBy(false);
if (keywords.isLastChangedRevision())
currentKeywords.setLastChangedRevision(false);
setKeywords(path,currentKeywords,false);
return currentKeywords;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getIgnoredPatterns(java.io.File)
*/
public List getIgnoredPatterns(File path) throws SVNClientException {
if (!path.isDirectory())
return null;
List list = new ArrayList();
ISVNProperty pd = propertyGet(path, ISVNProperty.IGNORE);
if (pd == null)
return list;
String patterns = pd.getValue();
StringTokenizer st = new StringTokenizer(patterns,"\n\r");
while (st.hasMoreTokens()) {
String entry = st.nextToken();
if ((entry != null) && (entry.length() > 0)) {
list.add(entry);
}
}
return list;
}
/* (non-Javadoc)
* @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#getLogMessages(java.io.File, org.tigris.subversion.subclipse.client.ISVNRevision, org.tigris.subversion.subclipse.client.ISVNRevision)
*/
public ISVNLogMessage[] getLogMessages(File arg0, SVNRevision arg1, SVNRevision arg2)
throws SVNClientException {
return getLogMessages(arg0, arg1, arg2, true);
}
/* (non-Javadoc)
* @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#getLogMessages(java.net.URL, org.tigris.subversion.subclipse.client.ISVNRevision, org.tigris.subversion.subclipse.client.ISVNRevision)
*/
public ISVNLogMessage[] getLogMessages(SVNUrl arg0, SVNRevision arg1, SVNRevision arg2)
throws SVNClientException {
return getLogMessages(arg0, arg1, arg2, true);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getLogMessages(org.tigris.subversion.svnclientadapter.SVNUrl, java.lang.String[], org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, boolean, boolean)
*/
public ISVNLogMessage[] getLogMessages(final SVNUrl url,
final String[] paths, SVNRevision revStart, SVNRevision revEnd,
boolean stopOnCopy, boolean fetchChangePath)
throws SVNClientException {
return this.getLogMessages(url, SVNRevision.HEAD, revStart, revEnd, stopOnCopy, fetchChangePath, 0, false);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getLogMessages(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, boolean)
*/
public ISVNLogMessage[] getLogMessages(File path,
SVNRevision revisionStart, SVNRevision revisionEnd,
boolean fetchChangePath) throws SVNClientException {
return this.getLogMessages(path, SVNRevision.HEAD, revisionStart, revisionEnd, false,
fetchChangePath, 0, false);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getLogMessages(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, boolean, boolean)
*/
public ISVNLogMessage[] getLogMessages(File path,
SVNRevision revisionStart, SVNRevision revisionEnd,
boolean stopOnCopy, boolean fetchChangePath)
throws SVNClientException {
return this.getLogMessages(path, SVNRevision.HEAD, revisionStart, revisionEnd,
stopOnCopy, fetchChangePath, 0, false);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getLogMessages(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, boolean, boolean, long)
*/
public ISVNLogMessage[] getLogMessages(File path,
SVNRevision revisionStart, SVNRevision revisionEnd,
boolean stopOnCopy, boolean fetchChangePath, long limit)
throws SVNClientException {
//If the file is an uncommitted rename/move, we have to refer to original/source, not the new copy.
ISVNInfo info = getInfoFromWorkingCopy(path);
if ((SVNScheduleKind.ADD == info.getSchedule()) && (info.getCopyUrl() != null)) {
return this.getLogMessages(info.getCopyUrl(), SVNRevision.HEAD, revisionStart, revisionEnd,
stopOnCopy, fetchChangePath, limit, false);
} else {
return this.getLogMessages(path, SVNRevision.HEAD, revisionStart, revisionEnd,
stopOnCopy, fetchChangePath, limit, false);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getLogMessages(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, boolean)
*/
public ISVNLogMessage[] getLogMessages(SVNUrl url,
SVNRevision revisionStart, SVNRevision revisionEnd,
boolean fetchChangePath) throws SVNClientException {
return this.getLogMessages(url, SVNRevision.HEAD, revisionStart, revisionEnd, false,
fetchChangePath, 0, false);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getLogMessages(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, boolean, boolean, long)
*/
public ISVNLogMessage[] getLogMessages(SVNUrl url, SVNRevision pegRevision,
SVNRevision revisionStart, SVNRevision revisionEnd,
boolean stopOnCopy, boolean fetchChangePath, long limit)
throws SVNClientException {
return this.getLogMessages(url, pegRevision, revisionStart, revisionEnd, stopOnCopy, fetchChangePath, limit, false);
}
public ISVNLogMessage[] getLogMessages(File path, SVNRevision pegRevision, SVNRevision revisionStart, SVNRevision revisionEnd, boolean stopOnCopy, boolean fetchChangePath, long limit, boolean includeMergedRevisions) throws SVNClientException {
SVNLogMessageCallback worker = new SVNLogMessageCallback();
this.getLogMessages(path, pegRevision, revisionStart, revisionEnd, stopOnCopy, fetchChangePath, limit, includeMergedRevisions, ISVNClientAdapter.DEFAULT_LOG_PROPERTIES, worker);
return worker.getLogMessages();
}
public ISVNLogMessage[] getLogMessages(SVNUrl url, SVNRevision pegRevision, SVNRevision revisionStart, SVNRevision revisionEnd, boolean stopOnCopy, boolean fetchChangePath, long limit, boolean includeMergedRevisions) throws SVNClientException {
SVNLogMessageCallback worker = new SVNLogMessageCallback();
this.getLogMessages(url, pegRevision, revisionStart, revisionEnd, stopOnCopy, fetchChangePath, limit, includeMergedRevisions, ISVNClientAdapter.DEFAULT_LOG_PROPERTIES, worker);
return worker.getLogMessages();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#setIgnoredPatterns(java.io.File, java.util.List)
*/
public void setIgnoredPatterns(File path, List patterns) throws SVNClientException {
if (!path.isDirectory())
return;
String separator = System.getProperty("line.separator");
StringBuffer value = new StringBuffer();
for (Iterator it = patterns.iterator(); it.hasNext();) {
String pattern = (String)it.next();
value.append(pattern + separator);
}
propertySet(path, ISVNProperty.IGNORE, value.toString(), false);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#addToIgnoredPatterns(java.io.File, java.lang.String)
*/
public void addToIgnoredPatterns(File path, String pattern) throws SVNClientException {
List patterns = getIgnoredPatterns(path);
if (patterns == null) // not a directory
return;
// verify that the pattern has not already been added
for (Iterator it = patterns.iterator(); it.hasNext();) {
if (((String)it.next()).equals(pattern))
return; // already added
}
patterns.add(pattern);
setIgnoredPatterns(path,patterns);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getKeywords(java.io.File)
*/
public SVNKeywords getKeywords(File path) throws SVNClientException {
ISVNProperty prop = propertyGet(path, ISVNProperty.KEYWORDS);
if (prop == null)
return new SVNKeywords();
// value is a space-delimited list of the keywords names
String value = prop.getValue();
return new SVNKeywords(value);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#addPasswordCallback(org.tigris.subversion.svnclientadapter.ISVNPromptUserPassword)
*/
public void addPasswordCallback(ISVNPromptUserPassword callback) {
// Default implementation does nothing
}
public boolean statusReturnsRemoteInfo() {
return false;
}
public long[] commitAcrossWC(File[] paths, String message, boolean recurse,
boolean keepLocks, boolean Atomic) throws SVNClientException {
notImplementedYet();
return null;
}
protected void notImplementedYet() throws SVNClientException {
throw new SVNClientException("Not implemented yet");
}
public boolean canCommitAcrossWC() {
return false;
}
public void mkdir(SVNUrl url, boolean makeParents, String message)
throws SVNClientException {
if (makeParents) {
SVNUrl parent = url.getParent();
if (parent != null) {
ISVNInfo info = null;
try {
info = this.getInfo(parent);
} catch (SVNClientException e) {
}
if (info == null)
this.mkdir(parent, makeParents, message);
}
}
this.mkdir(url, message);
}
/**
* Answer whether running on Windows OS.
* (Actual code extracted from org.apache.commons.lang.SystemUtils.IS_OS_WINDOWS)
* (For such one simple method it does make sense to introduce dependency on whole commons-lang.jar)
* @return true when the underlying
*/
public static boolean isOsWindows()
{
try {
return System.getProperty("os.name").startsWith("Windows");
} catch (SecurityException ex) {
// we are not allowed to look at this property
return false;
}
}
public ISVNInfo getInfo(SVNUrl url) throws SVNClientException {
return getInfo(url, SVNRevision.HEAD, SVNRevision.HEAD);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#merge(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, boolean, boolean, boolean)
*/
public void merge(SVNUrl path1, SVNRevision revision1, SVNUrl path2, SVNRevision revision2, File localPath, boolean force, boolean recurse, boolean dryRun) throws SVNClientException {
merge(path1, revision1, path2, revision2, localPath, force, recurse, dryRun, false);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#merge(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, boolean, boolean)
*/
public void merge(SVNUrl path1, SVNRevision revision1, SVNUrl path2, SVNRevision revision2, File localPath, boolean force, boolean recurse) throws SVNClientException {
merge(path1, revision1, path2, revision2, localPath, force, recurse, false, false);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#propertyGet(org.tigris.subversion.svnclientadapter.SVNUrl, java.lang.String)
*/
public ISVNProperty propertyGet(SVNUrl url, String propertyName)
throws SVNClientException {
return propertyGet(url, SVNRevision.HEAD, SVNRevision.HEAD, propertyName);
}
public void diff(File[] paths, File outFile, boolean recurse) throws SVNClientException {
FileOutputStream os = null;
try {
ArrayList tempFiles = new ArrayList();
for (int i = 0; i < paths.length; i++) {
File tempFile = File.createTempFile("tempDiff", ".txt");
tempFile.deleteOnExit();
diff(paths[i], tempFile, recurse);
tempFiles.add(tempFile);
}
os = new FileOutputStream(outFile);
Iterator iter = tempFiles.iterator();
while (iter.hasNext()) {
File tempFile = (File)iter.next();
FileInputStream is = new FileInputStream(tempFile);
byte[] buffer = new byte[4096];
int bytes_read;
while ((bytes_read = is.read(buffer)) != -1)
os.write(buffer, 0, bytes_read);
is.close();
}
} catch (Exception e) {
throw new SVNClientException(e);
} finally {
if (os != null) try {os.close();} catch (IOException e) {}
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#createPatch(java.io.File[], java.io.File, java.io.File, boolean)
*/
public void createPatch(File[] paths, File relativeToPath, File outFile,
boolean recurse) throws SVNClientException {
File tmpFile;
try {
tmpFile = File.createTempFile("svn","patch");
tmpFile.deleteOnExit();
} catch (IOException e) {
throw new SVNClientException(e);
}
this.diff(paths, tmpFile, recurse);
stripPathsFromPatch(tmpFile, outFile, relativeToPath);
}
/**
* Takes svn diff output and processes it to remove absolute paths and
* convert them to relative paths which makes it easier to apply patch
*
* @param tmpFile - disk file containing diff output
* @param outFile - file to store the updated diff output
* @param relativeToPath - path to make file references relative to or null
* for absolute paths
* @throws SVNClientException
*/
private void stripPathsFromPatch(File tmpFile, File outFile, File relativeToPath) throws SVNClientException {
String relativeStr = null;
if (relativeToPath != null) {
try {
if (relativeToPath.isDirectory())
relativeStr = relativeToPath.getCanonicalPath();
else
relativeStr = relativeToPath.getParentFile().getCanonicalPath();
} catch (IOException e1) {
if (relativeToPath.isDirectory())
relativeStr = relativeToPath.getAbsolutePath();
else
relativeStr = relativeToPath.getParentFile().getAbsolutePath();
}
relativeStr += "/";
relativeStr = relativeStr.replace('\\', '/');
}
FileInputStream fis = null;
FileOutputStream fos = null;
try {
fis = new FileInputStream(tmpFile);
fos = new FileOutputStream(outFile);
byte b[] = new byte[fis.available()];
fis.read(b);
if (relativeToPath != null) {
byte o[] = new String(b).replaceAll(relativeStr, "").getBytes();
fos.write(o);
} else {
fos.write(b);
}
} catch (FileNotFoundException e) {
throw new SVNClientException(e);
} catch (IOException e) {
throw new SVNClientException(e);
} finally {
try {
if (fis != null)
fis.close();
} catch (IOException e) {
}
try {
if (fos != null)
fos.close();
} catch (IOException e) {
}
}
}
}
././@LongLink 0000000 0000000 0000000 00000000145 00000000000 011565 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNStatus.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNStatus.java0000644 0000000 0000000 00000011074 11147073645 032605 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.io.File;
import java.util.Date;
/**
* An interface defining the status of one subversion item (file or directory) in
* the working copy or repository.
*
* @author philip schatz
*/
public interface ISVNStatus {
/**
* @return the SVNUrl instance of url of the resource on repository
*/
SVNUrl getUrl();
/**
* @return the url (String) of the resource in repository
*/
String getUrlString();
/**
* @return the last changed revision or null if resource is not managed
*/
SVNRevision.Number getLastChangedRevision();
/**
* @return date this resource last changed
*/
Date getLastChangedDate();
/**
* get the last commit author or null if resource is not versionned
* or if last commit author is unknown
* @return the last commit author or null
*/
String getLastCommitAuthor();
/**
* @return the file or directory status
*/
SVNStatusKind getTextStatus();
/**
* @return the file or directory status of base
*/
SVNStatusKind getRepositoryTextStatus();
/**
* @return status of properties (either Kind.NORMAL, Kind.CONFLICTED or Kind.MODIFIED)
*/
SVNStatusKind getPropStatus();
/**
* @return the status of the properties base (either Kind.NORMAL, Kind.CONFLICTED or Kind.MODIFIED)
*/
SVNStatusKind getRepositoryPropStatus();
/**
* @return the revision of the resource or null if not managed
*/
SVNRevision.Number getRevision();
/**
* @return The path to this item relative to the directory from
* which status
was run.
*/
String getPath();
/**
* @return The absolute path to this item.
*/
File getFile();
/**
* @return The node kind of the managed resource, or {@link
* SVNNodeKind#UNKNOWN} not managed.
*/
SVNNodeKind getNodeKind();
/**
* @return true when the resource was copied
*/
boolean isCopied();
/**
* @return true when the working copy directory is locked.
*/
boolean isWcLocked();
/**
* @return true when the resource was switched relative to its parent.
*/
boolean isSwitched();
/**
* @return the url of the copy source if copied, null otherwise
*/
SVNUrl getUrlCopiedFrom();
/**
* Returns in case of conflict, the file of the most recent repository
* version
* @return the filename of the most recent repository version
*/
public File getConflictNew();
/**
* Returns in case of conflict, the file of the common base version
* @return the filename of the common base version
*/
public File getConflictOld();
/**
* Returns in case of conflict, the file of the former working copy
* version
* @return the filename of the former working copy version
*/
public File getConflictWorking();
/**
* Returns the lock owner
* @return the lock owner
*/
public String getLockOwner();
/**
* Returns the lock creation date
* @return the lock creation date
*/
public Date getLockCreationDate();
/**
* Returns the lock comment
* @return the lock comment
*/
public String getLockComment();
/**
* Returns the tree conflicted state
* @return the tree conflicted state
*/
public boolean hasTreeConflict();
/**
* Returns the conflict descriptor for the tree conflict
* @return the conflict descriptor for the tree conflict
*/
public SVNConflictDescriptor getConflictDescriptor();
/**
* Returns if the item is a file external
* @return is the item is a file external
*/
public boolean isFileExternal();
}
././@LongLink 0000000 0000000 0000000 00000000157 00000000000 011570 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNConflictResolver.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNConflictRes0000644 0000000 0000000 00000003102 10755343733 032610 0 ustar root root package org.tigris.subversion.svnclientadapter;
public interface ISVNConflictResolver {
/**
* The callback method invoked for each conflict during a
* merge/update/switch operation.
*
* @param descrip A description of the conflict.
* @return The result of any conflict resolution.
* @throws SubversionException If an error occurs.
*/
public SVNConflictResult resolve(SVNConflictDescriptor descrip) throws SVNClientException;
/**
* From JavaHL
*/
public final class Choice
{
/**
* User did nothing; conflict remains.
*/
public static final int postpone = 0;
/**
* User chooses the base file.
*/
public static final int chooseBase = 1;
/**
* User chooses the repository file.
*/
public static final int chooseTheirsFull = 2;
/**
* User chooses own version of file.
*/
public static final int chooseMineFull = 3;
/**
* Resolve the conflict by choosing the incoming (repository)
* version of the object (for conflicted hunks only).
*/
public static final int chooseTheirs = 4;
/**
* Resolve the conflict by choosing own (local) version of the
* object (for conflicted hunks only).
*/
public static final int chooseMine = 5;
/**
* Resolve the conflict by choosing the merged object
* (potentially manually edited).
*/
public static final int chooseMerged = 6;
}
}
././@LongLink 0000000 0000000 0000000 00000000155 00000000000 011566 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNClientException.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNClientExcept0000644 0000000 0000000 00000006466 10725052116 032660 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.lang.reflect.InvocationTargetException;
/**
* A generic exception thrown from any {@link ISVNClientAdapter} methods
*
* @author philip schatz
*/
public class SVNClientException extends Exception {
private int aprError = NONE;
private static final long serialVersionUID = 1L;
public static final int NONE = -1;
public static final int MERGE_CONFLICT = 155015;
public static final int UNSUPPORTED_FEATURE = 200007;
/**
* Constructs a new exception with null
as its detail message.
*/
public SVNClientException() {
super();
}
/**
* Constructs a new exception with the specified detail message.
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
*/
public SVNClientException(String message) {
super(message);
}
/**
* Constructs a new exception with the specified detail message and
* cause.
* @param message the detail message (which is saved for later retrieval
* by the {@link #getMessage()} method).
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A null value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
*/
public SVNClientException(String message, Throwable cause) {
super(message, cause);
}
/**
* Constructs a new exception with the specified cause.
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A null value is
* permitted, and indicates that the cause is nonexistent or
* unknown.)
*/
public SVNClientException(Throwable cause) {
super(cause);
}
/**
* Facorty method for creating a delegating/wrapping exception.
* @param e exception to wrap SVNClientException around
* @return an SVNClientException instance
*/
public static SVNClientException wrapException(Exception e) {
Throwable t = e;
if (e instanceof InvocationTargetException) {
Throwable target = ((InvocationTargetException) e).getTargetException();
if (target instanceof SVNClientException) {
return (SVNClientException) target;
}
t = target;
}
return new SVNClientException(t);
}
public int getAprError() {
return aprError;
}
public void setAprError(int aprError) {
this.aprError = aprError;
}
}
././@LongLink 0000000 0000000 0000000 00000000162 00000000000 011564 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNClientAdapterFactory.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNClientAdapte0000644 0000000 0000000 00000007661 10613664631 032633 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.util.HashMap;
import java.util.Map;
/**
* Abstract Factory for SVNClientAdapter. Real factories should extend this class and
* register themselves with the method #registerAdapterFactory
*
* @author Cédric Chabanois
* cchabanois@ifrance.com
*
* @author Panagiotis Korros
* pkorros@bigfoot.com
*
*/
public abstract class SVNClientAdapterFactory {
private static Map ourFactoriesMap;
// the first factory added is the preferred one
private static SVNClientAdapterFactory preferredFactory;
/**
* Real Factories should implement these methods.
*/
protected abstract ISVNClientAdapter createSVNClientImpl();
protected abstract String getClientType();
/**
* creates a new ISVNClientAdapter. You can create a javahl client or a command line
* client.
*
* @param clientType
* @return the client adapter that was requested or null if that client adapter is not
* available or doesn't exist.
*/
public static ISVNClientAdapter createSVNClient(String clientType) {
if (ourFactoriesMap == null || !ourFactoriesMap.containsKey(clientType)) {
return null;
}
SVNClientAdapterFactory factory = (SVNClientAdapterFactory) ourFactoriesMap.get(clientType);
if (factory != null) {
return factory.createSVNClientImpl();
}
return null;
}
/**
* tells if the given clientType is available or not
*
* @param clientType
* @return true if the given clientType is available
*/
public static boolean isSVNClientAvailable(String clientType) {
return ourFactoriesMap != null && ourFactoriesMap.containsKey(clientType);
}
/**
* @return the best svn client interface
* @throws SVNClientException
*/
public static String getPreferredSVNClientType() throws SVNClientException {
if (preferredFactory != null) {
return preferredFactory.getClientType();
}
throw new SVNClientException("No subversion client interface found.");
}
/**
* Extenders should register themselves with this method. First registered factory
* will be considered as the preferred one
*
* @throws SVNClientException when factory with specified type is already registered.
*/
protected static void registerAdapterFactory(SVNClientAdapterFactory factory) throws SVNClientException {
if (factory == null) {
return;
}
if (ourFactoriesMap == null) {
ourFactoriesMap = new HashMap();
}
String type = factory.getClientType();
if (!ourFactoriesMap.containsKey(type)) {
ourFactoriesMap.put(type, factory);
if (preferredFactory == null) {
preferredFactory = factory;
}
} else {
throw new SVNClientException("factory for type " + type + " already registered");
}
}
}
././@LongLink 0000000 0000000 0000000 00000000151 00000000000 011562 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNLogMessage.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNLogMessage.0000644 0000000 0000000 00000006261 11035734453 032505 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.util.Date;
/**
* An interface defining a single subversion commit with log message,
* author, date and paths changed within the commit.
*
* @author Philip Schatz schatzp@purdue.edu
*/
public interface ISVNLogMessage {
public final String AUTHOR = "svn:author";
public final String MESSAGE = "svn:log";
public final String DATE = "svn:date";
public final String TIME_MICROS = "svnclientadapter:timemicros";
/**
* Returns the revision number
* @return the revision number
*/
public abstract SVNRevision.Number getRevision();
/**
* Returns the author of the commit
* @return the author of the commit
*/
public abstract String getAuthor();
/**
* Returns the time of the commit
* @return the time of the commit measured in the number of
* microseconds since 00:00:00 January 1, 1970 UTC
*/
public abstract long getTimeMicros();
/**
* Returns the time of the commit
* @return the time of the commit measured in the number of
* milliseconds since 00:00:00 January 1, 1970 UTC
*/
public abstract long getTimeMillis();
/**
* Returns the date of the commit
* @return the date of the commit
*/
public abstract Date getDate();
/**
* Return the log message text
* @return the log message text
*/
public abstract String getMessage();
/**
* Returns the changes items by this commit
* @return the changes items by this commit
*/
public abstract ISVNLogMessageChangePath[] getChangedPaths();
/**
* Returns the number of child log messages. When merge-sensitive
* log option was specified.
* @return the number of revisions merged by this commit
*/
public abstract long getNumberOfChildren();
/**
* Returns the child log messages. When merge-sensitive
* log option was specified.
* @return the revisions merged by this commit
*/
public abstract ISVNLogMessage[] getChildMessages();
/**
* Add a child logMessage to an existing message
*/
public abstract void addChild(ISVNLogMessage msg);
/**
* Does this logMessage have any children
*/
public abstract boolean hasChildren();
} ././@LongLink 0000000 0000000 0000000 00000000161 00000000000 011563 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNNotificationHandler.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNNotification0000644 0000000 0000000 00000014713 10634267523 032722 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.io.File;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
/**
* Notification handler :
* It sends notifications to all listeners
*/
public abstract class SVNNotificationHandler {
protected Set notifylisteners = new HashSet();
protected int command;
protected boolean logEnabled = true;
protected File baseDir = new File(".");
/**
* Add a notification listener
* @param listener
*/
public void add(ISVNNotifyListener listener) {
notifylisteners.add(listener);
}
/**
* Remove a notification listener
* @param listener
*/
public void remove(ISVNNotifyListener listener) {
notifylisteners.remove(listener);
}
/**
* restore logging
*/
public void enableLog() {
logEnabled = true;
}
/**
* disable all logging
*/
public void disableLog() {
logEnabled = false;
}
public void logMessage(String message) {
if (logEnabled) {
for(Iterator it=notifylisteners.iterator(); it.hasNext();) {
ISVNNotifyListener listener = (ISVNNotifyListener)it.next();
listener.logMessage(message);
}
}
}
public void logError(String message) {
if (logEnabled) {
for(Iterator it=notifylisteners.iterator(); it.hasNext();) {
ISVNNotifyListener listener = (ISVNNotifyListener)it.next();
listener.logError(message);
}
}
}
public void logRevision(long revision, String path) {
if (logEnabled) {
for(Iterator it=notifylisteners.iterator(); it.hasNext();) {
ISVNNotifyListener listener = (ISVNNotifyListener)it.next();
listener.logRevision(revision, path);
}
}
}
public void logCompleted(String message) {
if (logEnabled) {
for(Iterator it=notifylisteners.iterator(); it.hasNext();) {
ISVNNotifyListener listener = (ISVNNotifyListener)it.next();
listener.logCompleted(message);
}
}
}
/**
* set the command
* @param command
*/
public void setCommand(int command) {
this.command = command;
for(Iterator it=notifylisteners.iterator(); it.hasNext();) {
ISVNNotifyListener listener = (ISVNNotifyListener)it.next();
listener.setCommand(command);
}
}
/**
* log the command line
* @param commandLine
*/
public void logCommandLine(String commandLine) {
if (logEnabled && !skipCommand()) {
for(Iterator it=notifylisteners.iterator(); it.hasNext();) {
ISVNNotifyListener listener = (ISVNNotifyListener)it.next();
listener.logCommandLine(commandLine);
}
}
}
/**
* To call when a method of ClientAdapter throw an exception
* @param clientException
*/
public void logException(Exception clientException) {
if (logEnabled) {
Throwable e = clientException;
while (e != null) {
logError(e.getMessage());
e = e.getCause();
}
}
}
/**
* set the baseDir : directory to use as base directory when path is relative
* @param baseDir
*/
public void setBaseDir(File baseDir) {
if (baseDir != null) {
this.baseDir = baseDir;
} else {
setBaseDir();
}
}
public void setBaseDir() {
this.baseDir = new File(".");
}
private File getAbsoluteFile(String path) {
if (path == null)
return null;
File f = new File(path);
if (!f.isAbsolute()) {
f = new File(baseDir,path);
}
return f;
}
public void notifyListenersOfChange(String path) {
if (path == null)
return;
File f = getAbsoluteFile(path);
if (f == null) {
// this should not happen
logMessage("Warning : invalid path :"+path);
return;
}
SVNNodeKind kind;
if (f.isFile()) {
kind = SVNNodeKind.FILE;
} else
if (f.isDirectory()) {
kind = SVNNodeKind.DIR;
} else {
kind = SVNNodeKind.UNKNOWN;
}
for(Iterator it=notifylisteners.iterator(); it.hasNext();) {
ISVNNotifyListener listener = (ISVNNotifyListener)it.next();
listener.onNotify(f, kind);
}
}
public void notifyListenersOfChange(String path, SVNNodeKind kind) {
if (path == null)
return;
File f = getAbsoluteFile(path);
if (f == null) {
// this should not happen
logMessage("Warning : invalid path :"+path);
return;
}
for(Iterator it=notifylisteners.iterator(); it.hasNext();) {
ISVNNotifyListener listener = (ISVNNotifyListener)it.next();
listener.onNotify(f, kind);
}
}
/**
* For certain commands we just want to skip the logging of the
* command line
*/
protected boolean skipCommand() {
if (command == ISVNNotifyListener.Command.CAT ||
command == ISVNNotifyListener.Command.INFO ||
command == ISVNNotifyListener.Command.LOG ||
command == ISVNNotifyListener.Command.LS ||
command == ISVNNotifyListener.Command.PROPGET ||
command == ISVNNotifyListener.Command.PROPLIST ||
command == ISVNNotifyListener.Command.STATUS )
return true;
else
return false;
}
}
././@LongLink 0000000 0000000 0000000 00000000152 00000000000 011563 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNAnnotations.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNAnnotations0000644 0000000 0000000 00000004375 10613664631 032703 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.io.InputStream;
import java.util.Date;
/**
* An interface defining the result of a call to svn blame/annotate. For each
* line in the file, last modification data are returned.
*
*/
public interface ISVNAnnotations {
/**
* Get the date of the last change for the given lineNumber
*
* @param lineNumber
* @return date of last change
*/
public abstract Date getChanged(int lineNumber);
/**
* Get the revision of the last change for the given lineNumber
*
* @param lineNumber
* @return the revision of last change
*/
public abstract long getRevision(int lineNumber);
/**
* Get the author of the last change for the given lineNumber
*
* @param lineNumber
* @return the author of last change or null
*/
public abstract String getAuthor(int lineNumber);
/**
* Get the content (line itself) of the given lineNumber
*
* @param lineNumber
* @return the line content
*/
public abstract String getLine(int lineNumber);
/**
* Get an input stream providing the content of the file being annotated.
*
* @return an inputstream of the content of the file
*/
public abstract InputStream getInputStream();
/**
* Get the number of annotated lines
*
* @return number of lines of file being annotated
*/
public abstract int numberOfLines();
} ././@LongLink 0000000 0000000 0000000 00000000163 00000000000 011565 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNLogMessageChangePath.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNLogMessageC0000644 0000000 0000000 00000003210 10613664631 032522 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
/**
* An interface defining a change path for a log message
*
*/
public interface ISVNLogMessageChangePath {
/**
* Retrieve the path to the commited item
* @return the path to the commited item
*/
public abstract String getPath();
/**
* Retrieve the copy source revision if any or null otherwise
* @return the copy source revision (if any)
*/
public abstract SVNRevision.Number getCopySrcRevision();
/**
* Retrieve the copy source path (if any) or null otherwise
* @return the copy source path (if any)
*/
public abstract String getCopySrcPath();
/**
* Retrieve action performed.
* I.e. 'A'dd, 'D'elete, 'R'eplace, 'M'odify
*
* @return action performed
*/
public abstract char getAction();
} ././@LongLink 0000000 0000000 0000000 00000000150 00000000000 011561 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNStatusKind.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNStatusKind.j0000644 0000000 0000000 00000017457 11147073645 032625 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
/**
* Base class for enumerating the possible types for a Status
.
*
*/
public class SVNStatusKind {
private final int kind;
private boolean treeConflicted;
private static final int none = 0;
private static final int normal = 1;
private static final int modified = 2;
private static final int added = 3;
private static final int deleted = 4;
private static final int unversioned = 5;
private static final int missing = 6;
private static final int replaced = 7;
private static final int merged = 8;
private static final int conflicted = 9;
private static final int obstructed = 10;
private static final int ignored = 11;
private static final int incomplete = 12;
private static final int external = 13;
/** does not exist */
public static final SVNStatusKind NONE = new SVNStatusKind(none);
/** exists, but uninteresting. */
public static final SVNStatusKind NORMAL = new SVNStatusKind(normal);
/** is scheduled for addition */
public static final SVNStatusKind ADDED = new SVNStatusKind(added);
/** under v.c., but is missing */
public static final SVNStatusKind MISSING = new SVNStatusKind(missing);
/** a directory doesn't contain a complete entries list */
public static final SVNStatusKind INCOMPLETE = new SVNStatusKind(incomplete);
/** scheduled for deletion */
public static final SVNStatusKind DELETED = new SVNStatusKind(deleted);
/** was deleted and then re-added */
public static final SVNStatusKind REPLACED = new SVNStatusKind(replaced);
/** text or props have been modified */
public static final SVNStatusKind MODIFIED = new SVNStatusKind(modified);
/** local mods received repos mods */
public static final SVNStatusKind MERGED = new SVNStatusKind(merged);
/** local mods received conflicting repos mods */
public static final SVNStatusKind CONFLICTED = new SVNStatusKind(conflicted);
/** an unversioned resource is in the way of the versioned resource */
public static final SVNStatusKind OBSTRUCTED = new SVNStatusKind(obstructed);
/** a resource marked as ignored */
public static final SVNStatusKind IGNORED = new SVNStatusKind(ignored);
/** an unversioned path populated by an svn:external property */
public static final SVNStatusKind EXTERNAL = new SVNStatusKind(external);
/** is not a versioned thing in this wc */
public static final SVNStatusKind UNVERSIONED = new SVNStatusKind(unversioned);
//Constructors
/**
*
* Constructs a Type
for the given a type name.
null
.
*/
public SVNRevisionRange[] getRevisions(String path);
/**
* Get the RevisionRange objects for the specified path
* @param path The merge source path.
* @return Array of RevisionRange objects, or null
.
*/
public SVNRevisionRange[] getRevisionRange(String path);
/**
* Parse the svn:mergeinfo
property to populate the
* merge source paths and revision ranges of this instance.
* @param mergeInfo svn:mergeinfo
property value.
*/
public void loadFromMergeInfoProperty(String mergeInfo);
}
././@LongLink 0000000 0000000 0000000 00000000146 00000000000 011566 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNNodeKind.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNNodeKind.jav0000644 0000000 0000000 00000007701 10613664631 032543 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
/**
* Kind of a node (dir, file)
*/
public class SVNNodeKind
{
private int kind;
private static final int none = 0;
private static final int file = 1;
private static final int dir = 2;
private static final int unknown = 3;
/** Node kind absent */
public static final SVNNodeKind NONE = new SVNNodeKind(none);
/** Node kind regular file */
public static final SVNNodeKind FILE = new SVNNodeKind(file);
/** Node kind Directory */
public static final SVNNodeKind DIR = new SVNNodeKind(dir);
/** Node kind unknwon - something's here, but we don't know what */
public static final SVNNodeKind UNKNOWN = new SVNNodeKind(unknown);
/**
* Private costructor.
* @param kind
*/
private SVNNodeKind(int kind) {
this.kind = kind;
}
/**
* @return an integer value representation of the nodeKind
*/
public int toInt() {
return kind;
}
/**
* Returns the SVNNodeKind corresponding to the given int representation.
* (As returned by {@link SVNNodeKind#toInt()} method)
* @param nodeKind
* @return SVNNodeKind representing the int value
*/
public static SVNNodeKind fromInt(int nodeKind) {
switch(nodeKind)
{
case none:
return NONE;
case file:
return FILE;
case dir:
return DIR;
case unknown:
return UNKNOWN;
default:
return null;
}
}
/**
* Returns the SVNNodeKind corresponding to the given string or null
* @param nodeKind
* @return SVNNodeKind representing the string value
*/
public static SVNNodeKind fromString(String nodeKind) {
if (NONE.toString().equals(nodeKind)) {
return NONE;
} else
if (FILE.toString().equals(nodeKind)) {
return FILE;
} else
if (DIR.toString().equals(nodeKind)) {
return DIR;
} else
if ("dir".equals(nodeKind)) {
return DIR;
} else
if (UNKNOWN.toString().equals(nodeKind)) {
return UNKNOWN;
} else
return null;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
switch(kind)
{
case none:
return "none";
case file:
return "file";
case dir:
return "directory";
case unknown:
return "unknown";
default:
return "";
}
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object obj) {
if (!(obj instanceof SVNNodeKind)) {
return false;
}
return ((SVNNodeKind)obj).kind == kind;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
public int hashCode() {
return new Integer(kind).hashCode();
}
}
././@LongLink 0000000 0000000 0000000 00000000155 00000000000 011566 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNInfoUnversioned.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNInfoUnversio0000644 0000000 0000000 00000010561 11160556772 032721 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.io.File;
import java.util.Date;
import org.tigris.subversion.svnclientadapter.SVNRevision.Number;
/**
* A special {@link ISVNInfo} implementation that is used if a File/Folder is not versioned.
*
* @author Cédric Chabanois (cchabanois at no-log.org)
*/
public class SVNInfoUnversioned implements ISVNInfo {
private File file;
/**
* Constructor
* @param file
*/
public SVNInfoUnversioned(File file) {
this.file = file;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getFile()
*/
public File getFile() {
return file;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getUrl()
*/
public SVNUrl getUrl() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getUrlString()
*/
public String getUrlString() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getUuid()
*/
public String getUuid() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getRepository()
*/
public SVNUrl getRepository() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getSchedule()
*/
public SVNScheduleKind getSchedule() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getNodeKind()
*/
public SVNNodeKind getNodeKind() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLastCommitAuthor()
*/
public String getLastCommitAuthor() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getRevision()
*/
public Number getRevision() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLastChangedRevision()
*/
public Number getLastChangedRevision() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLastChangedDate()
*/
public Date getLastChangedDate() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLastDateTextUpdate()
*/
public Date getLastDateTextUpdate() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLastDatePropsUpdate()
*/
public Date getLastDatePropsUpdate() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#isCopied()
*/
public boolean isCopied() {
return false;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getCopyRev()
*/
public Number getCopyRev() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getCopyUrl()
*/
public SVNUrl getCopyUrl() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLockCreationDate()
*/
public Date getLockCreationDate() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLockOwner()
*/
public String getLockOwner() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLockComment()
*/
public String getLockComment() {
return null;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNInfo#getDepth()
*/
public int getDepth() {
return -2;
}
}
././@LongLink 0000000 0000000 0000000 00000000161 00000000000 011563 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNPromptUserPassword.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNPromptUserP0000644 0000000 0000000 00000012444 10613664631 032642 0 ustar root root /*******************************************************************************
* Copyright (c) 2005, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
/**
* An interface describing a callback used during authentification.
*
*/
public interface ISVNPromptUserPassword {
/** reject the connection to the server */
public static final int Reject = 0;
/** accept the connection to the server one time. */
public static final int AcceptTemporary = 1;
/** accept the connection to the server forever */
public static final int AcceptPermanently = 2;
/**
* ask the user a yes/no question
* @param realm for which server realm this information is requested.
* @param question question to be asked
* @param yesIsDefault if yes should be the default
* @return the answer
*/
public boolean askYesNo(String realm, String question, boolean yesIsDefault);
/**
* retrieve the username entered during the prompt call
* @return the username
*/
public String getUsername();
/**
* retrieve the password entered during the prompt call
* @return the password
*/
public String getPassword();
/**
* If there are problems with the certifcate of the SSL-server, this
* callback will be used to deside if the connection will be used.
* @param info the probblems with the certificate.
* @param allowPermanently if AcceptPermantly is a legal answer
* @return one of Reject/AcceptTemporary/AcceptPermanently
*/
public int askTrustSSLServer(String info, boolean allowPermanently);
/**
* Request the password to be used from the user.
* the save data check box status will be queried by userAllowedSave
* @param realm realm for the username
* @param username username in the realm
* @param maySave should a save data check box be enabled.
* @return password as entered or null if canceled.
*/
public boolean prompt(String realm, String username, boolean maySave);
/**
* Request the username to be used for SVN operation
* the save data check box status will be queried by userAllowedSave
* @param realm realm for the username
* @param username username in the realm
* @param maySave should a save data check box be enabled.
* @return password as entered or null if canceled.
*/
public boolean promptUser(String realm, String username, boolean maySave);
/**
* Ask the user a question about authentification
* the save data check box status will be queried by userAllowedSave
* @param realm real of the question
* @param question text of the question
* @param showAnswer flag if the answer should be displayed
* @param maySave should a save data check box be enabled.
* @return answer as entered or null if canceled
*/
public String askQuestion(String realm, String question, boolean showAnswer, boolean maySave);
/**
* query if the user allowed the saving of the data of the last call
* @return was the save data check box checked
*/
public boolean userAllowedSave();
/**
* Request the SSH info to be used from the user.
* the save data check box status will be queried by userAllowedSave
* @param realm realm for the username
* @param username username in the realm
* @param sshPort the port number to use
* @param maySave should a save data check box be enabled.
* @return true if OK was pressed
*/
public boolean promptSSH(String realm, String username, int sshPort, boolean maySave);
/**
* retrieve the SSH key file entered during the prompt call
* @return the key file
*/
public String getSSHPrivateKeyPath();
/**
* retrieve the passphrase for the key file entered during
* the prompt call
* @return the passphrase
*/
public String getSSHPrivateKeyPassphrase();
/**
* retrieve the SSH port entered during the prompt call
* @return the port number
*/
public int getSSHPort();
/**
* Request the SSL client certificate info to be used from the user.
* the save data check box status will be queried by userAllowedSave
* @param realm realm for the action
* @param maySave should a save data check box be enabled.
* @return true if OK was pressed
*/
public boolean promptSSL(String realm, boolean maySave);
/**
* retrieve the password for the certifcate
* @return the password
*/
public String getSSLClientCertPassword();
/**
* retrieve the SSL certificate entered during the prompt call
* @return the certificate
*/
public String getSSLClientCertPath();
} ././@LongLink 0000000 0000000 0000000 00000000146 00000000000 011566 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNRevision.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNRevision.jav0000644 0000000 0000000 00000020665 10631110350 032632 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
/**
* Class to specify a revision in a svn command.
* This class has been copied directly from javahl and renamed to SVNRevision
* the static method getRevision has then been added to the class
*
*/
public class SVNRevision
{
// See chapter 3 section 3.3 of the SVN book for valid date strings
protected static final DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd'T'HHmmssZ");
protected int revKind;
public SVNRevision(int kind)
{
revKind = kind;
}
public int getKind()
{
return revKind;
}
public String toString()
{
switch(revKind) {
case Kind.unspecified : return "START";
case Kind.base : return "BASE";
case Kind.committed : return "COMMITTED";
case Kind.head : return "HEAD";
case Kind.previous : return "PREV";
case Kind.working : return "WORKING";
}
return super.toString();
}
public boolean equals(Object target) {
if (this == target)
return true;
if (!(target instanceof SVNRevision))
return false;
return ((SVNRevision)target).revKind == revKind;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
public int hashCode()
{
return revKind;
}
public static final SVNRevision HEAD = new SVNRevision(Kind.head);
public static final SVNRevision START = new SVNRevision(Kind.unspecified);
public static final SVNRevision COMMITTED = new SVNRevision(Kind.committed);
public static final SVNRevision PREVIOUS = new SVNRevision(Kind.previous);
public static final SVNRevision BASE = new SVNRevision(Kind.base);
public static final SVNRevision WORKING = new SVNRevision(Kind.working);
public static final int SVN_INVALID_REVNUM = -1;
public static final SVNRevision.Number INVALID_REVISION = new SVNRevision.Number(SVN_INVALID_REVNUM);
public static class Number extends SVNRevision implements Comparable
{
protected long revNumber;
public Number(long number)
{
super(Kind.number);
revNumber = number;
}
public long getNumber()
{
return revNumber;
}
public String toString() {
return Long.toString(revNumber);
}
public boolean equals(Object target) {
if (!super.equals(target))
return false;
return ((SVNRevision.Number)target).revNumber == revNumber;
}
public int hashCode()
{
return (int) revNumber;
}
public int compareTo(Object target) {
SVNRevision.Number compare = (SVNRevision.Number)target;
if (revNumber > compare.getNumber()) return 1;
if (compare.getNumber() > revNumber) return -1;
return 0;
}
}
public static class DateSpec extends SVNRevision
{
protected Date revDate;
public DateSpec(Date date)
{
super(Kind.date);
revDate = date;
}
public Date getDate()
{
return revDate;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
return '{' + dateFormat.format(revDate)+ '}';
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object target) {
if (!super.equals(target))
return false;
return ((SVNRevision.DateSpec)target).revDate.equals(revDate);
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
public int hashCode()
{
return revDate.hashCode();
}
}
/** Various ways of specifying revisions.
*
* Various ways of specifying revisions.
*
* Note:
* In contexts where local mods are relevant, the `working' kind
* refers to the uncommitted "working" revision, which may be modified
* with respect to its base revision. In other contexts, `working'
* should behave the same as `committed' or `current'.
*/
public static final class Kind
{
/** No revision information given. */
public static final int unspecified = 0;
/** revision given as number */
public static final int number = 1;
/** revision given as date */
public static final int date = 2;
/** rev of most recent change */
public static final int committed = 3;
/** (rev of most recent change) - 1 */
public static final int previous = 4;
/** .svn/entries current revision */
public static final int base = 5;
/** current, plus local mods */
public static final int working = 6;
/** repository youngest */
public static final int head = 7;
}
/**
* get a revision from a string
* revision can be :
* - a date with the format according to dateFormat
* - a revision number
* - HEAD, BASE, COMMITED or PREV
*
* @param revision
* @param aDateFormat
* @return Revision
* @throws ParseException when the revision string cannot be parsed
*/
public static SVNRevision getRevision(String revision, SimpleDateFormat aDateFormat) throws ParseException {
if ((revision == null) || (revision.equals("")))
return null;
// try special KEYWORDS
if (revision.compareToIgnoreCase("HEAD") == 0)
return SVNRevision.HEAD; // latest in repository
else
if (revision.compareToIgnoreCase("BASE") == 0)
return new SVNRevision(SVNRevision.Kind.base); // base revision of item's working copy
else
if (revision.compareToIgnoreCase("COMMITED") == 0)
return new SVNRevision(SVNRevision.Kind.committed); // revision of item's last commit
else
if (revision.compareToIgnoreCase("PREV") == 0) // revision before item's last commit
return new SVNRevision(SVNRevision.Kind.previous);
// try revision number
try
{
int revisionNumber = Integer.parseInt(revision);
if (revisionNumber >= 0)
return new SVNRevision.Number(revisionNumber);
} catch (NumberFormatException e)
{
}
// try date
SimpleDateFormat df = (aDateFormat != null) ? aDateFormat : new SimpleDateFormat("MM/dd/yyyy hh:mm a", Locale.US);
try
{
Date revisionDate = df.parse(revision);
return new SVNRevision.DateSpec(revisionDate);
} catch (ParseException e)
{
}
throw new ParseException("Invalid revision. Revision should be a number, a date in " + df.toPattern() + " format or HEAD, BASE, COMMITED or PREV",0);
}
/**
* get a revision from a string
* revision can be :
* - a date with the following format : MM/DD/YYYY HH:MM AM_PM
* - a revision number
* - HEAD, BASE, COMMITED or PREV
*
* @param revision
* @return Revision
* @throws ParseException when the revision string cannot be parsed
*/
public static SVNRevision getRevision(String revision) throws ParseException {
return getRevision(revision, new SimpleDateFormat("MM/dd/yyyy hh:mm a", Locale.US));
}
}
././@LongLink 0000000 0000000 0000000 00000000146 00000000000 011566 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNKeywords.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNKeywords.jav0000644 0000000 0000000 00000011315 10613664631 032653 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
/**
* tells which keywords are enabled for a given resource
*/
public class SVNKeywords {
public static final String LAST_CHANGED_DATE = "LastChangedDate";
public static final String DATE = "Date";
public static final String LAST_CHANGED_REVISION = "LastChangedRevision";
public static final String REV = "Rev";
public static final String LAST_CHANGED_BY = "LastChangedBy";
public static final String AUTHOR = "Author";
public static final String HEAD_URL = "HeadURL";
public static final String URL = "URL";
public static final String ID = "Id";
private boolean lastChangedDate = false;
private boolean lastChangedRevision = false;
private boolean lastChangedBy = false;
private boolean headUrl = false;
private boolean id = false;
public SVNKeywords() {
}
public SVNKeywords(String keywords) {
if (keywords == null)
return;
StringTokenizer st = new StringTokenizer(keywords," ");
while (st.hasMoreTokens()) {
String keyword = st.nextToken();
// don't know if keywords are case sensitive or no
if ((keyword.equals(SVNKeywords.HEAD_URL)) ||
(keyword.equals(SVNKeywords.URL)))
headUrl = true;
else
if (keyword.equals(SVNKeywords.ID))
id = true;
else
if ((keyword.equals(SVNKeywords.LAST_CHANGED_BY)) ||
(keyword.equals(SVNKeywords.AUTHOR)))
lastChangedBy = true;
else
if ((keyword.equals(SVNKeywords.LAST_CHANGED_DATE)) ||
(keyword.equals(SVNKeywords.DATE)))
lastChangedDate = true;
else
if ((keyword.equals(SVNKeywords.LAST_CHANGED_REVISION)) ||
(keyword.equals(SVNKeywords.REV)))
lastChangedRevision = true;
}
}
public SVNKeywords(
boolean lastChangedDate, boolean lastChangedRevision,
boolean lastChangedBy, boolean headUrl, boolean id) {
this.lastChangedDate = lastChangedDate;
this.lastChangedRevision = lastChangedRevision;
this.lastChangedBy = lastChangedBy;
this.headUrl = headUrl;
this.id = id;
}
public boolean isHeadUrl() {
return headUrl;
}
public boolean isId() {
return id;
}
public boolean isLastChangedBy() {
return lastChangedBy;
}
public boolean isLastChangedDate() {
return lastChangedDate;
}
public boolean isLastChangedRevision() {
return lastChangedRevision;
}
/**
*
* @return the list of keywords
*/
public List getKeywordsList() {
ArrayList list = new ArrayList();
if (headUrl)
list.add(HEAD_URL);
if (id)
list.add(ID);
if (lastChangedBy)
list.add(LAST_CHANGED_BY);
if (lastChangedDate)
list.add(LAST_CHANGED_DATE);
if (lastChangedRevision)
list.add(LAST_CHANGED_REVISION);
return list;
}
public String toString()
{
String result = "";
for (Iterator it = getKeywordsList().iterator(); it.hasNext();) {
String keyword = (String) it.next();
result += keyword;
if (it.hasNext())
result += ' ';
}
return result;
}
public void setHeadUrl(boolean b) {
headUrl = b;
}
public void setId(boolean b) {
id = b;
}
public void setLastChangedBy(boolean b) {
lastChangedBy = b;
}
public void setLastChangedDate(boolean b) {
lastChangedDate = b;
}
public void setLastChangedRevision(boolean b) {
lastChangedRevision = b;
}
}
././@LongLink 0000000 0000000 0000000 00000000147 00000000000 011567 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNProperty.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNProperty.ja0000644 0000000 0000000 00000006233 10613664631 032616 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.io.File;
/**
* An interface describing a subversion property (e.g. as return by svn propget)
*
* @author Cédric Chabanois
* cchabanois@ifrance.com
*/
public interface ISVNProperty {
/**
* mime type of the entry, used to flag binary files
*/
public static final String MIME_TYPE = "svn:mime-type";
/**
* list of filenames with wildcards which should be ignored by add and
* status
*/
public static final String IGNORE = "svn:ignore";
/**
* how the end of line code should be treated during retrieval
*/
public static final String EOL_STYLE = "svn:eol-style";
/**
* list of keywords to be expanded during retrieval
*/
public static final String KEYWORDS = "svn:keywords";
/**
* flag if the file should be made excutable during retrieval
*/
public static final String EXECUTABLE = "svn:executable";
/**
* value for svn:executable
*/
public static final String EXECUTABLE_VALUE = "*";
/**
* list of directory managed outside of this working copy
*/
public static final String EXTERNALS = "svn:externals";
/**
* the author of the revision
*/
public static final String REV_AUTHOR = "svn:author";
/**
* the log message of the revision
*/
public static final String REV_LOG = "svn:log";
/**
* the date of the revision
*/
public static final String REV_DATE = "svn:date";
/**
* the original date of the revision
*/
public static final String REV_ORIGINAL_DATE = "svn:original-date";
/**
* @return the name of the property
*/
String getName();
/**
* Returns the string value of the property.
* There is no protocol if a property is a string or a binary value
* @return the string value
*/
String getValue();
/**
* @return the file this property belongs to (or null if on remote resource)
*/
File getFile();
/**
* @return the url this property belongs to
*/
SVNUrl getUrl();
/**
* Returns the byte array value of the property
* There is no protocol if a property is a string or a binary value
* @return the byte array value
*/
byte[] getData();
} ././@LongLink 0000000 0000000 0000000 00000000154 00000000000 011565 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNConflictResult.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNConflictResu0000644 0000000 0000000 00000004005 10755343733 032667 0 ustar root root package org.tigris.subversion.svnclientadapter;
/**
* The result returned by the callback API used to handle conflicts
* encountered during merge/update/switch operations.
*/
public class SVNConflictResult {
/**
* Nothing done to resolve the conflict; conflict remains.
*/
public static final int postpone = 0;
/**
* Resolve the conflict by choosing the base file.
*/
public static final int chooseBase = 1;
/**
* Resolve the conflict by choosing the incoming (repository)
* version of the object.
*/
public static final int chooseTheirsFull = 2;
/**
* Resolve the conflict by choosing own (local) version of the
* object.
*/
public static final int chooseMineFull = 3;
/**
* Resolve the conflict by choosing the incoming (repository)
* version of the object (for conflicted hunks only).
*/
public static final int chooseTheirs = 4;
/**
* Resolve the conflict by choosing own (local) version of the
* object (for conflicted hunks only).
*/
public static final int chooseMine = 5;
/**
* Resolve the conflict by choosing the merged object
* (potentially manually edited).
*/
public static final int chooseMerged = 6;
/**
* A value corresponding to the
* svn_wc_conflict_choice_t
enum.
*/
private int choice;
/**
* The path to the result of a merge, or null
.
*/
private String mergedPath;
/**
* Create a new conflict result instace.
*/
public SVNConflictResult(int choice, String mergedPath)
{
this.choice = choice;
this.mergedPath = mergedPath;
}
/**
* @return A value corresponding to the
* svn_wc_conflict_choice_t
enum.
*/
public int getChoice()
{
return choice;
}
/**
* @return The path to the result of a merge, or null
.
*/
public String getMergedPath()
{
return mergedPath;
}
}
././@LongLink 0000000 0000000 0000000 00000000160 00000000000 011562 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNLogMessageCallback.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNLogMessageCa0000644 0000000 0000000 00000001375 11035734453 032563 0 ustar root root package org.tigris.subversion.svnclientadapter;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
public class SVNLogMessageCallback implements ISVNLogMessageCallback {
private List messages = new ArrayList();
private Stack stack = new Stack();
public void singleMessage(ISVNLogMessage msg) {
if (msg == null) {
if (!stack.empty())
stack.pop();
return;
}
if (stack.empty()) {
messages.add(msg);
} else {
ISVNLogMessage current = (ISVNLogMessage) stack.peek();
current.addChild(msg);
}
if (msg.hasChildren())
stack.push(msg);
}
public ISVNLogMessage[] getLogMessages() {
ISVNLogMessage[] array = new ISVNLogMessage[messages.size()];
return (ISVNLogMessage[]) messages.toArray(array);
}
}
././@LongLink 0000000 0000000 0000000 00000000155 00000000000 011566 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNNotifyListener.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNNotifyListe0000644 0000000 0000000 00000010052 10775754555 032662 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.io.File;
/**
* A callback interface used for receiving notifications of a progress of
* a subversion command invocation.
*
* @author Cédric Chabanois cchabanois@ifrance.com
*/
public interface ISVNNotifyListener {
/**
* An enumeration class representing the supported subversion commands/actions.
*/
public static final class Command {
public static final int UNDEFINED = 0;
public static final int ADD = 1;
public static final int CHECKOUT = 2;
public static final int COMMIT = 3;
public static final int UPDATE = 4;
public static final int MOVE = 5;
public static final int COPY = 6;
public static final int REMOVE = 7;
public static final int EXPORT = 8;
public static final int IMPORT = 9;
public static final int MKDIR = 10;
public static final int LS = 11;
public static final int STATUS = 12;
public static final int LOG = 13;
public static final int PROPSET = 14;
public static final int PROPDEL = 15;
public static final int REVERT = 16;
public static final int DIFF = 17;
public static final int CAT = 18;
public static final int INFO = 19;
public static final int PROPGET = 20;
public static final int PROPLIST = 21;
public static final int RESOLVED = 22;
public static final int CREATE_REPOSITORY = 23;
public static final int CLEANUP = 24;
public static final int ANNOTATE = 25;
public static final int SWITCH = 26;
public static final int MERGE = 27;
public static final int LOCK = 28;
public static final int UNLOCK = 29;
public static final int RELOCATE = 30;
public static final int RESOLVE = 31;
public static final int MERGEINFO = 32;
}
/**
* Tell the callback the command to be executed
* @param command one of {@link Command}.* constants
*/
public void setCommand(int command);
/**
* called at the beginning of the command
* @param commandLine
*/
public void logCommandLine(String commandLine);
/**
* called multiple times during the execution of a command
* @param message
*/
public void logMessage(String message);
/**
* called when an error happen during a command
* @param message
*/
public void logError(String message);
/**
* Called when a command has completed to report
* that the command completed against the specified
* revision.
*
* @param revision
* @param path - path to folder which revision is reported (either root, or some of svn:externals)
*/
public void logRevision(long revision, String path);
/**
* called when a command has completed
* @param message
*/
public void logCompleted(String message);
/**
* called when a subversion action happen on a file (add, delete, update ...)
* @param path the canonical path of the file or dir
* @param kind file or dir or unknown
*/
public void onNotify(File path, SVNNodeKind kind);
}
././@LongLink 0000000 0000000 0000000 00000000155 00000000000 011566 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNConflictVersion.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNConflictVers0000644 0000000 0000000 00000002510 11147073645 032665 0 ustar root root package org.tigris.subversion.svnclientadapter;
public class SVNConflictVersion {
private String reposURL;
private long pegRevision;
private String pathInRepos;
private int nodeKind;
public SVNConflictVersion(String reposURL, long pegRevision, String pathInRepos, int nodeKind) {
this.reposURL = reposURL;
this.pegRevision = pegRevision;
this.pathInRepos = pathInRepos;
this.nodeKind = nodeKind;
}
public String getReposURL()
{
return reposURL;
}
public long getPegRevision()
{
return pegRevision;
}
public String getPathInRepos()
{
return pathInRepos;
}
public int getNodeKind()
{
return nodeKind;
}
public String toString() {
StringBuffer sb = new StringBuffer("(");
switch (nodeKind) {
case NodeKind.none:
sb.append("none");
break;
case NodeKind.file:
sb.append("file");
break;
case NodeKind.directory:
sb.append("dir");
break;
default:
sb.append(nodeKind);
break;
}
sb.append(") " + reposURL + "/" + pathInRepos + "@" + pegRevision);
return sb.toString();
}
public final class NodeKind
{
public static final int none = 0;
public static final int file = 1;
public static final int directory = 2;
}
}
libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNUrl.java 0000644 0000000 0000000 00000022760 10725324432 031751 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.net.MalformedURLException;
import org.tigris.subversion.svnclientadapter.utils.StringUtils;
/**
* We could have used URL, using custom protocols (svn, svn+ssl)
* (@see http://developer.java.sun.com/developer/onlineTraining/protocolhandlers/)
* but this is not really necessary as we don't want to open a connection
* directly with this class.
* We just want a string which represent a SVN url which can be used with our JNI
* methods.
*
* An SVNUrl is immutable.
*
* @author C�dric Chabanois
* cchabanois@ifrance.com
*
*/
public class SVNUrl {
private static final String SVN_PROTOCOL = "svn";
private static final String SVNSSH_PROTOCOL = "svn+";
private static final String HTTP_PROTOCOL = "http";
private static final String HTTPS_PROTOCOL = "https";
private static final String FILE_PROTOCOL = "file";
protected static final char SEGMENT_SEPARATOR = '/';
private String protocol; // http, file, svn or svn+ssh
private String[] segments;
private String host;
private int port;
/**
* Constructor
* @param svnUrl a string to parse url from
* @throws MalformedURLException when parsing failed
*/
public SVNUrl(String svnUrl) throws MalformedURLException {
if(svnUrl == null)
throw new MalformedURLException("Svn url cannot be null. Is this a versioned resource?");
parseUrl(svnUrl.trim());
}
private SVNUrl(String protocol, String host, int port, String[] segments)
{
super();
this.protocol = protocol;
this.host = host;
this.port = port;
this.segments = segments;
}
/**
* Asnwer a new SVNUrl with added segments
* @param path a String of path segment(s) to ba appended to receiver
* @return new SVNUrl
*/
public SVNUrl appendPath(String path)
{
String[] segmentsToAdd = StringUtils.split(path, SEGMENT_SEPARATOR);
//Skip the starting slash
if ((segmentsToAdd.length > 0) && (segmentsToAdd[0].equals("")))
{
String[] newSegmentsToAdd = new String[segmentsToAdd.length - 1];
System.arraycopy(segmentsToAdd, 1, newSegmentsToAdd, 0, segmentsToAdd.length - 1);
segmentsToAdd = newSegmentsToAdd;
}
String[] newSegments = new String[segments.length + segmentsToAdd.length];
System.arraycopy(segments, 0, newSegments, 0, segments.length);
System.arraycopy(segmentsToAdd, 0, newSegments, segments.length, segmentsToAdd.length);
return new SVNUrl(this.protocol, this.host, this.port, newSegments);
}
/**
* verifies that the url is correct
* @throws MalformedURLException
*/
private void parseUrl(String svnUrl) throws MalformedURLException{
String parsed = svnUrl;
// SVNUrl have this format :
// scheme://host[:port]/path
// parse protocol
int i = parsed.indexOf("://");
if (i == -1)
throw new MalformedURLException("Invalid svn url: "+svnUrl);
protocol = parsed.substring(0,i).toLowerCase();
if ((!protocol.equalsIgnoreCase(HTTP_PROTOCOL)) &&
(!protocol.equalsIgnoreCase(HTTPS_PROTOCOL)) &&
(!protocol.equalsIgnoreCase(FILE_PROTOCOL)) &&
(!protocol.equalsIgnoreCase(SVN_PROTOCOL)) &&
(!protocol.startsWith(SVNSSH_PROTOCOL)) ) {
throw new MalformedURLException("Invalid svn url: "+svnUrl);
}
parsed = parsed.substring(i+3);
if (parsed.length() == 0) {
throw new MalformedURLException("Invalid svn url: "+svnUrl);
}
// parse host & port
i = parsed.indexOf("/");
if (i == -1) {
i = parsed.length();
}
if (!protocol.equalsIgnoreCase(FILE_PROTOCOL)) {
String hostPort = parsed.substring(0,i).toLowerCase();
String[] hostportArray = StringUtils.split(hostPort,':');
if (hostportArray.length == 0) {
throw new MalformedURLException("Invalid svn url: "+svnUrl);
} else if (hostportArray.length == 2) {
this.host = hostportArray[0];
try {
this.port = Integer.parseInt(hostportArray[1]);
} catch (NumberFormatException e) {
throw new MalformedURLException("Invalid svn url: "+svnUrl);
}
} else {
this.host = hostportArray[0];
this.port = getDefaultPort(protocol);
}
} else {
this.port = -1;
// parse path
if (i == 0) {
this.host = "";
} else {
this.host = parsed.substring(0,i);
}
}
// parse path
if (i < parsed.length()) {
parsed = parsed.substring(i+1);
} else {
parsed = "";
}
segments = StringUtils.split(parsed,'/');
}
/**
* get the default port for given protocol
* @param protocol
* @return port number or -1 if protocol is unknown
*/
public static int getDefaultPort(String protocol) {
int port = -1;
if (SVN_PROTOCOL.equals(protocol)) {
port = 3690;
} else if (HTTP_PROTOCOL.equals(protocol)) {
port = 80;
} else if (HTTPS_PROTOCOL.equals(protocol)) {
port = 443;
} else if (protocol != null && protocol.startsWith(SVNSSH_PROTOCOL)) {
port = 22;
}
return port;
}
/**
* Get the url as String. The url returned never ends with "/"
* @return String representation of this url instance
*/
private String get() {
//Be sofisticated and compute the StringBuffer size up-front.
StringBuffer buffer = new StringBuffer(calculateUrlLength());
buffer.append(getProtocol());
buffer.append("://");
buffer.append(getHost());
if (getPort() != getDefaultPort(getProtocol())) {
buffer.append(":");
buffer.append(getPort());
}
for (int i = 0; i < segments.length;i++) {
buffer.append(SEGMENT_SEPARATOR);
buffer.append(segments[i]);
}
return buffer.toString();
}
private int calculateUrlLength()
{
int result = 3; // Size of "://"
if (getProtocol() != null) result += getProtocol().length();
if (getHost() != null) result += getHost().length();
if (getPort() != getDefaultPort(getProtocol())) {
result++; //Add one for ":"
result += String.valueOf(getPort()).length();
}
for (int i = 0; i < segments.length;i++) {
result++; // Add 1 for separator
result += segments[i].length();
}
return result;
}
/**
* get the protocol
* @return either http, https, file, svn or svn+ssh
*/
public String getProtocol() {
return protocol;
}
/**
* @return Returns the host.
*/
public String getHost() {
return host;
}
/**
* @return Returns the port.
*/
public int getPort() {
return port;
}
/**
* get the path of the url.
* @return an arrray of url path segments
*/
public String[] getPathSegments() {
return segments;
}
/**
* @return the "file" name, i.e. the element after last /
*/
public String getLastPathSegment() {
if (segments.length == 0)
return "";
return segments[segments.length-1];
}
/**
* Return new SVNUrl which represents parent of the receiver
* @return the parent url or null if no parent
*/
public SVNUrl getParent() {
if ((segments.length == 0) ||
((segments.length == 1) && ((host == null) || (host.length() == 0))))
{
return null;
}
String[] parentSegments = new String[segments.length - 1];
System.arraycopy(segments, 0, parentSegments, 0, segments.length - 1);
return new SVNUrl(this.protocol, this.host, this.port, parentSegments);
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(Object target) {
// this method is not very accurate because :
// url before repository is not always case sensitive
if (this == target)
return true;
if (!(target instanceof SVNUrl))
return false;
SVNUrl url = (SVNUrl) target;
return get().equals(url.get());
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
public int hashCode()
{
return get().hashCode();
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString() {
return get();
}
}
././@LongLink 0000000 0000000 0000000 00000000150 00000000000 011561 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNCopySource.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNCopySource.j0000644 0000000 0000000 00000004004 10630607233 032577 0 ustar root root /*******************************************************************************
* Copyright (c) 2007 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
public class SVNCopySource {
/**
* The source path or URL.
*/
private String path;
/**
* The source revision.
*/
private SVNRevision revision;
/**
* The peg revision.
*/
private SVNRevision pegRevision;
/**
* Create a new instance.
*
* @param path
* @param revision The source revision.
* @param pegRevision The peg revision. Typically interpreted as
* {@link org.tigris.subversion.javahl.SVNRevision#HEAD} when
* null
.
*/
public SVNCopySource(String path, SVNRevision revision, SVNRevision pegRevision)
{
this.path = path;
this.revision = revision;
this.pegRevision = pegRevision;
}
/**
* @return The source path or URL.
*/
public String getPath()
{
return this.path;
}
/**
* @return The source revision.
*/
public SVNRevision getRevision()
{
return this.revision;
}
/**
* @return The peg revision.
*/
public SVNRevision getPegRevision()
{
return this.pegRevision;
}
}
././@LongLink 0000000 0000000 0000000 00000000147 00000000000 011567 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNConstants.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/SVNConstants.ja0000644 0000000 0000000 00000002515 10613664631 032634 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
/**
* Subversion related global constants
*
*/
public class SVNConstants {
/** a "entries" workingCopy metadata directory name */
public static final String SVN_ENTRIES = "entries";
/** a "dir-props" workingCopy metadata directory name */
public static final String SVN_DIRPROPS = "dir-props";
/** a "props" workingCopy metadata directory name */
public static final String SVN_PROPS = "props";
}
libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/utils/ 0000755 0000000 0000000 00000000000 11240243240 031074 5 ustar root root ././@LongLink 0000000 0000000 0000000 00000000146 00000000000 011566 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/utils/Depth.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/utils/Depth.jav0000644 0000000 0000000 00000003226 10631060322 032646 0 ustar root root /*******************************************************************************
* Copyright (c) 2007 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.utils;
public class Depth {
/** Depth undetermined or ignored.
public static final int unknown = -2;
/** Exclude (remove, whatever) directory D.
public static final int exclude = -1;
/** Just the named directory D, no entries. */
public static final int empty = 0;
/** D + its file children, but not subdirs. */
public static final int files = 1;
/** D + immediate children (D and its entries). */
public static final int immediates = 2;
/** D + all descendants (full recursion from D). */
public static final int infinity = 3;
public static final int fromRecurse(boolean recurse)
{
if (recurse)
return infinity;
else
return files;
}
}
././@LongLink 0000000 0000000 0000000 00000000151 00000000000 011562 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/utils/Messages.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/utils/Messages.0000644 0000000 0000000 00000006115 10613664631 032665 0 ustar root root /*******************************************************************************
* Copyright (c) 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.utils;
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
* A helper class used for binding NLS supported message strings
*
*/
public class Messages {
private static final String BUNDLE_NAME = "org.tigris.subversion.svnclientadapter.messages"; //$NON-NLS-1$
protected static ResourceBundle bundle = null;
private static ResourceBundle getResourceBundle() {
if (bundle == null) {
bundle = ResourceBundle.getBundle(BUNDLE_NAME);
}
return bundle;
}
/**
* Lookup the message with the given ID in this catalog and bind its
* substitution locations with the given string.
* @param id
* @param binding
* @return the message with substitutions applied
*/
public static String bind(String id, String binding) {
return bind(id, new String[] { binding });
}
/**
* Lookup the message with the given ID in this catalog and bind its
* substitution locations with the given strings.
* @param id
* @param binding1
* @param binding2
* @return the message with substitutions applied
*/
public static String bind(String id, String binding1, String binding2) {
return bind(id, new String[] { binding1, binding2 });
}
/**
* Gets a string from the resource bundle. We don't want to crash because of a missing String.
* @param key
* @return string from the resource bundle or the key if not found.
*/
public static String bind(String key) {
try {
return getResourceBundle().getString(key);
} catch (MissingResourceException e) {
return key;
} catch (NullPointerException e) {
return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
/**
* Gets a string from the resource bundle and binds it with the given arguments. If the key is
* not found, return the key.
* @param key
* @param args
* @return string with substitutions from the resource bundle or the key if not found.
*/
public static String bind(String key, Object[] args) {
try {
return MessageFormat.format(bind(key), args);
} catch (MissingResourceException e) {
return key;
} catch (NullPointerException e) {
return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
}
}
}
././@LongLink 0000000 0000000 0000000 00000000157 00000000000 011570 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/utils/SVNStatusUtils.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/utils/SVNStatus0000644 0000000 0000000 00000011103 10613664631 032703 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.utils;
import org.tigris.subversion.svnclientadapter.ISVNStatus;
import org.tigris.subversion.svnclientadapter.SVNStatusKind;
/**
* Some static methods to deal with svn status
*
* @author cedric chabanois (cchab at tigris.org)
*/
public class SVNStatusUtils {
/**
* @param textStatus The status information to examine
* (non-null
).
* @return Whether textStatus
denotes a versioned
* resource.
*/
public static boolean isManaged(SVNStatusKind textStatus) {
return (!textStatus.equals(SVNStatusKind.UNVERSIONED)
&& !textStatus.equals(SVNStatusKind.NONE)
&& !textStatus.equals(SVNStatusKind.IGNORED));
}
/**
* Returns if is managed by svn (added, normal, modified ...)
* @param status
*
* @return if managed by svn
*/
public static boolean isManaged(ISVNStatus status) {
return isManaged(status.getTextStatus());
}
/**
* Returns if the resource has a remote counter-part
* @param status
*
* @return has version in repository
*/
public static boolean hasRemote(ISVNStatus status) {
SVNStatusKind textStatus = status.getTextStatus();
return ((isManaged(textStatus)) && (!textStatus.equals(SVNStatusKind.ADDED) || status.isCopied()));
}
public static boolean isAdded(ISVNStatus status) {
return status.getTextStatus().equals(SVNStatusKind.ADDED);
}
public static boolean isDeleted(ISVNStatus status) {
return status.getTextStatus().equals(SVNStatusKind.DELETED);
}
public static boolean isReplaced(ISVNStatus status) {
return status.getTextStatus().equals(SVNStatusKind.REPLACED);
}
public static boolean isMissing(ISVNStatus status) {
return status.getTextStatus().equals(SVNStatusKind.MISSING);
}
public static boolean isIgnored(ISVNStatus status) {
return status.getTextStatus().equals(SVNStatusKind.IGNORED);
}
public static boolean isTextMerged(ISVNStatus status) {
return status.getTextStatus().equals(SVNStatusKind.MERGED);
}
public static boolean isTextModified(ISVNStatus status) {
return status.getTextStatus().equals(SVNStatusKind.MODIFIED);
}
public static boolean isTextConflicted(ISVNStatus status) {
return status.getTextStatus().equals(SVNStatusKind.CONFLICTED);
}
public static boolean isPropModified(ISVNStatus status) {
return status.getPropStatus().equals(SVNStatusKind.MODIFIED);
}
public static boolean isPropConflicted(ISVNStatus status) {
return status.getPropStatus().equals(SVNStatusKind.CONFLICTED);
}
/**
* Answer whether the status is "outgoing", i.e. whether resource with such status could/should be commited
* @param status
* @return true when the status represents "outgoing" state
*/
public static boolean isReadyForCommit(ISVNStatus status) {
return isTextModified(status) || isAdded(status) || isDeleted(status)
|| isReplaced(status) || isPropModified(status)
|| isTextConflicted(status) || isPropConflicted(status) ||
(!isManaged(status) && !isIgnored(status));
}
/**
* Answer whether the status was "changed", i.e. whether resource with such status could/should be reverted
* @param status
* @return true when the status represents "changed" state
*/
public static boolean isReadyForRevert(ISVNStatus status) {
return isTextModified(status) || isAdded(status) || isDeleted(status)
|| isMissing(status)
|| isReplaced(status) || isPropModified(status)
|| isTextConflicted(status) || isPropConflicted(status);
}
}
././@LongLink 0000000 0000000 0000000 00000000150 00000000000 011561 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/utils/Command.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/utils/Command.j0000644 0000000 0000000 00000005303 10613664631 032644 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.utils;
import java.io.IOException;
import java.io.OutputStream;
/**
* execute a command. Some parts of this class come from SVNKit
*/
public class Command {
private Process process = null;
private String command;
private String[] parameters = new String[] {};
private OutputStream out = System.out;
private OutputStream err = System.err;
public Command(String command) {
this.command = command;
}
/**
* @param err
* The err to set.
*/
public void setErr(OutputStream err) {
this.err = err;
}
/**
* @param out
* The out to set.
*/
public void setOut(OutputStream out) {
this.out = out;
}
/**
* @param parameters The parameters to set.
*/
public void setParameters(String[] parameters) {
this.parameters = parameters;
}
/**
* @return Returns the process.
*/
public Process getProcess() {
return process;
}
public void kill() {
if (process != null) {
process.destroy();
process = null;
}
}
public void exec() throws IOException {
String[] cmdArray= new String[parameters.length+1];
cmdArray[0] = command;
System.arraycopy(parameters,0,cmdArray,1,parameters.length);
process = Runtime.getRuntime().exec(cmdArray);
if (process != null) {
new ReaderThread(process.getInputStream(), out).start();
new ReaderThread(process.getErrorStream(), err).start();
process.getOutputStream().close();
}
}
/**
*
* causes the current thread to wait, if necessary, until the process
* represented by this Command
object has terminated
*
* @return the exit value of the process. By convention, 0
* indicates normal termination.
* @throws InterruptedException
*/
public int waitFor() throws InterruptedException {
return process.waitFor();
}
} ././@LongLink 0000000 0000000 0000000 00000000154 00000000000 011565 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/utils/StringUtils.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/utils/StringUti0000644 0000000 0000000 00000007665 10613664631 033003 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.utils;
import java.util.ArrayList;
import java.util.List;
/**
* A helper class for various string operations
*
*/
public class StringUtils {
/**
* we can't use String.split as it is a JDK 1.4 method.
* //TODO Java 1.4 is not aproblem anymore. Isn't it ?
* @param str
* @param separator
* @return an array of string segments
*/
static public String[] split(String str, char separator) {
int pos = 0;
List list = new ArrayList();
int length = str.length();
for (int i = 0; i < length;i++) {
char ch = str.charAt(i);
if (ch == separator) {
list.add(str.substring(pos,i));
pos = i+1;
}
}
if (pos != length) {
list.add(str.substring(pos,length));
}
return (String[])list.toArray(new String[list.size()]);
}
/**
* split using a string separator
* @param str
* @param separator
* @return an array of string segments
*/
static public String[] split(String str, String separator) {
List list = new ArrayList();
StringBuffer sb = new StringBuffer(str);
int pos;
while ((pos = sb.indexOf(separator)) != -1) {
list.add(sb.substring(0,pos));
sb.delete(0,pos+separator.length());
}
if (sb.length() > 0) {
list.add(sb.toString());
}
return (String[])list.toArray(new String[list.size()]);
}
// the following method has been taken from commons-lang StringUtils class
/**
* Strips any of a set of characters from the start of a String.
* *A null
input String returns null
.
* An empty string ("") input returns the empty string.
If the stripChars String is null
, whitespace is
* stripped as defined by {@link Character#isWhitespace(char)}.
* StringUtils.stripStart(null, *) = null * StringUtils.stripStart("", *) = "" * StringUtils.stripStart("abc", "") = "abc" * StringUtils.stripStart("abc", null) = "abc" * StringUtils.stripStart(" abc", null) = "abc" * StringUtils.stripStart("abc ", null) = "abc " * StringUtils.stripStart(" abc ", null) = "abc " * StringUtils.stripStart("yxabc ", "xyz") = "abc " ** * @param str the String to remove characters from, may be null * @param stripChars the characters to remove, null treated as whitespace * @return the stripped String,
null
if null String input
*/
public static String stripStart(String str, String stripChars) {
int strLen;
if (str == null || (strLen = str.length()) == 0) {
return str;
}
int start = 0;
if (stripChars == null) {
while ((start != strLen) && Character.isWhitespace(str.charAt(start))) {
start++;
}
} else if (stripChars.length() == 0) {
return str;
} else {
while ((start != strLen) && (stripChars.indexOf(str.charAt(start)) != -1)) {
start++;
}
}
return str.substring(start);
}
}
././@LongLink 0000000 0000000 0000000 00000000155 00000000000 011566 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/utils/ReaderThread.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/utils/ReaderThr0000644 0000000 0000000 00000003534 10613664631 032722 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.utils;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
* This class has been taken from SVNKit
*/
public class ReaderThread extends Thread {
private final InputStream myInputStream;
private final OutputStream myOutputStream;
public ReaderThread(InputStream is, OutputStream os) {
myInputStream = is;
myOutputStream = os;
setDaemon(true);
}
public void run() {
try {
while(true) {
int read = myInputStream.read();
if (read < 0) {
return;
}
myOutputStream.write(read);
}
} catch (IOException e) {
} finally {
try {
myInputStream.close();
myOutputStream.flush();
} catch (IOException e) {
//Just ignore. Stream closing.
}
}
}
}
././@LongLink 0000000 0000000 0000000 00000000154 00000000000 011565 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/utils/SVNUrlUtils.java libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/utils/SVNUrlUti0000644 0000000 0000000 00000015522 10613664631 032655 0 ustar root root /*******************************************************************************
* Copyright (c) 2005, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.utils;
import java.net.MalformedURLException;
import org.tigris.subversion.svnclientadapter.SVNUrl;
/**
* Utility class
*/
public class SVNUrlUtils {
/**
* get the common root url for given urls
* @param url1
* @param url2
* @return the common root url for given urls
*/
public static SVNUrl getCommonRootUrl(SVNUrl url1, SVNUrl url2) {
if ( (!url1.getProtocol().equals(url2.getProtocol())) ||
(!url1.getHost().equals(url2.getHost())) ||
(url1.getPort() != url2.getPort()) ) {
return null;
}
String url = url1.getProtocol()+"://"+url1.getHost()+":"+url1.getPort();
String[] segs1 = url1.getPathSegments();
String[] segs2 = url2.getPathSegments();
int minLength = segs1.length >= segs2.length ? segs2.length : segs1.length;
for (int i = 0; i < minLength; i++) {
if (!segs1[i].equals(segs2[i])) {
break;
}
url+="/"+segs1[i];
}
try {
return new SVNUrl(url);
} catch (MalformedURLException e) {
return null;
}
}
/**
* get the common root url for given urls
* @param urls
* @return the common root url for given urls
*/
public static SVNUrl getCommonRootUrl(SVNUrl urls[]) {
SVNUrl commonRoot = urls[0];
for (int i = 0; i < urls.length; i++) {
commonRoot = getCommonRootUrl(commonRoot, urls[i]);
if (commonRoot == null) {
return null;
}
}
return commonRoot;
}
/**
* Get path of url relative to rootUrl
* @param rootUrl
* @param url
* @return relative path or null if rootUrl is not a parent of url
*/
public static String getRelativePath(SVNUrl rootUrl, SVNUrl url)
{
return getRelativePath(rootUrl, url, false);
}
/**
* Get path of url relative to rootUrl
* @param rootUrl
* @param url
* @param includeStartingSlash whether the realtive url should start with / or not
* @return relative path or null if rootUrl is not a parent of url
*/
public static String getRelativePath(SVNUrl rootUrl, SVNUrl url, boolean includeStartingSlash )
{
//TODO Isn't there a more efficient way than to convert those urls to Strings ?
String rootUrlStr = rootUrl.toString();
String urlStr = url.toString();
if (urlStr.indexOf(rootUrlStr) == -1) {
return null;
}
if (urlStr.length() == rootUrlStr.length()) {
return "";
}
return urlStr.substring(rootUrlStr.length() + (includeStartingSlash ? 0 : 1));
}
/**
* Get url representing the fileName of working copy.
* Use the parent's (not necesarily direct parent) WC fileName and SVNUrl to calculate it.
* E.g.
*
* SVNUrl rootUrl = new SVNUrl("http://svn.collab.net:81/repos/mydir");
* String rootPath = "C:\\Documents and Settings\\User\\My Documents\\Eclipse\\mydir";
* String filePath = "C:\\Documents and Settings\\User\\My Documents\\Eclipse\\mydir\\mydir2\\myFile.txt";
* SVNUrl expected = new SVNUrl("http://svn.collab.net:81/repos/mydir/mydir2/myFile.txt");
* assertEquals(expected,SVNUrlUtils.getUrlFromLocalFileName(filePath, rootUrl, rootPath));
*
*
* @param localFileName name of the file representing working copy of resource
* @param parentUrl svnUrl of a resource preceeding the localFileName in hierarchy
* @param parentPathName WC fileName of a resource preceeding the localFileName in hierarchy
* @return url representing the fileName of working copy.
*/
public static SVNUrl getUrlFromLocalFileName(String localFileName, SVNUrl parentUrl, String parentPathName)
{
return getUrlFromLocalFileName(localFileName, parentUrl.toString(), parentPathName);
}
/**
* Get url representing the fileName of working copy.
* Use the parent's (not necesarily direct parent) WC fileName and SVNUrl to calculate it.
* E.g.
*
* SVNUrl rootUrl = new SVNUrl("http://svn.collab.net:81/repos/mydir");
* String rootPath = "C:\\Documents and Settings\\User\\My Documents\\Eclipse\\mydir";
* String filePath = "C:\\Documents and Settings\\User\\My Documents\\Eclipse\\mydir\\mydir2\\myFile.txt";
* SVNUrl expected = new SVNUrl("http://svn.collab.net:81/repos/mydir/mydir2/myFile.txt");
* assertEquals(expected,SVNUrlUtils.getUrlFromLocalFileName(filePath, rootUrl, rootPath));
*
*
* @param localFileName name of the file representing working copy of resource
* @param parentUrl url string of a resource preceeding the localFileName in hierarchy
* @param parentPathName WC fileName of a resource preceeding the localFileName in hierarchy
* @return url representing the fileName of working copy.
*/
public static SVNUrl getUrlFromLocalFileName(String localFileName, String parentUrl, String parentPathName)
{
String parentPath = (parentPathName.indexOf('\\') > 0) ? parentPathName.replaceAll("\\\\","/") : parentPathName;
String localFile = (localFileName.indexOf('\\') > 0) ? localFileName.replaceAll("\\\\","/") : localFileName;
try {
if (localFile.indexOf(parentPath) != 0) return null;
if (localFile.length() == parentPath.length()) return new SVNUrl(parentUrl);
char lastChar = parentPath.charAt(parentPath.length() - 1);
String relativeFileName = localFile.substring(parentPath.length() + (((lastChar != '\\') && (lastChar != '/')) ? 1 : 0));
if (parentUrl.charAt(parentUrl.length()-1) == '/')
{
return new SVNUrl(parentUrl + relativeFileName);
}
else
{
return new SVNUrl(parentUrl + "/" + relativeFileName);
}
} catch (MalformedURLException e) {
return null;
}
}
}
libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/ISVNLock.java 0000644 0000000 0000000 00000003173 10613664631 032211 0 ustar root root /*******************************************************************************
* Copyright (c) 2005, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter;
import java.util.Date;
/**
* An interface describing a lock as return by the lock operation.
*
*/
public interface ISVNLock {
/**
* @return the owner of the lock
*/
public String getOwner();
/**
* @return the path of the locked item
*/
public String getPath();
/**
* @return the token provided during the lock operation
*/
public String getToken();
/**
* @return the comment provided during the lock operation
*/
public String getComment();
/**
* @return the date the lock was created
*/
public Date getCreationDate();
/**
* @return the date when the lock will expire
*/
public Date getExpirationDate();
}
././@LongLink 0000000 0000000 0000000 00000000151 00000000000 011562 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/messages.properties libnb-svnclientadapter-java-6.7.orig/src/main/org/tigris/subversion/svnclientadapter/messages.proper0000644 0000000 0000000 00000005030 11147073645 033012 0 ustar root root #******************************************************************************
# Copyright (c) 2005, 2006 svnClientAdapter project and others.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Contributors:
# svnClientAdapter project committers - initial API and implementation
#******************************************************************************/
notify.skipped=Skipped {0}
notify.lock.failed=Failed to lock {0}
notify.unlock.failed=Failed to unlock {0}
notify.lock.other={0} locked by user {1}
notify.lock={0} locked
notify.unlock={0} unlocked
notify.restored=Restored {0}
notify.reverted=Reverted {0}
notify.revert.failed=Failed to revert {0} -- try updating instead.
notify.resolved=Resolved conflicted state of {0}
notify.update.external=Updating external location at: {0}
notify.export=Exported revision {0}.
notify.checkout=Checked out revision {0}.
notify.update=Updated to revision {0}.
notify.at=At revision {0}.
notify.export.complete=Export complete.
notify.checkout.complete=Checkout complete.
notify.update.complete=Update complete.
notify.import.complete=Import complete.
notify.status.external=Performing status on external item at {0}
notify.status.revision=Status against revision: {0}
notify.commit.modified=Sending {0}
notify.commit.add=Adding {0}
notify.commit.delete=Deleting {0}
notify.commit.replace=Replacing {0}
notify.commit.transmit=Transmitting file data ...
notify.commit=Committed revision {0}.
notify.stats.file.head====== File Statistics: =====
notify.stats.prop.head===== Property Statistics: =====
notify.stats.conflict.head===== Conflict Statistics: =====
notify.stats.conflict= File conflicts: {0}
notify.stats.merge= Merged: {0}
notify.stats.delete= Deleted: {0}
notify.stats.add= Added: {0}
notify.stats.update= Updated: {0}
notify.stats.exists= Existing: {0}
notify.stats.prop.conflicts= Property conflicts: {0}
notify.stats.tree.conflicts= Tree conflicts: {0}
notify.commit.abnormal=svn: Commit failed (details follow):
notify.end.abnormal=Command completed abnormally.
libnb-svnclientadapter-java-6.7.orig/src/commandline/ 0000755 0000000 0000000 00000000000 11240243241 021442 5 ustar root root libnb-svnclientadapter-java-6.7.orig/src/commandline/org/ 0000755 0000000 0000000 00000000000 11240243241 022231 5 ustar root root libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/ 0000755 0000000 0000000 00000000000 11240243241 023532 5 ustar root root libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/ 0000755 0000000 0000000 00000000000 11240243241 025731 5 ustar root root libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/ 0000755 0000000 0000000 00000000000 11240243241 031277 5 ustar root root ././@LongLink 0000000 0000000 0000000 00000000151 00000000000 011562 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandline/ libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandl0000755 0000000 0000000 00000000000 11240243241 033012 5 ustar root root ././@LongLink 0000000 0000000 0000000 00000000203 00000000000 011560 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandline/CmdLineRemoteDirEntry.java libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandl0000644 0000000 0000000 00000014676 10613664631 033047 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.commandline;
import java.io.ByteArrayInputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import javax.xml.parsers.DocumentBuilderFactory;
import org.tigris.subversion.svnclientadapter.ISVNDirEntry;
import org.tigris.subversion.svnclientadapter.SVNClientException;
import org.tigris.subversion.svnclientadapter.SVNNodeKind;
import org.tigris.subversion.svnclientadapter.SVNRevision;
import org.tigris.subversion.svnclientadapter.SVNRevision.Number;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
/**
* * Implements a DirEntry on a remote location using the * "svn list" command.
* * @author Philip Schatz (schatz at tigris) */ class CmdLineRemoteDirEntry extends CmdLineXmlCommand implements ISVNDirEntry { private String path; private SVNRevision.Number revision; private SVNNodeKind nodeKind; private String lastCommitAuthor; private Date lastChangedDate; private long size; /** * @param path * @param revision * @param size * @param author * @param date * @param kind */ protected CmdLineRemoteDirEntry(String path, Number revision, long size, String author, Date date, SVNNodeKind kind ) { super(); lastCommitAuthor = author; lastChangedDate = date; nodeKind = kind; this.path = path; this.revision = revision; this.size = size; } /** * creates CmdLineRemoteDirEntries from a xml string (see svn list --xml) * @param cmdLineResults * @return CmdLineRemoteDirEntry[] array created from the supplied xml * @throws SVNClientException */ public static CmdLineRemoteDirEntry[] createDirEntries(byte[] cmdLineResults) throws SVNClientException { Collection logMessages = new ArrayList(); try { // Create a builder factory DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); // Create the builder and parse the file InputSource source = new InputSource(new ByteArrayInputStream(cmdLineResults)); Document doc = factory.newDocumentBuilder().parse(source); // This is the XML we need to parse // //Implements a Log message using "svn log".
* * @author Philip Schatz (schatz at tigris) */ class CmdLineLogMessage extends CmdLineXmlCommand implements ISVNLogMessage { private SVNRevision.Number rev; private String author; private Date date; private String msg; private ISVNLogMessageChangePath[] logMessageChangePaths; CmdLineLogMessage( SVNRevision.Number rev, String author, Date date, String msg, ISVNLogMessageChangePath[] logMessageChangePaths){ this.rev = rev; this.author = author; this.date = date; this.msg = msg; this.logMessageChangePaths = logMessageChangePaths; } /** * creates a log message from the output of svn log * This constructor is not used anymore. * The factory method createLogMessages is used instead */ CmdLineLogMessage(StringTokenizer st) { //NOTE: the leading dashes are ommitted by ClientAdapter. //grab "rev 49: phil | 2003-06-30 00:14:58 -0500 (Mon, 30 Jun 2003) | 1 line" String headerLine = st.nextToken(); //split the line up into 3 parts, left, middle, and right. StringTokenizer ltr = new StringTokenizer(headerLine, "|"); String left = ltr.nextToken(); String middle = ltr.nextToken(); String right = ltr.nextToken(); //Now, we have the header, so set the internal variables //set info gotten from top-left. StringTokenizer leftToken = new StringTokenizer(left, ":"); String revStr = leftToken.nextToken().trim(); //discard first bit. rev = Helper.toRevNum(revStr.substring(4, revStr.length())); // author is optional if(leftToken.hasMoreTokens()) author = leftToken.nextToken(); else author = ""; //set info from top-mid (date) date = Helper.toDate(middle.trim()); //get the number of lines. StringTokenizer rightToken = new StringTokenizer(right, " "); int messageLineCount = Integer.parseInt(rightToken.nextToken()); //get the body of the log. StringBuffer sb = new StringBuffer(); //st.nextToken(); //next line is always blank. for(int i=0; i < messageLineCount; i++) { sb.append(st.nextToken()); //dont add a newline to the last line. if(i < messageLineCount - 1) sb.append('\n'); } msg = sb.toString(); //take off the last dashes "-----------------------------------------" st.nextToken(); } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNLogMessage#getRevision() */ public SVNRevision.Number getRevision() { return rev; } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNLogMessage#getAuthor() */ public String getAuthor() { return author; } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNLogMessage#getDate() */ public Date getDate() { return date; } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNLogMessage#getMessage() */ public String getMessage() { return msg; } /* (non-Javadoc) * @see java.lang.Object#toString() */ public String toString() { return getMessage(); } /** * creates CmdLineLogMessages from a xml string (see svn log --xml -v) * @param cmdLineResults * @return CmdLineLogMessage[] array created from the supplied xml * @throws SVNClientException */ public static CmdLineLogMessage[] createLogMessages(byte[] cmdLineResults) throws SVNClientException { Collection logMessages = new ArrayList(); try { // Create a builder factory DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); // Create the builder and parse the file InputSource source = new InputSource(new ByteArrayInputStream(cmdLineResults)); Document doc = factory.newDocumentBuilder().parse(source); // This is the XML we need to parse // --verbose mode: //* Implements a ISVNStatus using "svn status" and "svn info".
* * @author Philip Schatz (schatz at tigris) * @author Cédric Chabanois (cchabanois at no-log.org) * @author Daniel Rall */ class CmdLineStatusComposite implements ISVNStatus { private CmdLineStatusPart statusPart; private CmdLineInfoPart infoPart; /** ** Creates a new status *
* Don't use this constructor if statusPart is null : use CmdLineStatusUnversioned instead * @param statusLinePart Generated from "svn status" * @param infoLinePart Generated from "svn info" */ CmdLineStatusComposite(CmdLineStatusPart statusPart, CmdLineInfoPart infoPart) { this.statusPart = statusPart; this.infoPart = infoPart; } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientStatus#getTextStatus() */ public SVNStatusKind getTextStatus() { return statusPart.getTextStatus(); } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNStatus#getPropStatus() */ public SVNStatusKind getPropStatus() { return statusPart.getPropStatus(); } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientStatus#getUrlCopiedFrom() */ public SVNUrl getUrlCopiedFrom() { return infoPart.getCopyUrl(); } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNStatus#getLastChangedDate() */ public Date getLastChangedDate() { return infoPart.getLastChangedDate(); } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNStatus#getLastChangedRevision() */ public Number getLastChangedRevision() { return infoPart.getLastChangedRevision(); } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNStatus#getLastCommitAuthor() */ public String getLastCommitAuthor() { return infoPart.getLastCommitAuthor(); } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNStatus#getNodeKind() */ public SVNNodeKind getNodeKind() { return infoPart.getNodeKind(); } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNStatus#getPath() */ public String getPath() { return (infoPart != null) ? infoPart.getPath() : statusPart.getPath(); } /** * @return The absolute path to this item. */ public File getFile() { return statusPart.getFile(); } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNStatus#getRevision() */ public Number getRevision() { return infoPart.getRevision(); } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNStatus#getUrl() */ public SVNUrl getUrl() { return infoPart.getUrl(); } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNStatus#getUrlString() */ public String getUrlString() { return infoPart.getUrlString(); } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNStatus#getRepositoryTextStatus() */ public SVNStatusKind getRepositoryTextStatus() { return statusPart.getRepositoryTextStatus(); } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNStatus#getRepositoryPropStatus() */ public SVNStatusKind getRepositoryPropStatus() { return statusPart.getRepositoryPropStatus(); } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNStatus#getConflictNew() */ public File getConflictNew() { return infoPart.getConflictNew(); } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNStatus#getConflictOld() */ public File getConflictOld() { return infoPart.getConflictOld(); } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNStatus#getConflictWorking() */ public File getConflictWorking() { return infoPart.getConflictWorking(); } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNStatus#isCopied() */ public boolean isCopied() { return statusPart.isCopied(); } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNStatus#isWcLocked() */ public boolean isWcLocked() { return statusPart.isWcLocked(); } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNStatus#isSwitched() */ public boolean isSwitched() { return statusPart.isSwitched(); } /* * (non-Javadoc) * * @see org.tigris.subversion.svnclientadapter.ISVNStatus#getLockCreationDate() */ public Date getLockCreationDate() { return infoPart.getLockCreationDate(); } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNStatus#getLockOwner() */ public String getLockOwner() { return infoPart.getLockOwner(); } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNStatus#getLockComment() */ public String getLockComment() { return infoPart.getLockComment(); } /* (non-Javadoc) * @see java.lang.Object#toString() */ public String toString() { return statusPart.getPath() + " T: " + statusPart.getTextStatus() + " P: " + statusPart.getPropStatus(); } } ././@LongLink 0000000 0000000 0000000 00000000210 00000000000 011556 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandline/CmdLineNotificationHandler.java libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandl0000644 0000000 0000000 00000003533 10613664631 033035 0 ustar root root /******************************************************************************* * Copyright (c) 2003, 2006 svnClientAdapter project and others. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Contributors: * svnClientAdapter project committers - initial API and implementation ******************************************************************************/ package org.tigris.subversion.svnclientadapter.commandline; import java.util.Iterator; import java.util.StringTokenizer; import org.tigris.subversion.svnclientadapter.ISVNNotifyListener; import org.tigris.subversion.svnclientadapter.SVNNotificationHandler; /** * Command line specific extension to generic notification handler * * @author Cédric Chabanois (cchabanois@ifrance.com) */ public class CmdLineNotificationHandler extends SVNNotificationHandler { /** * Log the supplied command line exception as Error * @param e an exception to log */ public void logException(CmdLineException e) { StringTokenizer st = new StringTokenizer(e.getMessage(), Helper.NEWLINE); while (st.hasMoreTokens()) { String line = st.nextToken(); for (Iterator it = notifylisteners.iterator(); it.hasNext();) { ISVNNotifyListener listener = (ISVNNotifyListener) it.next(); listener.logError(line); } } } } ././@LongLink 0000000 0000000 0000000 00000000176 00000000000 011571 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandline/SvnCommandLine12.java libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandl0000644 0000000 0000000 00000010327 10613664631 033034 0 ustar root root /******************************************************************************* * Copyright (c) 2006 svnClientAdapter project and others. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Contributors: * svnClientAdapter project committers - initial API and implementation ******************************************************************************/ package org.tigris.subversion.svnclientadapter.commandline; import org.tigris.subversion.svnclientadapter.ISVNNotifyListener; /** * SvnCommandLine subclass providing features compatible with version 1.2 of svn client. * * @author Martin Letenay */ public class SvnCommandLine12 extends SvnCommandLine { //Constructors SvnCommandLine12(String svnPath,CmdLineNotificationHandler notificationHandler) { super(svnPath,notificationHandler); } /** * info: Display info about a resource. * usage: info [PATH [PATH ... ]] * * Print information about PATHs. * * Valid options: * --targets arg : pass contents of file ARG as additional args * -R [--recursive] : descend recursively * * @param path * @return String with the info call result */ String info(String[] target) throws CmdLineException { if (target.length == 0) { // otherwise we would do a "svn info" without args return ""; } setCommand(ISVNNotifyListener.Command.INFO, false); CmdArguments args = new CmdArguments(); args.add("info"); args.addConfigInfo(this.configDir); for (int i = 0;i < target.length;i++) { args.add(target[i]); } return execString(args,false); } /** ** Print the status of working copy files and directories.
* * @param path Local path of resource to get status of. * @param allEntries if false, only interesting entries will be get (local mods and/or out-of-date). * @param checkUpdates Check for updates on server. */ String statusByStdout(String path[], boolean descend, boolean allEntries, boolean checkUpdates, boolean ignoreExternals) throws CmdLineException { if (path.length == 0) { // otherwise we would do a "svn status" without args return ""; } setCommand(ISVNNotifyListener.Command.STATUS, false); CmdArguments args = new CmdArguments(); args.add("status"); args.add("-v"); if (!allEntries) { args.add("-q"); } if (!descend) args.add("-N"); if (checkUpdates) args.add("-u"); if (allEntries) { args.add("--no-ignore"); // disregard default and svn:ignore property ignores } if (ignoreExternals) { args.add("--ignore-externals"); } for (int i = 0; i < path.length;i++) { args.add(path[i]); } args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); return execString(args,false); } /** * Output the content of specified files or URLs with revision and * author information in-line. * @param path * @param revisionStart * @param revisionEnd * @return String with the annotate data * @throws CmdLineException */ String annotateByStdout(String path,String revisionStart, String revisionEnd) throws CmdLineException { setCommand(ISVNNotifyListener.Command.ANNOTATE, false); CmdArguments args = new CmdArguments(); args.add("annotate"); args.add("-r"); if ((revisionStart != null) && (revisionStart.length() > 0)) { args.add(validRev(revisionStart) + ":" + validRev(revisionEnd)); } else { args.add(validRev(revisionEnd)); } args.add(path); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); return execString(args,false); } } ././@LongLink 0000000 0000000 0000000 00000000175 00000000000 011570 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandline/CmdLineInfoPart.java libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandl0000644 0000000 0000000 00000027245 10613664631 033043 0 ustar root root /******************************************************************************* * Copyright (c) 2004, 2006 svnClientAdapter project and others. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * Contributors: * svnClientAdapter project committers - initial API and implementation ******************************************************************************/ package org.tigris.subversion.svnclientadapter.commandline; import java.io.File; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.StringTokenizer; import org.tigris.subversion.svnclientadapter.ISVNInfo; import org.tigris.subversion.svnclientadapter.SVNNodeKind; import org.tigris.subversion.svnclientadapter.SVNRevision; import org.tigris.subversion.svnclientadapter.SVNScheduleKind; import org.tigris.subversion.svnclientadapter.SVNUrl; import org.tigris.subversion.svnclientadapter.SVNRevision.Number; /** * Represents the infos for one resource in the result of a svn info command * * @author Philip Schatz (schatz at tigris) * @author Cédric Chabanois (cchabanois at no-log.org) */ class CmdLineInfoPart implements ISVNInfo { //"Constants" private static final String KEY_PATH = "Path"; private static final String KEY_URL = "URL"; private static final String KEY_REVISION = "Revision"; private static final String KEY_REPOSITORY = "Repository Root"; private static final String KEY_NODEKIND = "Node Kind"; private static final String KEY_LASTCHANGEDAUTHOR = "Last Changed Author"; private static final String KEY_LASTCHANGEDREV = "Last Changed Rev"; private static final String KEY_LASTCHANGEDDATE = "Last Changed Date"; private static final String KEY_TEXTLASTUPDATED = "Text Last Updated"; private static final String KEY_SCHEDULE = "Schedule"; private static final String KEY_COPIEDFROMURL = "Copied From URL"; private static final String KEY_COPIEDFROMREV = "Copied From Rev"; private static final String KEY_PROPSLASTUPDATED = "Properties Last Updated"; private static final String KEY_REPOSITORYUUID = "Repository UUID"; private static final String KEY_LOCKOWNER = "Lock Owner"; private static final String KEY_LOCKCREATIONDATE = "Lock Created"; private static final String KEY_LOCKCOMMENT = "Lock Comment"; private static final String KEY_CONFLICTING_PREV_BASE = "Conflict Previous Base File"; private static final String KEY_CONFLICTING_PREV_WORKING = "Conflict Previous Working File"; private static final String KEY_CONFLICTING_CURRENT_BASE = "Conflict Current Base File"; //Fields private Map infoMap = new HashMap(); protected boolean unversioned = false; //Constructors /** * Here is two samples for infostring parameter * sample 1 : * ========== * Path: added.txt * Name: added.txt * URL: file:///F:/Programmation/Projets/subversion/svnant/test/test_repos/statusT * st/added.txt * Revision: 0 * Node Kind: file * Schedule: add * Conflict Previous Base File: rho.r1 * Conflict Previous Working File: rho * Conflict Current Base File: rho.r2 * * sample 2 : * =========== * ignored.txt: (Not a versioned resource) */ CmdLineInfoPart(String infoString) { this(); load(infoString); } protected CmdLineInfoPart() { super(); } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLastChangedDate() */ public Date getLastChangedDate() { return (unversioned) ? null : Helper.toDate(get(KEY_LASTCHANGEDDATE)); } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLastChangedRevision() */ public SVNRevision.Number getLastChangedRevision() { return (unversioned) ? null : Helper.toRevNum(get(KEY_LASTCHANGEDREV)); } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNInfo#getLastCommitAuthor() */ public String getLastCommitAuthor() { return (unversioned) ? null : get(KEY_LASTCHANGEDAUTHOR); } public SVNNodeKind getNodeKind() { return (unversioned) ? null : SVNNodeKind.fromString(get(KEY_NODEKIND)); } /** * @return path to this item */ public String getPath() { return get(KEY_PATH); } /** * @return The absolute path to this item. * @see org.tigris.subversion.svnclientadapter.ISVNInfo#getFile() */ public File getFile() { return new File(getPath()).getAbsoluteFile(); } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNInfo#getRevision() */ public SVNRevision.Number getRevision() { return (unversioned) ? SVNRevision.INVALID_REVISION : Helper.toRevNum(get(KEY_REVISION)); } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNInfo#getUrl() */ public SVNUrl getUrl() { return (unversioned) ? null : Helper.toSVNUrl(get(KEY_URL)); } public String getUrlString() { return (unversioned) ? null : get(KEY_URL); } private String get(String key) { Object value = infoMap.get(key); return (value == null) ? null : value.toString(); } private void load(String infoString) { StringTokenizer st = new StringTokenizer(infoString, Helper.NEWLINE); //this does not have to be a versioned resource. //if it is not, the first line will end with // ": (Not a versioned resource)" if (st.countTokens() == 1) { unversioned = true; String line = st.nextToken(); // ### As of Subversion 1.3, this warning message is // ### printed to stderr. Are we ever even going to see // ### this text? //svn info
.
* @return The lines contained by infoLines
as an
* array.
*/
public static String[] parseInfoParts(String infoLines) {
StringTokenizer st = new StringTokenizer(infoLines, Helper.NEWLINE);
String current = null;
List infoParts = new ArrayList(st.countTokens());
while (st.hasMoreTokens()) {
String temp = st.nextToken();
if (temp.startsWith("Path:") ||
temp.endsWith(": (Not a versioned resource)")) {
if (current != null)
infoParts.add(current);
current = temp;
} else {
if (current == null)
current = temp;
else
current += "\n" + temp;
}
}
if (current != null)
infoParts.add(current);
String[] infoArray = new String[infoParts.size()];
infoParts.toArray(infoArray);
return infoArray;
}
/**
* Factory method. Constructs unersioned info part for the give path
* @param path
* @return a new instance of CmdLineInfoPartUnversioned.
*/
public static CmdLineInfoPart createUnversioned(String path)
{
return new CmdLineInfoPartUnversioned(path);
}
protected static class CmdLineInfoPartUnversioned extends CmdLineInfoPart
{
private String path;
protected CmdLineInfoPartUnversioned(String path)
{
super();
this.path = path;
this.unversioned = true;
}
public String getPath() {
return path;
}
}
}
././@LongLink 0000000 0000000 0000000 00000000201 00000000000 011556 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandline/CmdLineNotifyStatus.java libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandl0000644 0000000 0000000 00000003776 10613664631 033046 0 ustar root root /*******************************************************************************
* Copyright (c) 2005, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.commandline;
/**
* status of the text or the property of the item triggering the notification
*/
public interface CmdLineNotifyStatus
{
/** It not applicable*/
public static final int inapplicable = 0;
/** Notifier doesn't know or isn't saying. */
public static final int unknown = 1;
/** The state did not change. */
public static final int unchanged = 2;
/** The item wasn't present. */
public static final int missing = 3;
/** An unversioned item obstructed work. */
public static final int obstructed = 4;
/** Pristine state was modified. */
public static final int changed = 5;
/** Modified state had mods merged in. */
public static final int merged = 6;
/** Modified state got conflicting mods. */
public static final int conflicted = 7;
/**
* the textual represention for the status types
*/
public static final String[] statusNames =
{
"inapplicable",
"unknown",
"unchanged",
"missing",
"obstructed",
"changed",
"merged",
"conflicted",
};
}
././@LongLink 0000000 0000000 0000000 00000000175 00000000000 011570 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandline/CmdLineProperty.java libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandl0000644 0000000 0000000 00000004530 10613664631 033033 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.commandline;
import java.io.File;
import org.tigris.subversion.svnclientadapter.ISVNProperty;
import org.tigris.subversion.svnclientadapter.SVNUrl;
/**
*
* @author Philip Schatz (schatz at tigris)
*/
class CmdLineProperty implements ISVNProperty {
private String propName;
private String propValue;
private File file;
private SVNUrl url;
private byte[] data;
CmdLineProperty(String name, String value, File file, byte[] data) {
this.propName = name;
this.propValue = value;
this.url = null;
this.file = file.getAbsoluteFile();
this.data = data;
}
CmdLineProperty(String name, String value, SVNUrl url, byte[] data) {
this.propName = name;
this.propValue = value;
this.url = url;
this.file = null;
this.data = data;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNProperty#getName()
*/
public String getName() {
return propName;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNProperty#getValue()
*/
public String getValue() {
return propValue;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNProperty#getFile()
*/
public File getFile() {
return file;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNProperty#getUrl()
*/
public SVNUrl getUrl() {
return url;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNProperty#getData()
*/
public byte[] getData() {
return data;
}
}
././@LongLink 0000000 0000000 0000000 00000000171 00000000000 011564 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandline/CommandLine.java libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandl0000644 0000000 0000000 00000041020 10613664631 033026 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.commandline;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer;
/**
* Common superclass for both SvnCommandLine and SvnAdminCommandLine
*
* @author Philip Schatz (schatz at tigris)
* @author Cédric Chabanois (cchabanois at no-log.org)
* @author Daniel Rall
*/
abstract class CommandLine {
protected String commandName;
protected CmdLineNotificationHandler notificationHandler;
protected Process process;
protected CommandLine(String commandName, CmdLineNotificationHandler notificationHandler) {
this.commandName = commandName;
this.notificationHandler = notificationHandler;
}
String version() throws CmdLineException {
CmdArguments args = new CmdArguments();
args.add("--version");
return execString(args,false);
}
/**
* Executes the given svn command and returns the corresponding
* Process
object.
*
* @param svnArguments The command-line arguments to execute.
*/
private Process execProcess(CmdArguments svnArguments)
throws CmdLineException {
// We add "svn" or "svnadmin" to the arguments (as
// appropriate), and convert it to an array of strings.
int svnArgsLen = svnArguments.size();
String[] cmdline = new String[svnArgsLen + 1];
cmdline[0] = commandName;
StringBuffer svnCommand = new StringBuffer();
boolean nextIsPassword = false;
for (int i = 0; i < svnArgsLen; i++) {
if (i != 0)
svnCommand.append(' ');
Object arg = svnArguments.get(i);
if (arg != null)
arg = arg.toString();
if ("".equals(arg)) {
arg = "\"\"";
}
if (nextIsPassword) {
// Avoid showing the password on the console.
svnCommand.append("*******");
nextIsPassword = false;
} else {
svnCommand.append(arg);
}
if ("--password".equals(arg)) {
nextIsPassword = true;
}
// Regardless of the data type passed in via svnArguments,
// at this point we expect to have a String object.
cmdline[i + 1] = (String) arg;
}
notificationHandler.logCommandLine(svnCommand.toString());
// Run the command, and return the associated Process object.
try {
return process = Runtime.getRuntime().exec(cmdline, getEnvironmentVariables());
} catch (IOException e) {
throw new CmdLineException(e);
}
}
/**
* Get environment variables to be set when invoking the command-line.
* Includes LANG
and LC_ALL
so Subversion's output is not localized.
* Systemroot
is required on windows platform.
* Without this variable present, the windows' DNS resolver does not work.
* APR_ICONV_PATH
is required on windows platform for UTF-8 translation.
* The PATH
is there, well, just to be sure ;-)
*/
protected String[] getEnvironmentVariables()
{
final String path = CmdLineClientAdapter.getEnvironmentVariable("PATH");
final String systemRoot = CmdLineClientAdapter.getEnvironmentVariable("SystemRoot");
final String aprIconv = CmdLineClientAdapter.getEnvironmentVariable("APR_ICONV_PATH");
int i = 3;
if (path != null)
i++;
if (systemRoot != null)
i++;
if (aprIconv != null)
i++;
String[] lcVars = getLocaleVariables();
String[] env = new String[i + lcVars.length];
i = 0;
//Clear the LC_ALL, we're going to override the LC_MESSAGES and LC_TIME
env[i] = "LC_ALL=";
i++;
//Set the LC_MESSAGES to "C" to avoid translated svn output. (We're parsing the english one)
env[i] = "LC_MESSAGES=C";
i++;
env[i] = "LC_TIME=C";
i++;
if (path != null) {
env[i] = "PATH=" + path;
i++;
}
if (systemRoot != null) {
env[i] = "SystemRoot=" + systemRoot;
i++;
}
if (aprIconv != null) {
env[i] = "APR_ICONV_PATH=" + aprIconv;
i++;
}
//Add the remaining LC vars
for (int j = 0; j < lcVars.length; j++) {
env[i] = lcVars[j];
i++;
}
return env;
}
private String[] getLocaleVariables()
{
String LC_ALL = CmdLineClientAdapter.getEnvironmentVariable("LC_ALL");
if ((LC_ALL == null) || (LC_ALL.length() == 0)) {
LC_ALL = CmdLineClientAdapter.getEnvironmentVariable("LANG");
if (LC_ALL == null) {
LC_ALL="";
}
}
final String[] lcVarNames = new String[] {
"LC_CTYPE",
"LC_NUMERIC",
"LC_COLLATE",
"LC_MONETARY",
"LC_PAPER",
"LC_NAME",
"LC_ADDRESS",
"LC_TELEPHONE",
"LC_MEASUREMENT",
"LC_IDENTIFICATION" };
List variables = new ArrayList(lcVarNames.length);
for (int i = 0; i < lcVarNames.length; i++) {
String varValue = CmdLineClientAdapter.getEnvironmentVariable(lcVarNames[i]);
variables.add(lcVarNames[i] + "=" + ((varValue != null) ? varValue : LC_ALL));
}
return (String[]) variables.toArray(new String[variables.size()]);
}
/**
* Pumps the output from both provided streams, blocking until
* complete.
*
* @param proc
* @param outPumper The process output stream.
* @param outPumper The process error stream.
*/
private void pumpProcessStreams(Process proc, StreamPumper outPumper,
StreamPumper errPumper) {
new Thread(outPumper).start();
new Thread(errPumper).start();
try {
outPumper.waitFor();
errPumper.waitFor();
} catch (InterruptedException ignored) {
notificationHandler.logError("Command output processing interrupted !");
} finally {
try {
proc.getInputStream().close();
proc.getOutputStream().close();
proc.getErrorStream().close();
} catch (IOException ioex) {
//Just ignore. Exception when closing the stream.
}
}
}
/**
* Runs the process and returns the results.
*
* @param svnArguments The command-line arguments to execute.
* @param coalesceLines
* @return Any output returned from execution of the command-line.
*/
protected String execString(CmdArguments svnArguments, boolean coalesceLines)
throws CmdLineException {
Process proc = execProcess(svnArguments);
StreamPumper outPumper =
new CharacterStreamPumper(proc.getInputStream(), coalesceLines);
StreamPumper errPumper =
new CharacterStreamPumper(proc.getErrorStream(), false);
pumpProcessStreams(proc, outPumper, errPumper);
try {
String errMessage = errPumper.toString();
if (errMessage.length() > 0) {
throw new CmdLineException(errMessage);
}
String outputString = outPumper.toString();
notifyFromSvnOutput(outputString);
return outputString;
} catch (CmdLineException e) {
notificationHandler.logException(e);
throw e;
}
}
/**
* Runs the process and returns the results.
* @param svnArguments The arguments to pass to the command-line
* binary.
* @param assumeUTF8 Whether the output of the command should be
* treated as UTF-8 (as opposed to the JVM's default encoding).
* @return String
*/
protected byte[] execBytes(CmdArguments svnArguments, boolean assumeUTF8)
throws CmdLineException {
Process proc = execProcess(svnArguments);
ByteStreamPumper outPumper =
new ByteStreamPumper(proc.getInputStream());
StreamPumper errPumper =
new CharacterStreamPumper(proc.getErrorStream(), false);
pumpProcessStreams(proc, outPumper, errPumper);
try {
String errMessage = errPumper.toString();
if (errMessage.length() > 0) {
throw new CmdLineException(errMessage);
}
byte[] bytes = outPumper.getBytes();
String notifyMessage = "";
if (assumeUTF8) {
try {
notifyMessage = new String(bytes, "UTF-8");
} catch (UnsupportedEncodingException e) {
// It is guaranteed to be there!
}
} else {
// This uses the default charset, which is likely
// wrong if we are trying to get the bytes, anyway...
notifyMessage = new String(bytes);
}
notifyFromSvnOutput(notifyMessage);
return bytes;
} catch (CmdLineException e) {
notificationHandler.logException(e);
throw e;
}
}
/**
* runs the command (returns nothing)
* @param svnArguments
* @throws CmdLineException
*/
protected void execVoid(CmdArguments svnArguments) throws CmdLineException {
execString(svnArguments,false);
}
//TODO check the deprecation
/**
* Runs the process and returns the results.
* @param svnArguments The arguments to pass to the command-line
* binary.
* @return the InputStream on commads result. Caller has to close it explicitelly().
* @deprecated this does not sound as a good idea. Check if we're able to live without it.
*/
protected InputStream execInputStream(CmdArguments svnArguments)
throws CmdLineException {
Process proc = execProcess(svnArguments);
try {
proc.getOutputStream().close();
proc.getErrorStream().close();
//InputStream has to be closed by caller !
} catch (IOException ioex) {
//Just ignore. Exception when closing the stream.
}
return proc.getInputStream();
}
/**
* notify the listeners from the output. This is the default implementation
*
* @param svnOutput
*/
protected void notifyFromSvnOutput(String svnOutput) {
StringTokenizer st = new StringTokenizer(svnOutput, Helper.NEWLINE);
int size = st.countTokens();
//do everything but the last line
for (int i = 1; i < size; i++) {
notificationHandler.logMessage(st.nextToken());
}
//log the last line as the completed message.
if (size > 0)
notificationHandler.logCompleted(st.nextToken());
}
protected void stopProcess() {
try {
process.getInputStream().close();
process.getOutputStream().close();
process.getErrorStream().close();
} catch (IOException ioex) {
//Just ignore. Closing streams.
}
process.destroy();
}
/**
* Pulls all the data out of a stream. Inspired by Ant's
* StreamPumper (by Robert Field).
*/
private static abstract class StreamPumper implements Runnable {
private boolean finished;
/**
* Constructor
*
*/
protected StreamPumper()
{
super();
}
/**
* Copies data from the input stream to the internal buffer.
* Terminates as soon as the input stream is closed, or an
* error occurs.
*/
public void run() {
synchronized (this) {
// Just in case this object is reused in the future.
this.finished = false;
}
try {
pumpStream();
} finally {
synchronized (this) {
this.finished = true;
notify();
}
}
}
/**
* Called by {@link #run()} to pull the data out of the
* stream.
*/
protected abstract void pumpStream();
/**
* Tells whether the end of the stream has been reached.
* @return true is the stream has been exhausted.
**/
public synchronized boolean isFinished() {
return this.finished;
}
/**
* This method blocks until the stream pumper finishes.
* @see #isFinished()
* @throws InterruptedException
**/
public synchronized void waitFor()
throws InterruptedException {
while (!isFinished()) {
wait();
}
}
}
/** Extracts character data from streams. */
private static class CharacterStreamPumper extends StreamPumper {
private BufferedReader reader;
private StringBuffer sb = new StringBuffer();
private boolean coalesceLines = false;
/**
* @param is Input stream from which to read the data.
* @param coalesceLines Whether to coalesce lines.
*/
public CharacterStreamPumper(InputStream is, boolean coalesceLines) {
this.reader = new BufferedReader(new InputStreamReader(is));
this.coalesceLines = coalesceLines;
}
/**
* Copies data from the input stream to the internal string
* buffer.
*/
protected void pumpStream() {
try {
String line;
while ((line = this.reader.readLine()) != null) {
if (this.coalesceLines) {
this.sb.append(line);
} else {
this.sb.append(line).append(Helper.NEWLINE);
}
}
} catch (IOException ex) {
System.err
.println("Problem occured during fetching the command output: "
+ ex.getMessage());
} finally {
try {
reader.close();
} catch (IOException e) {
// Exception during closing the stream. Just ignore.
}
}
}
public synchronized String toString() {
return this.sb.toString();
}
}
/** Extracts byte data from streams. */
private static class ByteStreamPumper extends StreamPumper {
private InputStream bis;
private ByteArrayOutputStream bytes = new ByteArrayOutputStream();
private final static int BUFFER_LENGTH = 1024;
private byte[] inputBuffer = new byte[BUFFER_LENGTH];
/**
* Create a new stream pumper.
*
* @param is input stream to read data from
*/
public ByteStreamPumper(InputStream is) {
this.bis = is;
}
/**
* Copies data from the input stream to the string buffer
*
* Terminates as soon as the input stream is closed or an error occurs.
*/
protected void pumpStream() {
try {
int bytesRead;
while ((bytesRead = this.bis.read(this.inputBuffer)) != -1) {
this.bytes.write(this.inputBuffer, 0, bytesRead);
}
} catch (IOException ex) {
System.err
.println("Problem occured during fetching the command output: "
+ ex.getMessage());
} finally {
try {
this.bytes.flush();
this.bytes.close();
this.bis.close();
} catch (IOException e) {
// Exception during closing the stream. Just ignore.
}
}
}
/**
* @return A byte array contaning the raw bytes read from the input
* stream.
*/
public synchronized byte[] getBytes() {
return bytes.toByteArray();
}
}
protected static class CmdArguments
{
private List args = new ArrayList();
protected void add(Object arg)
{
this.args.add(arg);
}
protected void addAuthInfo(String user, String pass) {
if (user != null && user.length() > 0) {
add("--username");
add(user);
}
if (pass != null && pass.length() > 0) {
add("--password");
add(pass);
}
add("--non-interactive");
}
protected void addConfigInfo(String configDir) {
if (configDir != null) {
add("--config-dir");
add(configDir);
}
}
protected void addLogMessage(String message) {
add("--force-log");
add("-m");
add((message != null) ? message : "");
}
private int size()
{
return this.args.size();
}
private Object get(int index)
{
return this.args.get(index);
}
}
}
././@LongLink 0000000 0000000 0000000 00000000201 00000000000 011556 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandline/SvnAdminCommandLine.java libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandl0000644 0000000 0000000 00000003327 10613664631 033036 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.commandline;
import org.tigris.subversion.svnclientadapter.ISVNNotifyListener;
/**
* Call svnadmin
*
* @author Cédric Chabanois (cchabanois at no-log.org)
*/
public class SvnAdminCommandLine extends CommandLine {
//Constructors
SvnAdminCommandLine(String svnPath,CmdLineNotificationHandler notificationHandler) {
super(svnPath,notificationHandler);
}
/**
* Create a new, empty repository at path
*
*/
void create(String path, String repositoryType) throws CmdLineException {
notificationHandler.setCommand(ISVNNotifyListener.Command.CREATE_REPOSITORY);
CmdArguments args = new CmdArguments();
args.add("create");
if (repositoryType != null) {
// repository type is for svnadmin >= 1.1
args.add("--fs-type");
args.add(repositoryType);
}
args.add(path);
execVoid(args);
}
}
././@LongLink 0000000 0000000 0000000 00000000202 00000000000 011557 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandline/CmdLineClientAdapter.java libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandl0000644 0000000 0000000 00000205552 11035737627 033047 0 ustar root root /*******************************************************************************
* Copyright (c) 2003, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.commandline;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.Vector;
import org.tigris.subversion.svnclientadapter.AbstractClientAdapter;
import org.tigris.subversion.svnclientadapter.ISVNAnnotations;
import org.tigris.subversion.svnclientadapter.ISVNConflictResolver;
import org.tigris.subversion.svnclientadapter.ISVNDirEntry;
import org.tigris.subversion.svnclientadapter.ISVNInfo;
import org.tigris.subversion.svnclientadapter.ISVNLogMessage;
import org.tigris.subversion.svnclientadapter.ISVNLogMessageCallback;
import org.tigris.subversion.svnclientadapter.ISVNMergeInfo;
import org.tigris.subversion.svnclientadapter.ISVNNotifyListener;
import org.tigris.subversion.svnclientadapter.ISVNProgressListener;
import org.tigris.subversion.svnclientadapter.ISVNProperty;
import org.tigris.subversion.svnclientadapter.ISVNStatus;
import org.tigris.subversion.svnclientadapter.SVNBaseDir;
import org.tigris.subversion.svnclientadapter.SVNClientException;
import org.tigris.subversion.svnclientadapter.SVNDiffSummary;
import org.tigris.subversion.svnclientadapter.SVNNotificationHandler;
import org.tigris.subversion.svnclientadapter.SVNRevision;
import org.tigris.subversion.svnclientadapter.SVNRevisionRange;
import org.tigris.subversion.svnclientadapter.SVNScheduleKind;
import org.tigris.subversion.svnclientadapter.SVNStatusUnversioned;
import org.tigris.subversion.svnclientadapter.SVNUrl;
/**
* * Implements a ISVNClientAdapter using the * Command line client. This expects the svn * executible to be in the path.
* * @author Philip Schatz (schatz at tigris) * @author C~dric Chabanois (cchabanois at no-log.org) */ public class CmdLineClientAdapter extends AbstractClientAdapter { //Fields final protected CmdLineNotificationHandler notificationHandler; final protected SvnCommandLine _cmd; final protected SvnMultiArgCommandLine _cmdMulti; final protected SvnAdminCommandLine svnAdminCmd; protected String version = null; private static boolean availabilityCached = false; private static boolean available; private static String dirName; public CmdLineClientAdapter(CmdLineNotificationHandler notificationHandler) { this(notificationHandler, new SvnCommandLine("svn", notificationHandler), new SvnMultiArgCommandLine("svn", notificationHandler), new SvnAdminCommandLine("svnadmin", notificationHandler)); } protected CmdLineClientAdapter(CmdLineNotificationHandler notificationHandler, SvnCommandLine cmd, SvnMultiArgCommandLine multiCmd, SvnAdminCommandLine adminCmd) { super(); this.notificationHandler = notificationHandler; this._cmd = cmd; this._cmdMulti = multiCmd; this.svnAdminCmd = adminCmd; } public boolean isThreadsafe() { return false; } //Methods public static boolean isAvailable() { // availabilityCached flag must be reset if location of client changes if (!availabilityCached) { // this will need to be fixed when path to svn will be customizable SvnCommandLine cmd = new SvnCommandLine("svn", new CmdLineNotificationHandler()); try { String version = cmd.version(); int i = version.indexOf(System.getProperty("line.separator")); // NOI18N version = version.substring(0,i); available = true; available &= version.indexOf("version 0.") == -1; available &= version.indexOf("version 1.0") == -1; available &= version.indexOf("version 1.1") == -1; available &= version.indexOf("version 1.2") == -1; } catch (Exception e) { e.printStackTrace(); available = false; } availabilityCached = true; } return available; } /** * @return something like "svn, version 0.35.1 (r8050)" * @throws SVNClientException */ public String getVersion() throws SVNClientException { if (version != null) return version; try { // we don't want to log this ... notificationHandler.disableLog(); version = _cmd.version(); int i = version.indexOf(System.getProperty("line.separator")); // NOI18N version = version.substring(0,i); return version; } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } finally { notificationHandler.enableLog(); } } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#addNotifyListener(org.tigris.subversion.subclipse.client.ISVNClientNotifyListener) */ public void addNotifyListener(ISVNNotifyListener listener) { notificationHandler.add(listener); } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#removeNotifyListener(org.tigris.subversion.subclipse.client.ISVNClientNotifyListener) */ public void removeNotifyListener(ISVNNotifyListener listener) { notificationHandler.remove(listener); } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getNotificationHandler() */ public SVNNotificationHandler getNotificationHandler() { return notificationHandler; } private boolean isManaged(File file) { if (file.isDirectory()) { return isManagedDir(file.getParentFile()) || isManagedDir(file); } else { return isManagedDir(file.getParentFile()); } } private boolean isManagedDir(File dir) { // all directories that do not have a .svn dir are not versioned File entries = new File(dir, getAdminDirectoryName() + "/entries"); return entries.exists(); } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#getStatus(java.io.File[]) */ public ISVNStatus[] getStatus(File[] files) throws SVNClientException { ISVNStatus[] statuses = new ISVNStatus[files.length]; // all files (and dirs) that are in nonmanaged dirs are unversioned ArrayList pathsList = new ArrayList(); for (int i = 0; i < files.length;i++) { File file = files[i]; if (isManaged(file)) { pathsList.add(toString(file)); } else { statuses[i] = new SVNStatusUnversioned(file,false); } } String[] paths = (String[])pathsList.toArray(new String[pathsList.size()]); // we must do a svn status and svn info only on resources that are in versioned dirs // because otherwise svn will stop after the first "svn: 'resource' is not a working copy" CmdLineStatuses cmdLineStatuses; try { CmdLineStatusPart[] cmdLineStatusParts = getCmdStatuses(paths, false, true, false, false); List targetsInfo = new ArrayList(cmdLineStatusParts.length); for (int i = 0; i < cmdLineStatusParts.length;i++) { if (cmdLineStatusParts[i].isManaged()) { targetsInfo.add(cmdLineStatusParts[i].getFile().toString()); } } String cmdLineInfoStrings = _cmd.info((String[]) targetsInfo.toArray(new String[targetsInfo.size()] ), null, null); cmdLineStatuses = new CmdLineStatuses(cmdLineInfoStrings, cmdLineStatusParts); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } for (int i = 0; i < cmdLineStatuses.size();i++) { ISVNStatus status = cmdLineStatuses.get(i); for (int j=0; j < files.length;j++) { if (files[j].getAbsoluteFile().equals(status.getFile())) { statuses[j] = status; } } } for (int i = 0; i < statuses.length; i++) { if (statuses[i] == null) { statuses[i] = new SVNStatusUnversioned(files[i],false); } } return statuses; } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getSingleStatus(java.io.File) */ public ISVNStatus getSingleStatus(File path) throws SVNClientException { return getStatus(new File[] {path})[0]; } private ISVNDirEntry[] getList(String target, SVNRevision rev, boolean recursive) throws SVNClientException { byte[] listXml; try { listXml = _cmd.list(target, toString(rev), recursive); return CmdLineRemoteDirEntry.createDirEntries(listXml); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#getList(java.net.URL, org.tigris.subversion.subclipse.client.ISVNRevision, boolean) */ public ISVNDirEntry[] getList(SVNUrl svnUrl, SVNRevision revision, boolean recurse) throws SVNClientException { return getList(toString(svnUrl), revision, recurse); } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getList(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, boolean) */ public ISVNDirEntry[] getList(File path, SVNRevision revision, boolean recurse) throws SVNClientException { return getList(toString(path), revision, recurse); } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getDirEntry(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision) */ public ISVNDirEntry getDirEntry(SVNUrl url, SVNRevision revision) throws SVNClientException { // list give the DirEntrys of the elements of a directory or the DirEntry // of a file ISVNDirEntry[] entries = getList(url.getParent(),revision,false); String expectedPath = url.getLastPathSegment(); for (int i = 0; i < entries.length;i++) { if (entries[i].getPath().equals(expectedPath)) { return entries[i]; } } return null; // not found } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getDirEntry(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision) */ public ISVNDirEntry getDirEntry(File path, SVNRevision revision) throws SVNClientException { // list give the DirEntrys of the elements of a directory or the DirEntry // of a file ISVNDirEntry[] entries = getList(path.getParentFile(),revision,false); String expectedPath = path.getName(); for (int i = 0; i < entries.length;i++) { if (entries[i].getPath().equals(expectedPath)) { return entries[i]; } } return null; // not found } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#remove(java.io.File[], boolean) */ public void remove(File[] files, boolean force) throws SVNClientException { String[] paths = new String[files.length]; try { for (int i = 0; i < files.length; i++) { paths[i] = files[i].toString(); } _cmd.delete(paths, null,force); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#revert(java.io.File, boolean) */ public void revert(File file, boolean recursive) throws SVNClientException { try { notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(file)); _cmd.revert(new String[] { toString(file) }, recursive); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#getContent(java.net.SVNUrl, org.tigris.subversion.subclipse.client.ISVNRevision) */ public InputStream getContent(SVNUrl arg0, SVNRevision arg1) throws SVNClientException { try { InputStream content = _cmd.cat(toString(arg0), toString(arg1)); //read byte-by-byte and put it in a vector. //then take the vector and fill a byteArray. byte[] byteArray; byteArray = streamToByteArray(content); content.close(); return new ByteArrayInputStream(byteArray); } catch (IOException e) { throw SVNClientException.wrapException(e); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getContent(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision) */ public InputStream getContent(File path, SVNRevision revision) throws SVNClientException { try { InputStream content = _cmd.cat(toString(path), toString(revision)); //read byte-by-byte and put it in a vector. //then take the vector and fill a byteArray. byte[] byteArray; byteArray = streamToByteArray(content); content.close(); return new ByteArrayInputStream(byteArray); } catch (IOException e) { throw SVNClientException.wrapException(e); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#mkdir(java.net.URL, java.lang.String) */ public void mkdir(SVNUrl arg0, String arg1) throws SVNClientException { try { _cmd.mkdir(toString(arg0), arg1); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#remove(java.net.URL[], java.lang.String) */ public void remove(SVNUrl[] urls, String message) throws SVNClientException { String[] urlsStrings = new String[urls.length]; for (int i = 0; i < urls.length; i++) { urlsStrings[i] = urls[i].toString(); } try { _cmd.delete(urlsStrings, message,false); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#copy(java.net.URL, java.net.URL, java.lang.String, org.tigris.subversion.subclipse.client.ISVNRevision) */ public void copy(SVNUrl src, SVNUrl dest, String message, SVNRevision rev) throws SVNClientException { try { if (message == null) message = ""; _cmd.copy(toString(src), toString(dest), message, toString(rev)); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#copy(java.io.File, java.io.File) */ public void copy(File srcPath, File destPath) throws SVNClientException { try { _cmd.copy(toString(srcPath), toString(destPath)); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } //sometimes the dir has not yet been created. //wait up to 5 sec for the dir to be created. for (int i = 0; i < 50 && !destPath.exists(); i++) { try { Thread.sleep(100); } catch (InterruptedException e2) { //do nothing if interrupted } } } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#move(java.net.URL, java.net.URL, java.lang.String, org.tigris.subversion.subclipse.client.ISVNRevision) */ public void move(SVNUrl url, SVNUrl destUrl, String message, SVNRevision revision) throws SVNClientException { try { notificationHandler.setBaseDir(new File(".")); _cmd.move(toString(url), toString(destUrl), message, toString(revision), false); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#move(java.io.File, java.io.File, boolean) */ public void move(File file, File file2, boolean force) throws SVNClientException { try { notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(new File[] {file,file2})); _cmd.move(toString(file), toString(file2), null, null, force); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#setUsername(java.lang.String) */ public void setUsername(String string) { if (string == null || string.length() == 0) return; _cmd.setUsername(string); } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#setPassword(java.lang.String) */ public void setPassword(String password) { if (password == null) return; _cmd.setPassword(password); } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#addDirectory(java.io.File, boolean) */ public void addDirectory(File file, boolean recurse) throws SVNClientException { addDirectory(file, recurse, false); } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#addDirectory(java.io.File, boolean, boolean) */ public void addDirectory(File file, boolean recurse, boolean force) throws SVNClientException { try { notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(file)); _cmd.add(toString(file), recurse, force); } catch (CmdLineException e) { //if something is already in svn and we //try to add it, we get a warning. //ignore it.\ if (e.getMessage().startsWith("svn: warning: ")) return; throw SVNClientException.wrapException(e); } } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#addFile(java.io.File) */ public void addFile(File file) throws SVNClientException { try { notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(file)); _cmd.add(toString(file), false, false); } catch (CmdLineException e) { //if something is already in svn and we //try to add it, we get a warning. //ignore it.\ if (e.getMessage().startsWith("svn: warning: ")) return; throw SVNClientException.wrapException(e); } } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#commit(java.io.File[], java.lang.String, boolean) */ public long commit(File[] parents, String comment, boolean recurse) throws SVNClientException { return commit(parents, comment, recurse , false); } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#commit(java.io.File[], java.lang.String, boolean, boolean) */ public long commit(File[] parents, String comment, boolean recurse, boolean keepLocks) throws SVNClientException { String[] paths = new String[parents.length]; for (int i = 0; i < parents.length; i++) { paths[i] = toString(parents[i]); } try { notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(parents)); _cmd.checkin(paths, comment, keepLocks); return _cmd.getRevision(); } catch (CmdLineException e) { if ("".equals(e.getMessage())) return SVNRevision.SVN_INVALID_REVNUM; if (e.getMessage().startsWith("svn: Attempted to lock an already-locked dir")) { //PHIL is this the best way to handle pending locks? (ie caused by "svn cp") //loop through up to 5 sec, waiting for locks //to be removed. for (int i = 0; i < 50; i++) { try { notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(parents)); _cmd.checkin(paths, comment, keepLocks); return _cmd.getRevision(); } catch (CmdLineException e1) { try { Thread.sleep(100); } catch (InterruptedException e2) { //do nothing if interrupted } } } } throw SVNClientException.wrapException(e); } } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#update(java.io.File, org.tigris.subversion.subclipse.client.ISVNRevision, boolean) */ public long update(File file, SVNRevision revision, boolean b) throws SVNClientException { try { notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(file)); _cmd.update(toString(file), toString(revision)); return _cmd.getRevision(); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#update(java.io.File[], org.tigris.subversion.svnclientadapter.SVNRevision, boolean, boolean) */ public long[] update(File[] files, SVNRevision revision, boolean recurse, boolean ignoreExternals) throws SVNClientException { try { notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(files[0])); _cmdMulti.update(toString(files), toString(revision)); return _cmdMulti.getRevisions(); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* (non-Javadoc) * @see org.tigris.subversion.subclipse.client.ISVNClientAdapter#checkout(java.net.URL, java.io.File, org.tigris.subversion.subclipse.client.ISVNRevision, boolean) */ public void checkout(SVNUrl url, File destPath, SVNRevision revision, boolean b) throws SVNClientException { try { notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(destPath)); _cmd.checkout(toString(url), toString(destPath), toString(revision), b); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getStatus(java.io.File, boolean, boolean) */ public ISVNStatus[] getStatus(File path, boolean descend, boolean getAll) throws SVNClientException { return getStatus(path, descend, getAll, false); } protected CmdLineStatusPart[] getCmdStatuses(File[] paths, boolean descend, boolean getAll, boolean contactServer, boolean ignoreExternals) throws CmdLineException { String[] pathNames = new String[paths.length]; for (int i = 0; i < pathNames.length; i++) { pathNames[i] = toString(paths[i]); } return getCmdStatuses(pathNames, descend, getAll, contactServer, ignoreExternals); } protected CmdLineStatusPart[] getCmdStatuses(String[] paths, boolean descend, boolean getAll, boolean contactServer, boolean ignoreExternals) throws CmdLineException { if (paths.length == 0) { return new CmdLineStatusPart[0]; } byte[] listXml; listXml = _cmd.status(paths, descend, getAll, contactServer, ignoreExternals); return CmdLineStatusPart.CmdLineStatusPartFromXml.createStatusParts(listXml); } private void diff( String oldPath, SVNRevision oldPathRevision, String newPath, SVNRevision newPathRevision, File outFile, boolean recurse, boolean ignoreAncestry, boolean noDiffDeleted, boolean force) throws SVNClientException { if (newPath == null) newPath = oldPath; if (oldPathRevision == null) oldPathRevision = SVNRevision.BASE; if (newPathRevision == null) newPathRevision = SVNRevision.WORKING; try { InputStream is = _cmd.diff( oldPath, toString(oldPathRevision), newPath, toString(newPathRevision), recurse, ignoreAncestry, noDiffDeleted, force); streamToFile(is, outFile); is.close(); } catch (IOException e) { //this should never happen } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#diff(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, boolean) */ public void diff( File oldPath, SVNRevision oldPathRevision, File newPath, SVNRevision newPathRevision, File outFile, boolean recurse) throws SVNClientException { if (oldPath == null) oldPath = new File("."); diff(oldPath, oldPathRevision, newPath, newPathRevision, outFile, recurse, true, false, false); } public void diff( File oldPath, SVNRevision oldPathRevision, File newPath, SVNRevision newPathRevision, File outFile, boolean recurse, boolean ignoreAncestry, boolean noDiffDeleted, boolean force) throws SVNClientException { if (oldPath == null) oldPath = new File("."); diff( toString(oldPath), oldPathRevision, toString(newPath), newPathRevision, outFile, recurse, ignoreAncestry, noDiffDeleted, force); } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#diff(java.io.File, java.io.File, boolean) */ public void diff(File path, File outFile, boolean recurse) throws SVNClientException { diff(path, null, null, null, outFile, recurse); } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#diff(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, boolean) */ public void diff( SVNUrl oldUrl, SVNRevision oldUrlRevision, SVNUrl newUrl, SVNRevision newUrlRevision, File outFile, boolean recurse) throws SVNClientException { diff(oldUrl, oldUrlRevision, newUrl, newUrlRevision, outFile, recurse, true, false, false); } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#diff(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, boolean, boolean, boolean, boolean) */ public void diff( SVNUrl oldUrl, SVNRevision oldUrlRevision, SVNUrl newUrl, SVNRevision newUrlRevision, File outFile, boolean recurse, boolean ignoreAncestry, boolean noDiffDeleted, boolean force) throws SVNClientException { diff(toString(oldUrl), oldUrlRevision, toString(newUrl), newUrlRevision, outFile, recurse, ignoreAncestry, noDiffDeleted, force); } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#diff(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, boolean) */ public void diff( SVNUrl url, SVNRevision oldUrlRevision, SVNRevision newUrlRevision, File outFile, boolean recurse) throws SVNClientException { diff(url, oldUrlRevision, url, newUrlRevision, outFile, recurse); } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#propertyGet(java.io.File, java.lang.String) */ public ISVNProperty propertyGet(File path, String propertyName) throws SVNClientException { try { InputStream valueAndData = _cmd.propget(toString(path), propertyName); byte[] bytes = streamToByteArray(valueAndData); valueAndData.close(); if (bytes.length == 0) { return null; // the property does not exist } return new CmdLineProperty(propertyName, new String(bytes), path, bytes); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } catch (IOException e) { throw SVNClientException.wrapException(e); } } public ISVNProperty propertyGet(SVNUrl url, String propertyName) throws SVNClientException { try { InputStream valueAndData = _cmd.propget(url.toString(), propertyName); byte[] bytes = streamToByteArray(valueAndData); valueAndData.close(); if (bytes.length == 0) { return null; // the property does not exist } return new CmdLineProperty(propertyName, new String(bytes), url, bytes); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } catch (IOException e) { throw SVNClientException.wrapException(e); } } public ISVNProperty propertyGet(SVNUrl url, SVNRevision revision, SVNRevision peg, String propertyName) throws SVNClientException { try { InputStream valueAndData = _cmd.propget(url.toString(), propertyName, toString(revision), toString(peg)); byte[] bytes = streamToByteArray(valueAndData); if (bytes.length == 0) { return null; // the property does not exist } return new CmdLineProperty(propertyName, new String(bytes), url, bytes); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } catch (IOException e) { throw SVNClientException.wrapException(e); } } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#propertySet(java.io.File, java.lang.String, java.io.File, boolean) */ public void propertySet(File path, String propertyName, File propertyFile, boolean recurse) throws SVNClientException, IOException { try { _cmd.propsetFile(propertyName, toString(propertyFile), toString(path), recurse); // there is no notification (Notify.notify is not called) when we set a property // so we will do notification ourselves ISVNStatus[] statuses = getStatus(path,recurse,false); for (int i = 0; i < statuses.length;i++) { notificationHandler.notifyListenersOfChange(statuses[i].getFile().getAbsolutePath()); } } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#propertyDel(java.io.File, java.lang.String, boolean) */ public void propertyDel(File path, String propertyName, boolean recurse) throws SVNClientException { try { _cmd.propdel(propertyName, toString(path), recurse); // there is no notification (Notify.notify is not called) when we delete a property // so we will do notification ourselves ISVNStatus[] statuses = getStatus(path,recurse,false); for (int i = 0; i < statuses.length;i++) { notificationHandler.notifyListenersOfChange(statuses[i].getFile().getAbsolutePath()); } } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#setRevProperty(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision.Number, java.lang.String, java.lang.String, boolean) */ public void setRevProperty(SVNUrl path, SVNRevision.Number revisionNo, String propName, String propertyData, boolean force) throws SVNClientException { try { _cmd.revpropset(propName, propertyData, toString(path), Long.toString(revisionNo.getNumber()), force); // there is no notification to send } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#mkdir(java.io.File) */ public void mkdir(File file) throws SVNClientException { try { _cmd.mkdir(toString(file)); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } //sometimes the dir has not yet been created. //wait up to 5 sec for the dir to be created. for (int i = 0; i < 50 && !file.exists(); i++) { try { Thread.sleep(100); } catch (InterruptedException e2) { //do nothing if interrupted } } } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#doImport(java.io.File, org.tigris.subversion.svnclientadapter.SVNUrl, java.lang.String, boolean) */ public void doImport(File path, SVNUrl url, String message, boolean recurse) throws SVNClientException { try { notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path)); _cmd.importFiles(toString(path), toString(url), message, recurse); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#doExport(org.tigris.subversion.svnclientadapter.SVNUrl, java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, boolean) */ public void doExport(SVNUrl srcUrl, File destPath, SVNRevision revision, boolean force) throws SVNClientException { try { _cmd.export(toString(srcUrl), toString(destPath), toString(revision), force); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#doExport(java.io.File, java.io.File, boolean) */ public void doExport(File srcPath, File destPath, boolean force) throws SVNClientException { try { _cmd.export(toString(srcPath), toString(destPath), null, force); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* * (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#copy(java.io.File, org.tigris.subversion.svnclientadapter.SVNUrl, java.lang.String) */ public void copy(File srcPath, SVNUrl destUrl, String message) throws SVNClientException { try { if (message == null) message = ""; _cmd.copy(toString(srcPath), toString(destUrl), message, null); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#copy(org.tigris.subversion.svnclientadapter.SVNUrl, java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision) */ public void copy(SVNUrl srcUrl, File destPath, SVNRevision revision) throws SVNClientException { try { _cmd.copy(toString(srcUrl), toString(destPath), null, toString(revision)); } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#propertySet(java.io.File, java.lang.String, java.lang.String, boolean) */ public void propertySet(File path, String propertyName, String propertyValue, boolean recurse) throws SVNClientException { try { _cmd.propset(propertyName, propertyValue, toString(path), recurse); // there is no notification (Notify.notify is not called) when we set a property // so we will do notification ourselves ISVNStatus[] statuses = getStatus(path,recurse,false); for (int i = 0; i < statuses.length;i++) { notificationHandler.notifyListenersOfChange(statuses[i].getFile().getAbsolutePath()); } } catch (CmdLineException e) { throw SVNClientException.wrapException(e); } } /** * A safetoString()
implementation which implements
* null
checking on obj
.
*/
protected static String toString(Object obj) {
return (obj == null) ? null : obj.toString();
}
/**
* Implementation used by overloads of getLogMessages()
.
*
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getLogMessages(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, boolean)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getLogMessages(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, boolean)
*/
private ISVNLogMessage[] getLogMessages(
String pathOrUrl,
String [] paths,
SVNRevision revisionStart,
SVNRevision revisionEnd,
boolean stopOnCopy,
boolean fetchChangePath,
long limit)
throws SVNClientException {
String revRange = toString(revisionStart) + ":" +
toString(revisionEnd);
try {
byte[] messages;
// To acquire the paths associated with each delta, we'd
// have to include the --verbose argument.
if (fetchChangePath) {
messages = _cmd.logVerbose(pathOrUrl, paths, revRange, stopOnCopy, limit);
} else {
messages = _cmd.log(pathOrUrl, revRange, stopOnCopy, limit);
}
return CmdLineLogMessage.createLogMessages(messages);
} catch (CmdLineException e) {
throw SVNClientException.wrapException(e);
}
}
private static void streamToFile(InputStream stream, File outFile) throws IOException {
int tempByte;
try {
FileOutputStream os = new FileOutputStream(outFile);
while ((tempByte = stream.read()) != -1) {
os.write(tempByte);
}
os.close();
stream.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
private static byte[] streamToByteArray(InputStream stream)
throws IOException {
//read byte-by-byte and put it in a vector.
//then take the vector and fill a byteArray.
Vector buffer = new Vector(1024);
int tempByte;
while ((tempByte = stream.read()) != -1) {
buffer.add(new Byte((byte) tempByte));
}
byte[] byteArray = new byte[buffer.size()];
for (int i = 0; i < byteArray.length; i++) {
Byte b = (Byte) buffer.get(i);
byteArray[i] = b.byteValue();
}
return byteArray;
}
protected ISVNAnnotations annotate(String target, SVNRevision revisionStart, SVNRevision revisionEnd) throws SVNClientException {
try {
notificationHandler.setCommand(ISVNNotifyListener.Command.ANNOTATE);
if(revisionStart == null)
revisionStart = new SVNRevision.Number(1);
if(revisionEnd == null)
revisionEnd = SVNRevision.HEAD;
byte[] annotations = _cmd.annotate(target,toString(revisionStart),toString(revisionEnd));
InputStream contents = _cmd.cat(target, revisionEnd.toString());
CmdLineAnnotations result = CmdLineAnnotations.createFromXml(annotations, contents);
try {
contents.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
} catch (CmdLineException e) {
throw SVNClientException.wrapException(e);
}
}
/*
* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#blame(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision)
*/
public ISVNAnnotations annotate(SVNUrl url, SVNRevision revisionStart, SVNRevision revisionEnd)
throws SVNClientException
{
return annotate(toString(url), revisionStart, revisionEnd);
}
/*
* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#annotate(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision)
*/
public ISVNAnnotations annotate(File file, SVNRevision revisionStart, SVNRevision revisionEnd)
throws SVNClientException
{
String target = toString(file);
//If the file is an uncommitted rename/move, we have to refer to original/source, not the new copy.
ISVNInfo info = getInfoFromWorkingCopy(file);
if ((SVNScheduleKind.ADD == info.getSchedule()) && (info.getCopyUrl() != null)) {
target = info.getCopyUrl().toString();
}
return annotate(target, revisionStart, revisionEnd);
}
/*
* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getProperties(java.io.File)
*/
public ISVNProperty[] getProperties(File path) throws SVNClientException {
try {
String propertiesString = _cmd.proplist(toString(path), false);
String propertyName;
List properties = new LinkedList();
StringTokenizer st = new StringTokenizer(propertiesString, Helper.NEWLINE);
while (st.hasMoreTokens()) {
String propertyLine = st.nextToken();
if (propertyLine.startsWith("Properties on '")) {
} else {
propertyName = propertyLine.substring(2);
properties.add(propertyGet(path,propertyName));
}
}
return (ISVNProperty[]) properties.toArray(new ISVNProperty[0]);
} catch (CmdLineException e) {
throw SVNClientException.wrapException(e);
}
}
public ISVNProperty[] getProperties(SVNUrl url) throws SVNClientException {
try {
String propertiesString = _cmd.proplist(url.toString(), false);
String propertyName;
List properties = new LinkedList();
StringTokenizer st = new StringTokenizer(propertiesString, Helper.NEWLINE);
while (st.hasMoreTokens()) {
String propertyLine = st.nextToken();
if (propertyLine.startsWith("Properties on '")) {
} else {
propertyName = propertyLine.substring(2);
properties.add(propertyGet(url,propertyName));
}
}
return (ISVNProperty[]) properties.toArray(new ISVNProperty[0]);
} catch (CmdLineException e) {
throw SVNClientException.wrapException(e);
}
}
/**
* Remove 'conflicted' state on working copy files or directories
* @param path
* @throws SVNClientException
*/
public void resolved(File path)
throws SVNClientException
{
try {
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
_cmd.resolved(new String[] { toString(path) }, false);
// there is no notification when we do svn resolve, we will do notification ourselves
notificationHandler.notifyListenersOfChange(path.getAbsolutePath());
} catch (CmdLineException e) {
throw SVNClientException.wrapException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#createRepository(java.io.File)
*/
public void createRepository(File path, String repositoryType) throws SVNClientException {
try {
svnAdminCmd.create(toString(path), repositoryType);
} catch (CmdLineException e) {
throw SVNClientException.wrapException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getStatus(java.io.File, boolean, boolean, boolean)
*/
public ISVNStatus[] getStatus(File path, boolean descend, boolean getAll, boolean contactServer) throws SVNClientException {
return getStatus(path, descend, getAll, contactServer, false);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getStatus(java.io.File, boolean, boolean, boolean, boolean)
*/
public ISVNStatus[] getStatus(File path, boolean descend, boolean getAll, boolean contactServer, boolean ignoreExternals) throws SVNClientException {
try {
// first we get the status of the files
CmdLineStatusPart[] cmdLineStatusParts = getCmdStatuses(new File[] {path},descend, getAll, contactServer, ignoreExternals);
List targetsInfo = new ArrayList(cmdLineStatusParts.length);
List nonManagedParts = new ArrayList();
for (int i = 0; i < cmdLineStatusParts.length;i++) {
if (cmdLineStatusParts[i].isManaged()) {
targetsInfo.add(cmdLineStatusParts[i].getFile().toString());
} else {
nonManagedParts.add(new Integer(i));
}
}
// this is not enough, so we get info from the files
String infoLinesString = _cmd.info((String[]) targetsInfo.toArray(new String[targetsInfo.size()] ), null, null);
String[] parts = CmdLineInfoPart.parseInfoParts(infoLinesString);
CmdLineInfoPart[] cmdLineInfoParts = new CmdLineInfoPart[parts.length];
for (int i = 0; i < parts.length;i++) {
cmdLineInfoParts[i] = new CmdLineInfoPart(parts[i]);
}
CmdLineInfoPart[] allInfoParts = new CmdLineInfoPart[cmdLineStatusParts.length];
//Put the unversioned at corrent indexes.
for (Iterator iter = nonManagedParts.iterator(); iter.hasNext();) {
Integer indexOfNonManaged = (Integer) iter.next();
allInfoParts[indexOfNonManaged.intValue()] = CmdLineInfoPart.createUnversioned(null);
}
//Fill the remaining indexes with versioned infos.
for (int i = 0; i < cmdLineInfoParts.length; i++) {
for (int j = i; j < allInfoParts.length; j++) {
if (allInfoParts[j] == null) {
allInfoParts[j] = cmdLineInfoParts[i];
break;
}
}
}
CmdLineStatuses cmdLineStatuses = new CmdLineStatuses(cmdLineInfoParts, cmdLineStatusParts);
return cmdLineStatuses.toArray();
} catch (CmdLineException e) {
if (e.getMessage().trim().matches("svn:.*is not a working copy.*")) {
return new ISVNStatus[] {new SVNStatusUnversioned(path)};
}
throw SVNClientException.wrapException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#cancelOperation()
*/
public void cancelOperation() throws SVNClientException {
notificationHandler.logMessage("Warning: operation canceled.");
_cmd.stopProcess();
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getInfoFromWorkingCopy(java.io.File)
*/
public ISVNInfo getInfoFromWorkingCopy(File path) throws SVNClientException {
try {
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
// first we get the status of the files to find out whether it is versioned
CmdLineStatusPart[] cmdLineStatusParts = getCmdStatuses(new File[] {path}, false, true, false, false);
// if the file is managed, it is safe to call info
if ((cmdLineStatusParts.length > 0) && (cmdLineStatusParts[0].isManaged())) {
String cmdLineInfoStrings = _cmd.info(new String[] { toString(path) }, null, null);
return new CmdLineInfoPart(cmdLineInfoStrings);
} else {
return CmdLineInfoPart.createUnversioned(path.getPath());
}
} catch (CmdLineException e) {
throw SVNClientException.wrapException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getInfo(java.io.File)
*/
public ISVNInfo getInfo(File path) throws SVNClientException {
return getInfoFromWorkingCopy(path);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getInfo(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision)
*/
public ISVNInfo getInfo(SVNUrl url, SVNRevision revision, SVNRevision peg) throws SVNClientException {
return getInfo(new SVNUrl[] { url }, revision, peg);
}
private ISVNInfo getInfo(SVNUrl[] urls, SVNRevision revision, SVNRevision peg) throws SVNClientException {
try {
String[] urlStrings = new String[urls.length];
for (int i = 0; i < urls.length; i++) {
urlStrings[i] = toString(urls[i]);
}
//notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(urls));
String cmdLineInfoStrings = _cmd.info(urlStrings, toString(revision), toString(peg));
return new CmdLineInfoPart(cmdLineInfoStrings);
} catch (CmdLineException e) {
throw SVNClientException.wrapException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getInfo(org.tigris.subversion.svnclientadapter.SVNUrl[])
*/
public ISVNInfo getInfo(SVNUrl[] urls) throws SVNClientException {
return getInfo(urls, null, null);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#switchUrl(org.tigris.subversion.svnclientadapter.SVNUrl, java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, boolean)
*/
public void switchToUrl(File path, SVNUrl url, SVNRevision revision, boolean recurse) throws SVNClientException {
try {
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
_cmd.switchUrl(toString(path), toString(url), toString(revision), recurse);
} catch (CmdLineException e) {
throw SVNClientException.wrapException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#setConfigDirectory(java.io.File)
*/
public void setConfigDirectory(File dir) throws SVNClientException {
_cmd.setConfigDirectory(toString(dir));
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#cleanup(java.io.File)
*/
public void cleanup(File path) throws SVNClientException {
try {
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(path));
_cmd.cleanup(toString(path));
} catch (CmdLineException e) {
throw SVNClientException.wrapException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#merge(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, boolean, boolean, boolean, boolean)
*/
public void merge(SVNUrl path1, SVNRevision revision1, SVNUrl path2,
SVNRevision revision2, File localPath, boolean force,
boolean recurse, boolean dryRun, boolean ignoreAncestry) throws SVNClientException {
try {
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(localPath));
_cmd.merge(toString(path1), toString(revision1), toString(path2), toString(revision2), toString(localPath), force, recurse, dryRun, ignoreAncestry);
} catch (CmdLineException e) {
throw SVNClientException.wrapException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#lock(SVNUrl[], java.lang.String, boolean)
*/
public void lock(SVNUrl[] uris, String comment, boolean force)
throws SVNClientException {
// notificationHandler isn't used because we're operating on
// the repository (rather than the WC).
try {
_cmd.lock(uris, comment, force);
} catch (CmdLineException e) {
throw SVNClientException.wrapException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#unlock(SVNUrl[], boolean)
*/
public void unlock(SVNUrl[] uris, boolean force)
throws SVNClientException {
// notificationHandler isn't used because we're operating on
// the repository (rather than the WC).
try {
_cmd.unlock(uris, force);
} catch (CmdLineException e) {
throw SVNClientException.wrapException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#lock(java.io.File[], java.lang.String, boolean)
*/
public void lock(File[] paths, String comment, boolean force)
throws SVNClientException {
String[] files = new String[paths.length];
for (int i = 0; i < paths.length; i++) {
files[i] = toString(paths[i]);
}
try {
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(paths));
_cmd.lock(files, comment, force);
} catch (CmdLineException e) {
throw SVNClientException.wrapException(e);
}
finally {
for (int i = 0; i < files.length; i++) {
notificationHandler.notifyListenersOfChange(files[i]);
}
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#unlock(java.lang.String[], boolean)
*/
public void unlock(File[] paths, boolean force) throws SVNClientException {
String[] files = new String[paths.length];
for (int i = 0; i < paths.length; i++) {
files[i] = toString(paths[i]);
}
try {
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(paths));
_cmd.unlock(files, force);
} catch (CmdLineException e) {
throw SVNClientException.wrapException(e);
}
finally {
for (int i = 0; i < files.length; i++) {
notificationHandler.notifyListenersOfChange(files[i]);
}
}
}
public String getAdminDirectoryName(){
if (dirName == null) {
// svn only supports this feature on Windows
if (isOsWindows())
dirName = getEnvironmentVariable("SVN_ASP_DOT_NET_HACK");
// If the environment variable was present, then use _svn
// as the directory name, otherwise the default of .svn
if (dirName != null)
dirName = "_svn";
else
dirName = ".svn";
}
return dirName;
}
public boolean isAdminDirectory(String name) {
return getAdminDirectoryName().equals(name);
}
public static String getEnvironmentVariable(String var) {
try {
// pre-Java 1.5 this throws an Error. On Java 1.5 it
// returns the environment variable
return System.getenv(var);
} catch(Error e) {
try {
// This means we are on 1.4. Get all variables into
// a Properties object and get the variable from that
return getEnvVars().getProperty(var);
} catch (Throwable e1) {
return null;
}
}
}
public static Properties getEnvVars() throws Throwable {
Process p = null;
Properties envVars = new Properties();
Runtime r = Runtime.getRuntime();
if (isOsWindows()) {
if (System.getProperty("os.name").toLowerCase().indexOf("windows 9") > -1)
p = r.exec( "command.com /c set" );
else
p = r.exec( "cmd.exe /c set" );
} else {
p = r.exec( "env" );
}
if (p != null) {
BufferedReader br = new BufferedReader(
new InputStreamReader(p.getInputStream()));
String line;
while( (line = br.readLine()) != null ) {
int idx = line.indexOf( '=' );
String key = line.substring( 0, idx );
String value = line.substring( idx+1 );
envVars.setProperty( key, value );
}
p.getInputStream().close();
p.getOutputStream().close();
p.getErrorStream().close();
}
return envVars;
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getLogMessages(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, boolean)
*/
public ISVNLogMessage[] getLogMessages(File path, SVNRevision revStart,
SVNRevision revEnd, boolean fetchChangePath)
throws SVNClientException {
return getLogMessages(path, revStart, revEnd, false, fetchChangePath);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getLogMessages(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, boolean, boolean)
*/
public ISVNLogMessage[] getLogMessages(File path, SVNRevision revStart,
SVNRevision revEnd, boolean stopOnCopy, boolean fetchChangePath)
throws SVNClientException {
return getLogMessages(path, revStart, revEnd, stopOnCopy,
fetchChangePath, 0);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getLogMessages(java.io.File, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, boolean, boolean, long)
*/
public ISVNLogMessage[] getLogMessages(File path, SVNRevision revStart,
SVNRevision revEnd, boolean stopOnCopy, boolean fetchChangePath,
long limit) throws SVNClientException {
String target = toString(path);
//If the file is an uncommitted rename/move, we have to refer to original/source, not the new copy.
ISVNInfo info = getInfoFromWorkingCopy(path);
if ((SVNScheduleKind.ADD == info.getSchedule()) && (info.getCopyUrl() != null)) {
target = info.getCopyUrl().toString();
}
return getLogMessages(target, null, revStart, revEnd, stopOnCopy,
fetchChangePath, limit);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getLogMessages(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, boolean)
*/
public ISVNLogMessage[] getLogMessages(SVNUrl url, SVNRevision revStart,
SVNRevision revEnd, boolean fetchChangePath)
throws SVNClientException {
return getLogMessages(url, null, revStart, revEnd, false,
fetchChangePath);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getLogMessages(org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, boolean, boolean, long)
*/
public ISVNLogMessage[] getLogMessages(SVNUrl url, SVNRevision pegRevision,
SVNRevision revStart, SVNRevision revEnd, boolean stopOnCopy,
boolean fetchChangePath, long limit) throws SVNClientException {
//TODO pegRevision not supported !
return getLogMessages(toString(url), null, revStart, revEnd, stopOnCopy,
fetchChangePath, limit);
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#getLogMessages(org.tigris.subversion.svnclientadapter.SVNUrl, java.lang.String[], org.tigris.subversion.svnclientadapter.SVNRevision, org.tigris.subversion.svnclientadapter.SVNRevision, boolean, boolean)
*/
public ISVNLogMessage[] getLogMessages(SVNUrl url, String[] paths,
SVNRevision revStart, SVNRevision revEnd, boolean stopOnCopy,
boolean fetchChangePath) throws SVNClientException {
return getLogMessages(toString(url), paths, revStart, revEnd, stopOnCopy,
fetchChangePath, 0);
}
public void relocate(String from, String to, String path, boolean recurse)
throws SVNClientException {
try {
notificationHandler.setBaseDir(SVNBaseDir.getBaseDir(new File(path)));
_cmd.relocate(from, to, path, recurse);
} catch (CmdLineException e) {
throw SVNClientException.wrapException(e);
}
}
/* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.ISVNClientAdapter#diff(java.io.File, org.tigris.subversion.svnclientadapter.SVNUrl, org.tigris.subversion.svnclientadapter.SVNRevision, java.io.File, boolean)
*/
public void diff(File path, SVNUrl url, SVNRevision urlRevision,
File outFile, boolean recurse) throws SVNClientException {
diff(
toString(path),
null,
toString(url) + "@" + toString(urlRevision),
null,
outFile,
recurse, true, false, false);
}
public void addConflictResolutionCallback(ISVNConflictResolver callback) {
// TODO
}
public ISVNAnnotations annotate(File file, SVNRevision revisionStart,
SVNRevision revisionEnd, boolean ignoreMimeType,
boolean includeMergedRevisions) throws SVNClientException {
notImplementedYet();
return null;
}
public ISVNAnnotations annotate(SVNUrl url, SVNRevision revisionStart,
SVNRevision revisionEnd, boolean ignoreMimeType,
boolean includeMergedRevisions) throws SVNClientException {
notImplementedYet();
return null;
}
public ISVNLogMessage[] getLogMessages(File path, SVNRevision pegRevision,
SVNRevision revisionStart, SVNRevision revisionEnd,
boolean stopOnCopy, boolean fetchChangePath, long limit,
boolean includeMergedRevisions) throws SVNClientException {
notImplementedYet();
return null;
}
public ISVNLogMessage[] getLogMessages(SVNUrl url, SVNRevision pegRevision,
SVNRevision revisionStart, SVNRevision revisionEnd,
boolean stopOnCopy, boolean fetchChangePath, long limit,
boolean includeMergedRevisions) throws SVNClientException {
notImplementedYet();
return null;
}
public ISVNMergeInfo getMergeInfo(File path, SVNRevision revision)
throws SVNClientException {
notImplementedYet();
return null;
}
public ISVNMergeInfo getMergeInfo(SVNUrl url, SVNRevision revision)
throws SVNClientException {
notImplementedYet();
return null;
}
public void merge(SVNUrl url, SVNRevision pegRevision,
SVNRevisionRange[] revisions, File localPath, boolean force,
int depth, boolean ignoreAncestry, boolean dryRun)
throws SVNClientException {
notImplementedYet();
}
public SVNDiffSummary[] diffSummarize(File target, SVNRevision pegRevision, SVNRevision startRevision, SVNRevision endRevision, int depth, boolean ignoreAncestry) throws SVNClientException {
notImplementedYet();
return null;
}
public SVNDiffSummary[] diffSummarize(File target1, SVNRevision revision1, SVNUrl target2, SVNRevision revision2, int depth, boolean ignoreAncestry) throws SVNClientException {
notImplementedYet();
return null;
}
public SVNDiffSummary[] diffSummarize(SVNUrl target, SVNRevision pegRevision, SVNRevision startRevision, SVNRevision endRevision, int depth, boolean ignoreAncestry) throws SVNClientException {
notImplementedYet();
return null;
}
public SVNDiffSummary[] diffSummarize(SVNUrl target1, SVNRevision revision1, SVNUrl target2, SVNRevision revision2, int depth, boolean ignoreAncestry) throws SVNClientException {
notImplementedYet();
return null;
}
public String[] suggestMergeSources(File path) throws SVNClientException {
notImplementedYet();
return null;
}
public String[] suggestMergeSources(SVNUrl url, SVNRevision peg) throws SVNClientException {
notImplementedYet();
return null;
}
public void checkout(SVNUrl moduleName, File destPath,
SVNRevision revision, int depth, boolean ignoreExternals,
boolean force) throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
}
public void copy(SVNUrl srcUrl, SVNUrl destUrl, String message,
SVNRevision revision, boolean makeParents)
throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
}
public void diff(SVNUrl target, SVNRevision pegRevision,
SVNRevision startRevision, SVNRevision endRevision, File outFile,
int depth, boolean ignoreAncestry, boolean noDiffDeleted,
boolean force) throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
}
public void diff(SVNUrl target, SVNRevision pegRevision,
SVNRevision startRevision, SVNRevision endRevision, File outFile,
boolean recurse) throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
}
public void dispose() {
// TODO Auto-generated method stub
}
public InputStream getContent(SVNUrl url, SVNRevision revision,
SVNRevision pegRevision) throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
return null;
}
public ISVNDirEntry[] getList(SVNUrl url, SVNRevision revision,
SVNRevision pegRevision, boolean recurse) throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
return null;
}
public ISVNDirEntry[] getList(File path, SVNRevision revision,
SVNRevision pegRevision, boolean recurse) throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
return null;
}
public void resolve(File path, int result) throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
}
public void setProgressListener(ISVNProgressListener progressListener) {
// TODO Auto-generated method stub
}
public void merge(SVNUrl url, SVNRevision pegRevision,
SVNRevisionRange[] revisions, File localPath, boolean force,
int depth, boolean ignoreAncestry, boolean dryRun,
boolean recordOnly) throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
}
public void merge(SVNUrl path1, SVNRevision revision1, SVNUrl path2,
SVNRevision revision2, File localPath, boolean force, int depth,
boolean dryRun, boolean ignoreAncestry, boolean recordOnly)
throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
}
public void copy(File[] srcPaths, SVNUrl destUrl, String message,
boolean copyAsChild, boolean makeParents) throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
}
public void copy(SVNUrl[] srcUrls, SVNUrl destUrl, String message,
SVNRevision revision, boolean copyAsChild, boolean makeParents)
throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
}
public void switchToUrl(File path, SVNUrl url, SVNRevision revision,
int depth, boolean setDepth, boolean ignoreExternals, boolean force)
throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
}
public void switchToUrl(File path, SVNUrl url, SVNRevision revision,
SVNRevision pegRevision, int depth, boolean setDepth,
boolean ignoreExternals, boolean force) throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
}
public long update(File path, SVNRevision revision, int depth,
boolean setDepth, boolean ignoreExternals, boolean force)
throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
return 0;
}
public long[] update(File[] path, SVNRevision revision, int depth,
boolean setDepth, boolean ignoreExternals, boolean force)
throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
return null;
}
public void mergeReintegrate(SVNUrl path, SVNRevision pegRevision,
File localPath, boolean force, boolean dryRun)
throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
}
public void copy(SVNUrl srcUrl, File destPath, SVNRevision revision,
boolean copyAsChild, boolean makeParents) throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
}
public ISVNLogMessage[] getMergeinfoLog(int kind, File path,
SVNRevision pegRevision, SVNUrl mergeSourceUrl,
SVNRevision srcPegRevision, boolean discoverChangedPaths)
throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
return null;
}
public ISVNLogMessage[] getMergeinfoLog(int kind, SVNUrl url,
SVNRevision pegRevision, SVNUrl mergeSourceUrl,
SVNRevision srcPegRevision, boolean discoverChangedPaths)
throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
return null;
}
public void getLogMessages(File path, SVNRevision pegRevision,
SVNRevision revisionStart, SVNRevision revisionEnd,
boolean stopOnCopy, boolean fetchChangePath, long limit,
boolean includeMergedRevisions, String[] requestedProperties,
ISVNLogMessageCallback callback) throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
}
public void getLogMessages(SVNUrl url, SVNRevision pegRevision,
SVNRevision revisionStart, SVNRevision revisionEnd,
boolean stopOnCopy, boolean fetchChangePath, long limit,
boolean includeMergedRevisions, String[] requestedProperties,
ISVNLogMessageCallback callback) throws SVNClientException {
// TODO Auto-generated method stub
notImplementedYet();
}
}
././@LongLink 0000000 0000000 0000000 00000000202 00000000000 011557 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandline/CmdLineStatusFromXml.java libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandl0000644 0000000 0000000 00000033624 10613664631 033041 0 ustar root root /*******************************************************************************
* Copyright (c) 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.commandline;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import javax.xml.parsers.DocumentBuilderFactory;
import org.tigris.subversion.svnclientadapter.SVNRevision;
import org.tigris.subversion.svnclientadapter.SVNStatusKind;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
public class CmdLineStatusFromXml extends CmdLineXmlCommand {
private SVNRevision.Number lastChangedRevision;
private Date lastChangedDate;
private String lastCommitAuthor;
private SVNStatusKind textStatus;
private SVNStatusKind repositoryTextStatus;
private SVNStatusKind propStatus;
private SVNStatusKind repositoryPropStatus;
private SVNRevision.Number revision;
private String path;
private boolean copied;
private boolean wcLocked;
private boolean switched;
private File conflictNew;
private File conflictOld;
private File conflictWorking;
private String lockOwner;
private Date lockCreationDate;
private String lockComment;
protected CmdLineStatusFromXml(String path)
{
super();
this.path = path;
}
/**
* @return Returns the conflictNew.
*/
public File getConflictNew() {
return conflictNew;
}
/**
* @return Returns the conflictOld.
*/
public File getConflictOld() {
return conflictOld;
}
/**
* @return Returns the conflictWorking.
*/
public File getConflictWorking() {
return conflictWorking;
}
/**
* @return Returns the copied.
*/
public boolean isCopied() {
return copied;
}
/**
* @return Returns the wcLocked.
*/
public boolean isWcLocked() {
return wcLocked;
}
/**
* @return Returns the switched.
*/
public boolean isSwitched() {
return switched;
}
/**
* @return Returns the file.
*/
public File getFile() {
return new File(getPath()).getAbsoluteFile();
}
/**
* @return Returns the lastCommitAuthor.
*/
public String getLastCommitAuthor() {
return lastCommitAuthor;
}
/**
* @return Returns the lastChangedDate.
*/
public Date getLastChangedDate() {
return lastChangedDate;
}
/**
* @return Returns the lastChangedRevision.
*/
public SVNRevision.Number getLastChangedRevision() {
return lastChangedRevision;
}
/**
* @return Returns the lockComment.
*/
public String getLockComment() {
return lockComment;
}
/**
* @return Returns the lockCreationDate.
*/
public Date getLockCreationDate() {
return lockCreationDate;
}
/**
* @return Returns the lockOwner.
*/
public String getLockOwner() {
return lockOwner;
}
/**
* @return Returns the path.
*/
public String getPath() {
return path;
}
/**
* @return Returns the propStatus.
*/
public SVNStatusKind getPropStatus() {
return propStatus;
}
/**
* @return Returns the repositoryPropStatus.
*/
public SVNStatusKind getRepositoryPropStatus() {
return repositoryPropStatus;
}
/**
* @return Returns the repositoryTextStatus.
*/
public SVNStatusKind getRepositoryTextStatus() {
return repositoryTextStatus;
}
/**
* @return Returns the revision.
*/
public SVNRevision.Number getRevision() {
return revision;
}
/**
* @return Returns the textStatus.
*/
public SVNStatusKind getTextStatus() {
return textStatus;
}
/**
* @param conflictNew The conflictNew to set.
*/
protected void setConflictNew(File conflictNew) {
this.conflictNew = conflictNew;
}
/**
* @param conflictOld The conflictOld to set.
*/
protected void setConflictOld(File conflictOld) {
this.conflictOld = conflictOld;
}
/**
* @param conflictWorking The conflictWorking to set.
*/
protected void setConflictWorking(File conflictWorking) {
this.conflictWorking = conflictWorking;
}
/**
* @param copied The copied to set.
*/
protected void setCopied(boolean copied) {
this.copied = copied;
}
/**
* @param wcLocked The wcLocked to set.
*/
protected void setWcLocked(boolean wcLocked) {
this.wcLocked = wcLocked;
}
/**
* @param switched The switched to set.
*/
protected void setSwitched(boolean switched) {
this.switched = switched;
}
/**
* @param lastCommitAuthor The lastCommitAuthor to set.
*/
protected void setLastCommitAuthor(String lastCommitAuthor) {
this.lastCommitAuthor = lastCommitAuthor;
}
/**
* @param lastChangedDate The lastChangedDate to set.
*/
protected void setLastChangedDate(Date lastChangedDate) {
this.lastChangedDate = lastChangedDate;
}
/**
* @param lastChangedRevision The lastChangedRevision to set.
*/
protected void setLastChangedRevision(SVNRevision.Number lastChangedRevision) {
this.lastChangedRevision = lastChangedRevision;
}
/**
* @param lockComment The lockComment to set.
*/
protected void setLockComment(String lockComment) {
this.lockComment = lockComment;
}
/**
* @param lockCreationDate The lockCreationDate to set.
*/
protected void setLockCreationDate(Date lockCreationDate) {
this.lockCreationDate = lockCreationDate;
}
/**
* @param lockOwner The lockOwner to set.
*/
protected void setLockOwner(String lockOwner) {
this.lockOwner = lockOwner;
}
/**
* @param path The path to set.
*/
protected void setPath(String path) {
this.path = path;
}
/**
* @param propStatus The propStatus to set.
*/
protected void setPropStatus(SVNStatusKind propStatus) {
this.propStatus = propStatus;
}
/**
* @param repositoryPropStatus The repositoryPropStatus to set.
*/
protected void setRepositoryPropStatus(SVNStatusKind repositoryPropStatus) {
this.repositoryPropStatus = repositoryPropStatus;
}
/**
* @param repositoryTextStatus The repositoryTextStatus to set.
*/
protected void setRepositoryTextStatus(SVNStatusKind repositoryTextStatus) {
this.repositoryTextStatus = repositoryTextStatus;
}
/**
* @param revision The revision to set.
*/
protected void setRevision(SVNRevision.Number revision) {
this.revision = revision;
}
/**
* @param textStatus The textStatus to set.
*/
protected void setTextStatus(SVNStatusKind textStatus) {
this.textStatus = textStatus;
}
/**
* creates CmdLineStatus(es) from a xml string (see svn status --xml)
* @param cmdLineResults
* @return CmdLineStatusFromXml[] array created from the supplied xml
* @throws CmdLineException
*/
public static CmdLineStatusFromXml[] createStatuses(byte[] cmdLineResults) throws CmdLineException {
Collection statuses = new ArrayList();
try {
// Create a builder factory
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
// Create the builder and parse the file
InputSource source = new InputSource(new ByteArrayInputStream(cmdLineResults));
Document doc = factory.newDocumentBuilder().parse(source);
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
NodeList nodes = doc.getElementsByTagName("entry");
for(int i = 0; i < nodes.getLength(); i++) {
Node statusEntry = nodes.item(i);
String entryPath = statusEntry.getAttributes().getNamedItem("path").getNodeValue();
CmdLineStatusFromXml status = new CmdLineStatusFromXml(entryPath);
Element wcStatusNode = getFirstNamedElement(statusEntry, "wc-status");
if (wcStatusNode == null) throw new Exception("'wc-status' tag expected under 'entry'");
Node wcItemStatusAttr = wcStatusNode.getAttributes().getNamedItem("item");
status.setTextStatus(SVNStatusKind.fromString(wcItemStatusAttr.getNodeValue()));
Node wcPpropStatusAttr = wcStatusNode.getAttributes().getNamedItem("props");
status.setPropStatus(SVNStatusKind.fromString(wcPpropStatusAttr.getNodeValue()));
Node wcRevisionAttribute = wcStatusNode.getAttributes().getNamedItem("revision");
if (wcRevisionAttribute != null) {
status.setRevision(Helper.toRevNum(wcRevisionAttribute.getNodeValue()));
}
Node wcLockedAttr = wcStatusNode.getAttributes().getNamedItem("wc-locked");
status.setWcLocked((wcLockedAttr != null) && "true".equals(wcLockedAttr.getNodeValue()));
Node copiedAttr = wcStatusNode.getAttributes().getNamedItem("copied");
status.setCopied((copiedAttr != null) && "true".equals(copiedAttr.getNodeValue()));
Node switchedAttr = wcStatusNode.getAttributes().getNamedItem("switched");
status.setSwitched((switchedAttr != null) && "true".equals(switchedAttr.getNodeValue()));
Element commitNode = getFirstNamedElement(wcStatusNode, "commit");
if (commitNode != null) {
Node commitRevisionAttribute = commitNode.getAttributes().getNamedItem("revision");
status.setLastChangedRevision(Helper.toRevNum(commitRevisionAttribute.getNodeValue()));
Element authorNode = getFirstNamedElement(commitNode, "author");
if (authorNode != null) {
status.setLastCommitAuthor(authorNode.getFirstChild().getNodeValue());
}
Element dateNode = getNextNamedElement(authorNode, "date");
if (dateNode != null) {
status.setLastChangedDate(Helper.convertXMLDate(dateNode.getFirstChild().getNodeValue()));
}
}
Element lockNode = getNextNamedElement(commitNode, "lock");
if (lockNode != null) {
Element tokenNode = getFirstNamedElement(lockNode, "token");
if (tokenNode == null) throw new Exception("'token' tag expected under 'lock'");
// String token = authorNode.getFirstChild().getNodeValue();
Element ownerNode = getNextNamedElement(lockNode, "owner");
if (ownerNode == null) throw new Exception("'owner' tag expected under 'lock'");
status.setLockOwner(ownerNode.getFirstChild().getNodeValue());
Element lockCommentNode = getNextNamedElement(ownerNode, "comment");
status.setLockComment((lockCommentNode != null) ? lockCommentNode.getFirstChild().getNodeValue() : null);
Element lockCreatedNode = getNextNamedElement(lockCommentNode, "created");
status.setLockCreationDate(Helper.convertXMLDate((lockCreatedNode != null) ? lockCreatedNode.getFirstChild().getNodeValue() : null));
// Element lockExpiresNode = getNextNamedElement(lockCreatedNode, "expires");
// String lockExpires = (lockExpiresNode != null) ? lockExpiresNode.getFirstChild().getNodeValue() : null;
}
Element reposStatusNode = getNextNamedElement(wcStatusNode, "repos-status");
if (reposStatusNode != null) {
Node reposItemStatusAttr = reposStatusNode.getAttributes().getNamedItem("item");
status.setRepositoryTextStatus(SVNStatusKind.fromString(reposItemStatusAttr.getNodeValue()));
Node reposPropStatusAttr = reposStatusNode.getAttributes().getNamedItem("props");
status.setRepositoryPropStatus(SVNStatusKind.fromString(reposPropStatusAttr.getNodeValue()));
}
statuses.add(status);
}
} catch (Exception e) {
throw new CmdLineException(e);
}
return (CmdLineStatusFromXml[]) statuses.toArray(new CmdLineStatusFromXml[statuses.size()]);
}
}
././@LongLink 0000000 0000000 0000000 00000000174 00000000000 011567 L ustar root root libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandline/SvnCommandLine.java libnb-svnclientadapter-java-6.7.orig/src/commandline/org/tigris/subversion/svnclientadapter/commandl0000644 0000000 0000000 00000077542 10613664631 033050 0 ustar root root /*******************************************************************************
* Copyright (c) 2004, 2006 svnClientAdapter project and others.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Contributors:
* svnClientAdapter project committers - initial API and implementation
******************************************************************************/
package org.tigris.subversion.svnclientadapter.commandline;
import java.io.InputStream;
import org.tigris.subversion.svnclientadapter.ISVNNotifyListener;
import org.tigris.subversion.svnclientadapter.SVNRevision;
import org.tigris.subversion.svnclientadapter.commandline.parser.SvnOutputParser;
/**
* * Performs the gruntwork of calling "svn". * Is a bare-bones interface to using the Subversion commandline client.
* * @author Philip Schatz (schatz at tigris) * @author C�dric Chabanois (cchabanois at no-log.org) * @author John M Flinchbaugh (john at hjsoft.com) */ public class SvnCommandLine extends CommandLine { protected String user; protected String pass; protected SvnOutputParser svnOutputParser = new SvnOutputParser(); protected long rev = SVNRevision.SVN_INVALID_REVNUM; protected boolean parseSvnOutput = false; protected String configDir = null; //Constructors SvnCommandLine(String svnPath,CmdLineNotificationHandler notificationHandler) { super(svnPath,notificationHandler); } /** * * @param revision * @return "HEAD" if revision is a null or empty string, return revision otherwise */ protected static String validRev(String revision) { return (revision == null || "".equals(revision)) ? "HEAD" : revision; } /** ** Sets the username used by this client.
* * @param username The username to use for authentication. */ void setUsername(String username) { user = username; } /** ** Sets the password used by this client.
* * @param password The password to use for authentication. */ void setPassword(String password) { pass = password; } /** * set the directory from which user configuration files will be read */ void setConfigDirectory(String dir) { configDir = dir; } /* (non-Javadoc) * @see org.tigris.subversion.svnclientadapter.commandline.CommandLine#version() */ String version() throws CmdLineException { setCommand(ISVNNotifyListener.Command.UNDEFINED, false); return super.version(); } /** ** Adds an unversioned file into the repository.
* * @param resource Local path of resource to add. * @param recursive true if this is a directory * and its children should be traversed * recursively. * @param force true if this is a directory that * should be scanned even if it's already added * to the repository */ String add(String path, boolean recursive, boolean force) throws CmdLineException { setCommand(ISVNNotifyListener.Command.ADD, true); CmdArguments args = new CmdArguments(); args.add("add"); if (!recursive) args.add("-N"); if (force) args.add("--force"); args.add(path); return execString(args,false); } /** ** Output the content of specified file or URL.
* * @param url Either the local path to a file, or URL * to print the contents of. * @return An stream containing the contents of the file. */ InputStream cat(String url, String revision) throws CmdLineException { setCommand(ISVNNotifyListener.Command.CAT, false); CmdArguments args = new CmdArguments(); args.add("cat"); args.add("-r"); args.add(validRev(revision)); args.add(url); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); return execInputStream(args); } /** ** Send changes from your working copy to the * repository.
* * @param path The local path to the folder(s)/file(s) * to commit. * @param message The message associated with the * committed resources. * @throws CmdLineException */ String checkin(String[] path, String message, boolean keepLocks) throws CmdLineException { setCommand(ISVNNotifyListener.Command.COMMIT, true); CmdArguments args = new CmdArguments(); args.add("ci"); if (keepLocks) args.add("--no-unlock"); args.addLogMessage(message); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); for (int i = 0; i < path.length;i++) { args.add(path[i]); } return execString(args,false); } /** ** Recursively clean up the working copy, * removing locks, resuming unfinished operations.
* * @param path The local path to clean up. */ void cleanup(String path) throws CmdLineException { setCommand(ISVNNotifyListener.Command.CLEANUP, true); CmdArguments args = new CmdArguments(); args.add("cleanup"); args.add(path); args.addConfigInfo(this.configDir); execVoid(args); } /** ** Check out a working copy from a repository.
* * @param url The URL to check out from. * @param destination The local directory to check out to. * @param revision The revision to check out. * Defaults to "HEAD". * @param recursive true if subdirs should be checked out recursively. * @throws CmdLineException */ String checkout(String url, String destination, String revision, boolean recursive) throws CmdLineException { setCommand(ISVNNotifyListener.Command.CHECKOUT, true); CmdArguments args = new CmdArguments(); args.add("co"); args.add("-r"); args.add(validRev(revision)); args.add(url + "@" + validRev(revision)); args.add(destination); if (!recursive) args.add("-N"); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); return execString(args,false); } /** ** Duplicate something in working copy or repos, * remembering history.
* ** src and dest can each be either a working copy (WC) path or URL.
** Duplicate a resource in local file system.
* * @param src Local path to copy from. * @param dest Local destination path. * @throws CmdLineException */ void copy(String src, String dest) throws CmdLineException { setCommand(ISVNNotifyListener.Command.COPY, true); CmdArguments args = new CmdArguments(); args.add("cp"); args.add(src); args.add(dest); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); execVoid(args); } /** ** Remove files and directories from version control.
* * @param target Local path or URL to remove. * @param message Associated message when deleting from * URL. */ String delete(String[] target, String message, boolean force) throws CmdLineException { setCommand(ISVNNotifyListener.Command.REMOVE, true); CmdArguments args = new CmdArguments(); args.add("rm"); if (message != null) { args.addLogMessage(message); } if (force) { args.add("--force"); } for (int i = 0;i < target.length;i++) { args.add(target[i]); } args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); return execString(args,false); } /** ** Display the differences between two paths.
* */ InputStream diff(String oldPath, String oldRev, String newPath, String newRev, boolean recurse, boolean ignoreAncestry, boolean noDiffDeleted, boolean force) throws CmdLineException { setCommand(ISVNNotifyListener.Command.DIFF, false); CmdArguments args = new CmdArguments(); args.add("diff"); if (newRev != null) { args.add("-r"); if (newRev.equals("WORKING")) { // "WORKING" is not a valid revision argument at least in 0,35,1 args.add(oldRev); } else { args.add(oldRev+":"+newRev); } } if (!recurse) { args.add("-N"); } if (!ignoreAncestry) { args.add("--notice-ancestry"); } if (noDiffDeleted) { args.add("--no-diff-deleted"); } if (force) { args.add("--force"); } args.add("--old"); args.add(oldPath); args.add("--new"); args.add(newPath); args.addConfigInfo(this.configDir); return execInputStream(args); } /** ** export files and directories from remote URL.
* */ void export(String url, String path, String revision, boolean force) throws CmdLineException { setCommand(ISVNNotifyListener.Command.EXPORT, true); CmdArguments args = new CmdArguments(); args.add("export"); args.add("-r"); args.add(validRev(revision)); args.add(url); args.add(path); if (force) args.add("--force"); args.addConfigInfo(this.configDir); execVoid(args); } /** ** Commit an unversioned file or directory into the repository.
* * @param path Local path to import from. * @param url Remote URL to import to. * @param message commit message */ String importFiles(String path, String url, String message, boolean recursive) throws CmdLineException { setCommand(ISVNNotifyListener.Command.IMPORT, true); CmdArguments args = new CmdArguments(); args.add("import"); args.add(path); args.add(url); if (!recursive) { args.add("-N"); } args.addLogMessage(message); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); return execString(args,false); } /** * info: Display info about a resource. * usage: info [PATH [PATH ... ]] * * Print information about PATHs. * * Valid options: * --targets arg : pass contents of file ARG as additional args * -R [--recursive] : descend recursively * * @param path * @return String with the info call result */ String info(String[] target, String revision, String peg) throws CmdLineException { if (target.length == 0) { // otherwise we would do a "svn info" without args return ""; } setCommand(ISVNNotifyListener.Command.INFO, false); CmdArguments args = new CmdArguments(); args.add("info"); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); if (revision != null) { args.add("-r"); args.add(revision); } for (int i = 0;i < target.length;i++) { if (peg == null) args.add(target[i]); else args.add(target[i] + "@" + peg); } return execString(args,false); } /** ** List directory entries of a URL.
* * @param url Remote URL. * @param revision Revision to use. can be null * Defaults to HEAD. * @param recursive Should this operation recurse into sub-directories */ byte[] list(String url, String revision, boolean recursive) throws CmdLineException { setCommand(ISVNNotifyListener.Command.LS, false); CmdArguments args = new CmdArguments(); args.add("list"); if (recursive) { args.add("-R"); } args.add("--xml"); args.add("-r"); args.add(revision); args.add(url); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); return execBytes(args,false); } /** ** Show the log messages for a set of revision(s) and/or file(s).
* * @param target Local path or URL. * @param revision Optional revision range to get log * messages from. */ byte[] log(String target, String revision, boolean stopOnCopy, long limit ) throws CmdLineException { setCommand(ISVNNotifyListener.Command.LOG, false); CmdArguments args = new CmdArguments(); args.add("log"); args.add("-r"); args.add(validRev(revision)); args.add(target); args.add("--xml"); if (stopOnCopy) args.add("--stop-on-copy"); if (limit > 0) { args.add("--limit"); args.add(Long.toString(limit)); } args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); return execBytes(args, true); } /** ** Show the log messages for a set of revision(s) and/or file(s).
*The difference to the methode log is the parameter -v * * @param target Local path or URL. * @param paths list of paths relative to target, may be null * @param revision Optional revision range to get log * messages from. */ byte[] logVerbose(String target, String [] paths, String revision, boolean stopOnCopy, long limit ) throws CmdLineException { setCommand(ISVNNotifyListener.Command.LOG, false); CmdArguments args = new CmdArguments(); args.add("log"); args.add("-r"); args.add(validRev(revision)); args.add(target); if (paths != null) { for (int i = 0; i < paths.length; i++) { args.add(paths[i]); } } args.add("--xml"); args.add("-v"); if (stopOnCopy) args.add("--stop-on-copy"); if (limit > 0) { args.add("--limit"); args.add(Long.toString(limit)); } args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); return execBytes(args, true); } /** *
* Create a new directory under revision control.
* * @param url URL to create. (contains existing url, * followed by "/newDirectoryName"). * @param message Commit message to send. */ void mkdir(String url, String message) throws CmdLineException { setCommand(ISVNNotifyListener.Command.MKDIR, true); CmdArguments args = new CmdArguments(); args.add("mkdir"); args.addLogMessage(message); args.add(url); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); execVoid(args); } void mkdir(String localPath) throws CmdLineException { setCommand(ISVNNotifyListener.Command.MKDIR, true); CmdArguments args = new CmdArguments(); args.add("mkdir"); args.add(localPath); args.addConfigInfo(this.configDir); execVoid(args); } /** ** Move/rename something in working copy or repository.
* ** source and dest can both be working copy (WC) paths or URLs.
** Print value of propName on files, dirs, or revisions.
* * @param Local path of resource. * @param propName Property name whose value we wish to find. */ InputStream propget(String path, String propName) throws CmdLineException { setCommand(ISVNNotifyListener.Command.PROPGET, false); CmdArguments args = new CmdArguments(); args.add("propget"); args.add("--strict"); args.add(propName); args.add(path); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); return execInputStream(args); } /** ** Print value of propName on files, dirs, or revisions.
* * @param Local path of resource. * @param propName Property name whose value we wish to find. */ InputStream propget(String path, String propName, String revision, String peg) throws CmdLineException { setCommand(ISVNNotifyListener.Command.PROPGET, false); CmdArguments args = new CmdArguments(); args.add("propget"); args.add("--strict"); args.add("-r"); args.add(revision); args.add(propName); args.add(path + "@" + peg); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); return execInputStream(args); } /** ** Set propName to propVal on files or dirs.
* * @param propName name of the property. * @param propValue New value to set propName to. * @param target Local path to resource. */ void propset(String propName, String propValue, String target, boolean recurse) throws CmdLineException { setCommand(ISVNNotifyListener.Command.PROPSET, false); CmdArguments args = new CmdArguments(); args.add("propset"); if (recurse) args.add("-R"); args.add(propName); args.add(propValue); args.add(target); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); execVoid(args); } /** * List the properties for the given file or dir * * @param target * @return String with the resource properties * @throws CmdLineException */ String proplist(String target, boolean recurse) throws CmdLineException { setCommand(ISVNNotifyListener.Command.PROPLIST, false); CmdArguments args = new CmdArguments(); args.add("proplist"); if (recurse) args.add("-R"); args.add(target); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); return execString(args,false); } /** * Remove propName from files, dirs. * * @param propName * @param target * @param recurse * @throws CmdLineException */ void propdel(String propName, String target, boolean recurse) throws CmdLineException { setCommand(ISVNNotifyListener.Command.PROPDEL, true); CmdArguments args = new CmdArguments(); args.add("propdel"); if (recurse) args.add("-R"); args.add(propName); args.add(target); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); execVoid(args); } /** ** Sets a binary file as the value of a property.
* * @param propName name of the property. * @param propFile Local path to binary file. * @param target Local path to resource. */ void propsetFile(String propName, String propFile, String target, boolean recurse) throws CmdLineException { setCommand(ISVNNotifyListener.Command.PROPSET, false); CmdArguments args = new CmdArguments(); args.add("propset"); if (recurse) args.add("-R"); args.add(propName); args.add("-F"); args.add(propFile); args.add(target); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); execVoid(args); } /** ** Restore pristine working copy file (undo all local edits)
* * @param paths Local paths to revert. * @param recursive true if reverting subdirectories. */ String revert(String[] paths, boolean recursive) throws CmdLineException { setCommand(ISVNNotifyListener.Command.REVERT, true); CmdArguments args = new CmdArguments(); args.add("revert"); if (recursive) args.add("-R"); for (int i = 0; i < paths.length;i++) { args.add(paths[i]); } args.addConfigInfo(this.configDir); return execString(args,false); } /** * Remove 'conflicted' state on working copy files or directories. * * @param paths * @param recursive * @throws CmdLineException */ void resolved(String[] paths, boolean recursive) throws CmdLineException { setCommand(ISVNNotifyListener.Command.RESOLVED, true); CmdArguments args = new CmdArguments(); args.add("resolved"); if (recursive) args.add("-R"); for (int i = 0; i < paths.length;i++) { args.add(paths[i]); } args.addConfigInfo(this.configDir); execVoid(args); } /** ** Print the status of working copy files and directories.
* * @param path Local path of resource to get status of. * @param allEntries if false, only interesting entries will be get (local mods and/or out-of-date). * @param checkUpdates Check for updates on server. */ byte[] status(String path[], boolean descend, boolean allEntries, boolean checkUpdates, boolean ignoreExternals) throws CmdLineException { if (path.length == 0) { // otherwise we would do a "svn status" without args return new byte[0]; } setCommand(ISVNNotifyListener.Command.STATUS, false); CmdArguments args = new CmdArguments(); args.add("status"); args.add("--xml"); if (allEntries) { args.add("-v"); } if (!descend) args.add("-N"); if (checkUpdates) { args.add("-u"); } if (allEntries) { args.add("--no-ignore"); // disregard default and svn:ignore property ignores } if (ignoreExternals) { args.add("--ignore-externals"); } for (int i = 0; i < path.length;i++) { args.add(path[i]); } args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); return execBytes(args, false); } /** ** Bring changes from the repository into the working copy.
* * @param path Local path to possibly update. * @param revision Optional revision to update to. */ String update(String path, String revision) throws CmdLineException { setCommand(ISVNNotifyListener.Command.UPDATE, true); CmdArguments args = new CmdArguments(); args.add("up"); args.add("-r"); args.add(validRev(revision)); args.add(path); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); return execString(args,false); } /** ** Bring changes from the repository into the working copy.
* * @param paths Local paths to possibly update. * @param revision Optional revision to update to. */ String update(String[] paths, String revision) throws CmdLineException { StringBuffer pathsArg = new StringBuffer(); for (int i = 0; i < paths.length; i++) { pathsArg.append(paths[i]); pathsArg.append(" "); } setCommand(ISVNNotifyListener.Command.UPDATE, true); CmdArguments args = new CmdArguments(); args.add("up"); args.add("-r"); args.add(validRev(revision)); args.add(pathsArg.toString()); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); return execString(args,false); } /** * Output the content of specified files or URLs with revision and * author information in-line. * @param path * @param revisionStart * @param revisionEnd * @return byte[] array containing the XML representation of annotate data * @throws CmdLineException */ byte[] annotate(String path,String revisionStart, String revisionEnd) throws CmdLineException { setCommand(ISVNNotifyListener.Command.ANNOTATE, false); CmdArguments args = new CmdArguments(); args.add("annotate"); args.add("--xml"); args.add("-r"); if ((revisionStart != null) && (revisionStart.length() > 0)) { args.add(validRev(revisionStart) + ":" + validRev(revisionEnd)); } else { args.add(validRev(revisionEnd)); } args.add(path); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); return execBytes(args,false); } /** * Update the working copy to mirror a new URL within the repository. */ String switchUrl(String path, String url, String revision, boolean recurse) throws CmdLineException { setCommand(ISVNNotifyListener.Command.SWITCH, true); CmdArguments args = new CmdArguments(); args.add("sw"); args.add(url); args.add(path); if (!recurse) args.add("-N"); args.add("-r"); args.add(validRev(revision)); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); return execString(args,false); } /** * Update the working copy to point to a new repository URL. */ String relocate(String from, String to, String path, boolean recurse) throws CmdLineException { setCommand(ISVNNotifyListener.Command.RELOCATE, false); CmdArguments args = new CmdArguments(); args.add("sw"); args.add("--relocate"); if (!recurse) args.add("-N"); args.add(from); args.add(to); args.add(path); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); return execString(args,false); } /** * Update the working copy to mirror a new URL within the repository. */ String merge(String path1, String revision1, String path2, String revision2, String localPath, boolean force, boolean recurse, boolean dryRun, boolean ignoreAncestry) throws CmdLineException { setCommand(ISVNNotifyListener.Command.MERGE, true); CmdArguments args = new CmdArguments(); args.add("merge"); if (!recurse) args.add("-N"); if (force) args.add("--force"); if (ignoreAncestry) args.add("--ignore-ancestry"); if (dryRun) args.add("--dry-run"); if (path1.equals(path2)) { args.add("-r"); args.add(validRev(revision1) + ":" + validRev(revision2)); args.add(path1); } else { args.add(path1 + "@" + validRev(revision1)); args.add(path2 + "@" + validRev(revision2)); } args.add(localPath); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); return execString(args,false); } /** ** Set propName to propVal on revision revision.
* * @param propName name of the property. * @param propValue New value to set propName to. * @param target Local path or URL to resource. * @param force If the propset should be forced. */ void revpropset(String propName, String propValue, String target, String revision, boolean force) throws CmdLineException { setCommand(ISVNNotifyListener.Command.PROPSET, false); CmdArguments args = new CmdArguments(); args.add("propset"); args.add(propName); args.add("--revprop"); args.add(propValue); args.add(target); args.add("-r"); args.add(revision); if (force) args.add("--force"); args.addAuthInfo(this.user, this.pass); args.addConfigInfo(this.configDir); execVoid(args); } /** * @param paths Represents either WC paths, or repository URIs. * @param comment The comment to use for the lock operation. * @param force Whether to include--force
in the
* command-line.
*/
String lock(Object[] paths, String comment, boolean force)
throws CmdLineException {
setCommand(ISVNNotifyListener.Command.LOCK, true);
CmdArguments args = new CmdArguments();
args.add("lock");
if (force)
args.add("--force");
if (comment != null && !comment.equals("")) {
args.add("-m");
args.add(comment);
}
args.addAuthInfo(this.user, this.pass);
args.addConfigInfo(this.configDir);
for (int i = 0; i < paths.length; i++) {
args.add(paths[i]);
}
return execString(args, false);
}
/**
* @param paths Represents either WC paths, or repository URIs.
* @param comment The comment to use for the lock operation.
* @param force Whether to include --force
in the
* command-line.
*/
String unlock(Object[] paths, boolean force) throws CmdLineException {
setCommand(ISVNNotifyListener.Command.UNLOCK, true);
CmdArguments args = new CmdArguments();
args.add("unlock");
if (force)
args.add("--force");
args.addAuthInfo(this.user, this.pass);
args.addConfigInfo(this.configDir);
for (int i = 0; i < paths.length;i++) {
args.add(paths[i]);
}
return execString(args,false);
}
/*
* (non-Javadoc)
* @see org.tigris.subversion.svnclientadapter.commandline.CommandLine#notifyFromSvnOutput(java.lang.String)
*/
protected void notifyFromSvnOutput(String svnOutput) {
this.rev = SVNRevision.SVN_INVALID_REVNUM;
// we call the super implementation : handles logMessage and logCompleted
super.notifyFromSvnOutput(svnOutput);
if (parseSvnOutput) {
// we parse the svn output
CmdLineNotify notify = new CmdLineNotify() {
public void onNotify(
String path,
int action,
int kind,
String mimeType,
int contentState,
int propState,
long revision) {
// we only call notifyListenersOfChange and logRevision
// logMessage and logCompleted have already been called
if (path != null) {
notificationHandler.notifyListenersOfChange(path);
}
if (revision != SVNRevision.SVN_INVALID_REVNUM) {
SvnCommandLine.this.rev = revision;
notificationHandler.logRevision(revision, path);
}
}
};
try {
svnOutputParser.addListener(notify);
svnOutputParser.parse(svnOutput);
} finally {
svnOutputParser.removeListener(notify);
}
}
}
/**
* We call the super implementation : handles logMessage and logCompleted.
* This method main reason is to provide subclasses way to call super.super.notifyFromSvnOutput()
* @param svnOutput
*/
protected void notifyMessagesFromSvnOutput(String svnOutput) {
this.rev = SVNRevision.SVN_INVALID_REVNUM;
// we call the super implementation : handles logMessage and logCompleted
super.notifyFromSvnOutput(svnOutput);
}
/**
* set the command used and tell if the svn ouput is notification
* that must be parsed using SvnOutputParser status
and info
information from
* the command-line.
*
* @author Cédric Chabanois (cchabanois at no-log.org)
* @author Daniel Rall
*/
public class CmdLineStatuses {
private CmdLineInfoPart[] cmdLineInfoParts;
private CmdLineStatusPart[] cmdLineStatusParts;
private ISVNStatus[] cmdLineStatuses;
CmdLineStatuses(String infoLines, CmdLineStatusPart[] cmdLineStatusParts) {
this.cmdLineStatusParts = cmdLineStatusParts;
if (infoLines.length() == 0) {
cmdLineInfoParts = new CmdLineInfoPart[0];
} else {
String[] parts = CmdLineInfoPart.parseInfoParts(infoLines);
cmdLineInfoParts = new CmdLineInfoPart[parts.length];
for (int i = 0; i < parts.length;i++) {
cmdLineInfoParts[i] = new CmdLineInfoPart(parts[i]);
}
}
this.cmdLineStatuses = buildStatuses();
}
CmdLineStatuses(CmdLineInfoPart[] cmdLineInfoParts,
CmdLineStatusPart[] cmdLineStatusParts) {
this.cmdLineInfoParts = cmdLineInfoParts;
this.cmdLineStatusParts = cmdLineStatusParts;
this.cmdLineStatuses = buildStatuses();
}
/**
* Procures status objects for the {@link #cmdLineStatuses}
* instance field.
*/
private ISVNStatus[] buildStatuses() {
processExternalStatuses(cmdLineStatusParts);
List statuses = new LinkedList();
for (int i = 0; i < cmdLineStatusParts.length; i++) {
CmdLineStatusPart cmdLineStatusPart = cmdLineStatusParts[i];
File absPath = cmdLineStatusPart.getFile();
if (cmdLineStatusPart == null || !cmdLineStatusPart.isManaged()) {
boolean isIgnored = false;
if (cmdLineStatusPart != null) {
isIgnored = SVNStatusKind.IGNORED.equals(cmdLineStatusPart.getTextStatus());
}
statuses.add(new SVNStatusUnversioned(absPath, isIgnored));
} else {
CmdLineInfoPart cmdLineInfoPart =
getCorrespondingInfoPart(absPath);
if (cmdLineInfoPart != null) {
statuses.add(new CmdLineStatusComposite(cmdLineStatusPart,
cmdLineInfoPart));
}
}
}
return (ISVNStatus [])
statuses.toArray(new ISVNStatus[statuses.size()]);
}
/**
* @param absPath The absolute path to an item which we have a
* status for.
* @return The info corresponding to the specified path, or
* null
if not found.
*/
private CmdLineInfoPart getCorrespondingInfoPart(File absPath) {
for (int i = 0; i < cmdLineInfoParts.length; i++) {
if (absPath.equals(cmdLineInfoParts[i].getFile())) {
return cmdLineInfoParts[i];
}
}
return null;
}
/**
* Post-process svn:externals statuses.
* commandline answer two sort of statuses on externals:
* - when ignoreExternals is set to true during call to status(),
* the returned status has textStatus set to EXTERNAL, but the url is null.