String[] localPaths = new String[getCommandLine().getPathCount()]; for (int i = 0; i < getCommandLine().getPathCount(); i++) { localPaths[i] = getCommandLine().getPathAt(i).replace(File.separatorChar, '/'); } final String homePath = localPaths.length == 1 ? localPaths[0] : PathUtil.getFSCommonRoot(localPaths);  List pathsList = new ArrayList(); String[] paths; try { for (int i = 0; i < getCommandLine().getPathCount(); i++) { String path = getCommandLine().getPathAt(i); pathsList.add(new File(path).getCanonicalPath().replace(File.separatorChar, '/')); } } catch (IOException e) { err.println("error: " + e.getMessage()); return; } DebugLog.log("commit paths: " + pathsList); paths = (String[]) pathsList.toArray(new String[pathsList.size()]);  String rootPath; if (pathsList.size() == 1 && new File((String) pathsList.get(0)).isDirectory()) { rootPath = (String) pathsList.get(0); } else { rootPath = PathUtil.getFSCommonRoot(paths); } DebugLog.log("commit root: " + rootPath);  final ISVNWorkspace workspace = createWorkspace(rootPath); for (Iterator commitPaths = pathsList.iterator(); commitPaths.hasNext();) { String commitPath = (String) commitPaths.next(); ISVNWorkspace ws = SVNUtil.createWorkspace(commitPath); if (ws == null || !ws.getID().equals(workspace.getID())) { throw new SVNException("can't commit items from different working copies"); } } for (int i = 0; i < paths.length; i++) { paths[i] = SVNUtil.getWorkspacePath(workspace, paths[i]); }
boolean keepLocks = getCommandLine().hasArgument(SVNArgument.NO_UNLOCK);
    public void run(final PrintStream out, PrintStream err) throws SVNException {        checkEditorCommand();        final boolean recursive = !getCommandLine().hasArgument(SVNArgument.NON_RECURSIVE);        String[] localPaths = new String[getCommandLine().getPathCount()];        for (int i = 0; i < getCommandLine().getPathCount(); i++) {            localPaths[i] = getCommandLine().getPathAt(i).replace(File.separatorChar, '/');        }        final String homePath = localPaths.length == 1 ? localPaths[0] : PathUtil.getFSCommonRoot(localPaths);        List pathsList = new ArrayList();        String[] paths;        try {            for (int i = 0; i < getCommandLine().getPathCount(); i++) {                String path = getCommandLine().getPathAt(i);                pathsList.add(new File(path).getCanonicalPath().replace(File.separatorChar, '/'));            }        } catch (IOException e) {            err.println("error: " + e.getMessage());            return;        }        DebugLog.log("commit paths: " + pathsList);        paths = (String[]) pathsList.toArray(new String[pathsList.size()]);        // only if path is not a single directory!        String rootPath;        if (pathsList.size() == 1 && new File((String) pathsList.get(0)).isDirectory()) {            rootPath = (String) pathsList.get(0);        } else {            rootPath = PathUtil.getFSCommonRoot(paths);        }        DebugLog.log("commit root: " + rootPath);        final ISVNWorkspace workspace = createWorkspace(rootPath);        for (Iterator commitPaths = pathsList.iterator(); commitPaths.hasNext();) {			String commitPath = (String) commitPaths.next();			ISVNWorkspace ws = SVNUtil.createWorkspace(commitPath);			if (ws == null || !ws.getID().equals(workspace.getID())) {				throw new SVNException("can't commit items from different working copies");			}		}        for (int i = 0; i < paths.length; i++) {            paths[i] = SVNUtil.getWorkspacePath(workspace, paths[i]);        }        final String message = getCommitMessage();        workspace.addWorkspaceListener(new SVNWorkspaceAdapter() {            public void committed(String committedPath, int kind) {                DebugLog.log("commit path: " + committedPath);                DebugLog.log("home path: " + homePath);                String verb = "Sending ";                if (kind == SVNStatus.ADDED) {                    verb = "Adding ";                    try {                        String mimeType = workspace.getPropertyValue(committedPath, SVNProperty.MIME_TYPE);                        if (mimeType != null && !mimeType.startsWith("text")) {                            verb += " (bin) ";                        }                        DebugLog.log("mimetype: " + mimeType);                    } catch (SVNException e1) {                        DebugLog.error(e1);                    }                } else if (kind == SVNStatus.DELETED) {                    verb = "Deleting ";                } else if (kind == SVNStatus.REPLACED) {                    verb = "Replacing ";                }                try {                    committedPath = convertPath(homePath, workspace, committedPath);                } catch (IOException e) {}                println(out, verb + committedPath);            }        });        final long[] rev = new long[1];        final String[] commitPaths = paths;        workspace.runCommand(new ISVNRunnable() {            public void run(ISVNWorkspace workspace) throws SVNException {                SVNCommitPacket packet = workspace.createCommitPacket(commitPaths, recursive, false);                rev[0] = workspace.commit(packet, getCommandLine().hasArgument(SVNArgument.NO_UNLOCK), message);            }        });        if (rev[0] >= 0) {            out.println("Committed revision " + rev[0] + ".");        }    }