if (copyFromURL.startsWith("/")) { copyFromURL = copyFromURL.substring("/".length());
if (!copyFromURL.startsWith("/")) { copyFromURL = "/" + copyFromURL;
    public static void doCommit(String path, String url, Map entries, ISVNEditor editor, SVNWorkspace ws) throws SVNException {        ISVNEntry root = (ISVNEntry) entries.get(path);                long revision = root == null ? -1 : SVNProperty.longValue(root.getPropertyValue(SVNProperty.COMMITTED_REVISION));        if (root != null) {            root.setPropertyValue(SVNProperty.COMMITTED_REVISION, null);        }        if ("".equals(path)) {            DebugLog.log("ROOT OPEN: " + path);            editor.openRoot(-1);            if (root != null) {                if (root.sendChangedProperties(editor)) {                    ws.fireEntryCommitted(root, SVNStatus.MODIFIED);                }            }        } else if (root != null && root.isScheduledForAddition()) {            DebugLog.log("DIR ADD: " + path);            String copyFromURL = root.getPropertyValue(SVNProperty.COPYFROM_URL);            long copyFromRevision = -1;            if (copyFromURL != null) {                copyFromRevision = Long.parseLong(root.getPropertyValue(SVNProperty.COPYFROM_REVISION));                copyFromURL = copyFromURL.substring(url.length());                if (copyFromURL.startsWith("/")) {                    copyFromURL = copyFromURL.substring("/".length());                }            }            editor.addDir(path, copyFromURL, copyFromRevision);            root.sendChangedProperties(editor);            ws.fireEntryCommitted(root, SVNStatus.ADDED);        } else if (root != null && root.isPropertiesModified()) {            DebugLog.log("DIR OPEN: " + path + ", " + revision);            editor.openDir(path, revision);             if (root.sendChangedProperties(editor)) {                ws.fireEntryCommitted(root, SVNStatus.MODIFIED);            }        } else if (root == null) {            DebugLog.log("DIR OPEN (virtual): " + path + ", " + revision);            editor.openDir(path, revision);        }         String[] virtualChildren = getVirtualChildren(entries, path);        DebugLog.log("virtual children count: " + virtualChildren.length);        for(int i = 0; i < virtualChildren.length; i++) {            String childPath = virtualChildren[i];            doCommit(childPath, url, entries, editor, ws);        }        ISVNEntry[] children = getDirectChildren(entries, path);        DebugLog.log("direct children count: " + children.length);        ISVNEntry parent = null;        for(int i = 0; i < children.length; i++) {            ISVNEntry child = children[i];            if (parent == null) {                parent = ws.locateParentEntry(child.getPath());            }            String childPath = PathUtil.append(path, child.getName());            childPath = PathUtil.removeLeadingSlash(childPath);            childPath = PathUtil.removeTrailingSlash(childPath);            revision = SVNProperty.longValue(child.getPropertyValue(SVNProperty.COMMITTED_REVISION));                        if (child.isScheduledForAddition() && child.isScheduledForDeletion()) {                DebugLog.log("FILE REPLACE: " + childPath);                child.setPropertyValue(SVNProperty.COMMITTED_REVISION, null);                editor.deleteEntry(childPath, revision);                updateReplacementSchedule(child);                if (child.isDirectory()) {                    doCommit(childPath, url, entries, editor, ws);                                    } else {                    editor.addFile(childPath, null, -1);                    child.sendChangedProperties(editor);                    child.asFile().generateDelta(editor);                    editor.closeFile(null);                }                ws.fireEntryCommitted(child, SVNStatus.REPLACED);                DebugLog.log("FILE REPLACE: DONE");            } else if (child.isScheduledForDeletion()) {                DebugLog.log("FILE DELETE: " + childPath);                child.setPropertyValue(SVNProperty.COMMITTED_REVISION, null);                if (child.getPropertyValue(SVN_ENTRY_REPLACED) != null) {                    DebugLog.log("FILE NOT DELETED, PARENT WAS REPLACED");                } else {                    editor.deleteEntry(childPath, revision);                    ws.fireEntryCommitted(child, SVNStatus.DELETED);                    DebugLog.log("FILE DELETE: DONE");                }            } else if (child.isDirectory()) {                doCommit(childPath, url, entries, editor, ws);            } else {                if (child.isScheduledForAddition()) {                    DebugLog.log("FILE ADD: " + childPath);                    child.setPropertyValue(SVNProperty.COMMITTED_REVISION, null);                    String copyFromURL = child.getPropertyValue(SVNProperty.COPYFROM_URL);                    long copyFromRevision = -1;                    if (copyFromURL != null) {                        copyFromRevision = Long.parseLong(child.getPropertyValue(SVNProperty.COPYFROM_REVISION));                        DebugLog.log("copyfrom path:" + copyFromURL);                        copyFromURL = copyFromURL.substring(url.length());                        if (copyFromURL.startsWith("/")) {                            copyFromURL = copyFromURL.substring("/".length());                        }                        DebugLog.log("copyfrom path:" + copyFromURL);                    }                    editor.addFile(childPath, copyFromURL, copyFromRevision);                    child.sendChangedProperties(editor);                    String digest = child.asFile().generateDelta(editor);                    editor.closeFile(digest);                                        ws.fireEntryCommitted(child, SVNStatus.ADDED);                    DebugLog.log("FILE ADD: DONE");                } else if (child.asFile().isContentsModified() || child.isPropertiesModified()) {                    DebugLog.log("FILE COMMIT: " + childPath + " : " + revision);                    child.setPropertyValue(SVNProperty.COMMITTED_REVISION, null);                    editor.openFile(childPath, revision);                    child.sendChangedProperties(editor);                    String digest = null;                    if (child.asFile().isContentsModified()) {                        digest = child.asFile().generateDelta(editor);                    }                    editor.closeFile(digest);                    ws.fireEntryCommitted(child, SVNStatus.MODIFIED);                    DebugLog.log("FILE COMMIT: DONE: " + digest);                }            }        }        DebugLog.log("DIR CLOSE: " + path);        editor.closeDir();    }