ISVNEditor cancellableEditor = null; cancellableEditor = SVNCancellableEditor.newInstance(syncEditor, this, getDebugLog());
ISVNEditor cancellableEditor = SVNCancellableEditor.newInstance(syncEditor, this, getDebugLog());
    public void doSynchronize(SVNURL toURL) throws SVNException {        SVNRepository toRepos = createRepository(toURL, true);        checkIfRepositoryIsAtRoot(toRepos, toURL);        SVNException error = null;        lock(toRepos);        try {            SessionInfo info = openSourceRepository(toRepos);            SVNRepository fromRepos = info.myRepository;            long lastMergedRevision = info.myLastMergedRevision;            String currentlyCopying = toRepos.getRevisionPropertyValue(0, SVNRevisionProperty.CURRENTLY_COPYING);            long toLatestRevision = toRepos.getLatestRevision();            if (currentlyCopying != null) {                long copyingRev = Long.parseLong(currentlyCopying);                if (copyingRev < lastMergedRevision || copyingRev > lastMergedRevision + 1 || (toLatestRevision != lastMergedRevision && toLatestRevision != copyingRev)) {                    SVNErrorMessage err = SVNErrorMessage                            .create(                                    SVNErrorCode.IO_ERROR,                                    "Revision being currently copied ({0,number,integer}), last merged revision ({1,number,integer}), and destination HEAD ({2,number,integer}) are inconsistent; have you committed to the destination without using svnsync?",                                    new Long[] {                                            new Long(copyingRev), new Long(lastMergedRevision), new Long(toLatestRevision)                                    });                    SVNErrorManager.error(err);                } else if (copyingRev == toLatestRevision) {                    if (copyingRev > lastMergedRevision) {                        copyRevisionProperties(fromRepos, toRepos, toLatestRevision);                        lastMergedRevision = copyingRev;                    }                    toRepos.setRevisionPropertyValue(0, SVNRevisionProperty.LAST_MERGED_REVISION, SVNProperty.toString(lastMergedRevision));                    toRepos.setRevisionPropertyValue(0, SVNRevisionProperty.CURRENTLY_COPYING, null);                }             } else {                if (toLatestRevision != lastMergedRevision) {                    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Destination HEAD ({0,number,integer}) is not the last merged revision ({1,number,integer}); have you committed to the destination without using svnsync?", new Long[] {new Long(toLatestRevision), new Long(lastMergedRevision)});                    SVNErrorManager.error(err);                }            }            long fromLatestRevision = fromRepos.getLatestRevision();            if (fromLatestRevision < lastMergedRevision) {                return;            }            for (long currentRev = lastMergedRevision + 1; currentRev <= fromLatestRevision; currentRev++) {                toRepos.setRevisionPropertyValue(0, SVNRevisionProperty.CURRENTLY_COPYING, SVNProperty.toString(currentRev));//                ISVNEditor commitEditor = toRepos.getCommitEditor("", null, false, null);                SVNSynchronizeEditor syncEditor = new SVNSynchronizeEditor(toRepos, myHandler, currentRev - 1);                ISVNEditor cancellableEditor = null;                cancellableEditor = SVNCancellableEditor.newInstance(syncEditor, this, getDebugLog());                fromRepos.replay(0, currentRev, true, cancellableEditor);                if (syncEditor.getCommitInfo().getNewRevision() != currentRev) {                    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Commit created rev {0,number,integer} but should have created {1,number,integer}", new Long[] {                            new Long(syncEditor.getCommitInfo().getNewRevision()), new Long(currentRev)                    });                    SVNErrorManager.error(err);                }                copyRevisionProperties(fromRepos, toRepos, currentRev);                toRepos.setRevisionPropertyValue(0, SVNRevisionProperty.LAST_MERGED_REVISION, SVNProperty.toString(currentRev));                toRepos.setRevisionPropertyValue(0, SVNRevisionProperty.CURRENTLY_COPYING, null);            }        } finally {            try {                unlock(toRepos);            } catch (SVNException svne) {                error = svne;            }        }        if (error != null) {            throw error;        }    }