editor.addDir(newPath, srcPath, revNumber); editor.closeDir();
if (srcNodeKind == SVNNodeKind.DIR) { editor.addDir(newPath, srcPath, revNumber); editor.closeDir(); } else { DebugLog.log("adding file " + srcPath); editor.addFile(newPath, srcPath, revNumber); editor.closeFile(null); }
    public void copy(String srcPath, String destPath, String message, Revision revision) throws ClientException {        if (isURL(srcPath) && isURL(destPath)) {            ISVNEditor editor = null;        	String srcURL = srcPath;        	String dstURL = destPath;            try {                String newPath = PathUtil.tail(destPath);                newPath = PathUtil.removeLeadingSlash(newPath);                newPath = PathUtil.decode(newPath);                String root = PathUtil.removeTail(destPath);                SVNRepository repository = createRepository(root);                long revNumber = getRevisionNumber(revision, repository, null, null);                                SVNRepositoryLocation srcLocation = SVNRepositoryLocation.parseURL(srcPath);                srcPath = srcLocation.getPath();                srcPath = PathUtil.decode(srcPath);                if (repository.getRepositoryRoot() == null) {                    repository.testConnection();                }                srcPath = srcPath.substring(repository.getRepositoryRoot().length());                if (!srcPath.startsWith("/")) {                    srcPath += "/";                }                SVNNodeKind nodeKind = repository.checkPath(newPath, -1);            	String newPathParent = null;                if (nodeKind == SVNNodeKind.DIR) {                	DebugLog.log("path " + newPath + " already exists and its a dir");					newPathParent = newPath;                 	newPath = PathUtil.tail(srcURL);                	newPath = PathUtil.append(newPathParent, newPath);                    nodeKind = repository.checkPath(newPath, -1);                    if (nodeKind == SVNNodeKind.DIR) {                    	throwException(new SVNException("can't copy to '" + PathUtil.append(dstURL, newPath) + "', location already exists"));                    }                }                editor = repository.getCommitEditor(message, null);                editor.openRoot(-1);                if (newPathParent != null) {                	editor.openDir(newPathParent, -1);                }                editor.addDir(newPath, srcPath, revNumber);                editor.closeDir();                if (newPathParent != null) {                	editor.closeDir();                }                editor.closeDir();                editor.closeEdit();            } catch (SVNException e) {                if (editor != null) {                    try {                        editor.abortEdit();                    } catch (SVNException es) {}                }                throwException(e);            }        } else if (!isURL(srcPath) && !isURL(destPath)) {            try {            	String wsRoot = PathUtil.getCommonRoot(new String[] {srcPath, destPath});                ISVNWorkspace ws = createWorkspace(wsRoot);                ws.addWorkspaceListener(new LocalWorkspaceListener(myNotify, ws));                ws.copy(SVNUtil.getWorkspacePath(ws, srcPath), SVNUtil.getWorkspacePath(ws, destPath), false);            } catch (SVNException e) {                throwException(e);            }        } else {            throw new ClientException("only WC->WC or URL->URL copy is supported", "", 0);        }    }