long histStart = startRevision; long histEnd = endRevision;
    public long log(String[] targetPaths, long startRevision, long endRevision, boolean discoverChangedPaths, boolean strictNode, long limit, ISVNLogEntryHandler handler) throws SVNException {        try {            openRepository();            if (targetPaths == null || targetPaths.length == 0) {                targetPaths = new String[] {""};            }            String[] absPaths = new String[targetPaths.length];            for (int i = 0; i < targetPaths.length; i++) {                absPaths[i] = getRepositoryPath(targetPaths[i]);            }            long histStart = startRevision;            long histEnd = endRevision;            long youngestRev = myFSFS.getYoungestRevision();                        if (isInvalidRevision(startRevision)) {                startRevision = youngestRev;            }                        if (isInvalidRevision(endRevision)) {                endRevision = youngestRev;            }            if (startRevision > youngestRev) {                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NO_SUCH_REVISION, "No such revision {0,number,integer}", new Long(startRevision));                SVNErrorManager.error(err);            }            if (endRevision > youngestRev) {                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NO_SUCH_REVISION, "No such revision {0,number,integer}", new Long(endRevision));                SVNErrorManager.error(err);            }            if (startRevision > endRevision) {                histStart = endRevision;                histEnd = startRevision;            }            long sendCount = 0;            if (absPaths.length == 1 && "/".equals(absPaths[0])) {                sendCount = histEnd - histStart + 1;                if (limit != 0 && sendCount > limit) {                    sendCount = limit;                }                for (int i = 0; i < sendCount; i++) {                    long rev = histStart + i;                    if (startRevision > endRevision) {                        rev = histEnd - i;                    }                    if (handler != null) {                        sendChanges(rev, discoverChangedPaths, handler);                    }                }                return sendCount;            }            LinkedList histories = new LinkedList();            FSRevisionRoot root = myFSFS.createRevisionRoot(histEnd);            for (int i = 0; i < absPaths.length; i++) {                String path = absPaths[i];                FSNodeHistory hist = FSNodeHistory.getNodeHistory(root, path);                LogPathInfo info = new LogPathInfo(hist);                info.pickUpNextHistory(strictNode, histStart);                histories.addLast(info);            }            LinkedList revisions = null;            boolean anyHistoriesLeft = true;            for (long currentRev = histEnd; currentRev >= histStart && anyHistoriesLeft; currentRev = getNextHistoryRevision(histories)) {                boolean changed = false;                anyHistoriesLeft = false;                for (ListIterator infoes = histories.listIterator(); infoes.hasNext();) {                    LogPathInfo info = (LogPathInfo) infoes.next();                    if (info.checkHistory(currentRev, strictNode, histStart)) {                        changed = true;                    }                                        if (info.getHistory() != null) {                        anyHistoriesLeft = true;                    }                }                if (changed) {                    if (startRevision > endRevision) {                        if (handler != null) {                            sendChanges(currentRev, discoverChangedPaths, handler);                        }                        if (limit != 0 && ++sendCount >= limit) {                            break;                        }                    } else {                        if (revisions == null) {                            revisions = new LinkedList();                        }                        revisions.addFirst(new Long(currentRev));                    }                }            }            if (revisions != null) {                int i = 0;                for (ListIterator revs = revisions.listIterator(); revs.hasNext();) {                    sendChanges(((Long) revs.next()).longValue(), discoverChangedPaths, handler);                    if (limit != 0 && ++i >= limit) {                        break;                    }                }                return i;            }            return sendCount;        } finally {            closeRepository();        }    }