DebugLog.log("wc root of " + path + " is " + newWCRoot);
    public static SVNWCAccess createCommitWCAccess(File[] paths, boolean recursive, boolean force, Collection relativePaths) throws SVNException {        File wcRoot = null;        for (int i = 0; i < paths.length; i++) {            File path = paths[i];            File newWCRoot = SVNWCUtil.getWorkingCopyRoot(path, true);            if (wcRoot != null && !wcRoot.equals(newWCRoot)) {                SVNErrorManager.error("svn: commit targets should belong to the same working copy");            }            wcRoot = newWCRoot;        }        String[] validatedPaths = new String[paths.length];        for (int i = 0; i < paths.length; i++) {            File file = paths[i];            validatedPaths[i] = SVNPathUtil.validateFilePath(file.getAbsolutePath());        }        String rootPath = SVNPathUtil.condencePaths(validatedPaths, relativePaths, recursive);        if (rootPath == null) {            return null;        }        File baseDir = new File(rootPath);        Collection dirsToLock = new TreeSet(); // relative paths to lock.        Collection dirsToLockRecursively = new TreeSet(); // relative paths to lock.        boolean lockAll = false;        if (relativePaths.isEmpty()) {            String target = getTargetName(new File(rootPath));            if (!"".equals(target)) {                // we will have to lock target as well, not only base dir.                SVNFileType targetType = SVNFileType.getType(new File(rootPath));                relativePaths.add(target);                if (targetType == SVNFileType.DIRECTORY) {                    if (recursive) {                        dirsToLockRecursively.add(target);                    } else {                        dirsToLock.add(target);                    }                }                baseDir = baseDir.getParentFile();            } else {                lockAll = true;            }        } else {            baseDir = adjustRelativePaths(baseDir, relativePaths);            // there are multiple paths.            DebugLog.log("targets : " + relativePaths);            DebugLog.log("base dir: " + baseDir);            for (Iterator targets = relativePaths.iterator(); targets.hasNext();) {                String targetPath = (String) targets.next();                File targetFile = new File(baseDir, targetPath);                String target = getTargetName(targetFile);                if (!"".equals(target)) {                    SVNFileType targetType = SVNFileType.getType(targetFile);                    if (targetType == SVNFileType.DIRECTORY) {                        if (recursive) {                            dirsToLockRecursively.add(targetPath);                        } else {                            dirsToLock.add(targetPath);                        }                    }                }                // now lock all dirs from anchor to base dir (non-recursive).                while(targetFile != null && !baseDir.equals(targetFile) && !PathUtil.isEmpty(targetPath)) {                    dirsToLock.add(targetPath);                    targetFile = targetFile.getParentFile();                    targetPath = PathUtil.removeTail(targetPath);                }            }        }        SVNDirectory anchor = new SVNDirectory(null, "", baseDir);        SVNWCAccess baseAccess = new SVNWCAccess(anchor, anchor, "");        if (!recursive && !force) {            SVNStatusClient statusClient = new SVNStatusClient();            for (Iterator targets = relativePaths.iterator(); targets.hasNext();) {                String targetPath = (String) targets.next();                File targetFile = new File(baseDir, targetPath);                if (SVNFileType.getType(targetFile) == SVNFileType.DIRECTORY) {                    try {                        SVNStatus status = statusClient.doStatus(targetFile, false);                        if (status != null &&                                (status.getContentsStatus() == SVNStatusType.STATUS_DELETED || status.getContentsStatus() == SVNStatusType.STATUS_REPLACED)) {                            SVNErrorManager.error("svn: Cannot non-recursively commit a directory deletion");                        }                    } catch (SVNException e) {                        SVNErrorManager.error(0, e);                    }                }            }        }        try {            if (lockAll) {                baseAccess.open(true, recursive);            } else {                baseAccess.open(true, false);                removeRedundantPaths(dirsToLockRecursively, dirsToLock);                for (Iterator nonRecusivePaths = dirsToLock.iterator(); nonRecusivePaths.hasNext();) {                    String path = (String) nonRecusivePaths.next();                    File pathFile = new File(baseDir, path);                    baseAccess.addDirectory(path, pathFile, false, true);                }                for (Iterator recusivePaths = dirsToLockRecursively.iterator(); recusivePaths.hasNext();) {                    String path = (String) recusivePaths.next();                    File pathFile = new File(baseDir, path);                    baseAccess.addDirectory(path, pathFile, true, true);                }            }        } catch (SVNException e) {            baseAccess.close(true);            throw e;        }        return baseAccess;    }