if (handler == null) { return -1; } SVNWCAccess wcAccess = createWCAccess(path); wcAccess.open(false, recursive); Map parentExternals = new HashMap(); if (collectParentExternals) { parentExternals = collectParentExternals(path, wcAccess.getAnchor() != wcAccess.getTarget()); SVNExternalInfo thisExternal = (SVNExternalInfo) parentExternals.remove(""); if (thisExternal != null) {  handler.handleStatus(new SVNStatus(null, path, SVNNodeKind.DIR, SVNRevision.UNDEFINED, SVNRevision.UNDEFINED, null, null, SVNStatusType.STATUS_EXTERNAL, SVNStatusType.STATUS_NONE, SVNStatusType.STATUS_NONE, SVNStatusType.STATUS_NONE, false, false, false, null, null, null, null, null, SVNRevision.UNDEFINED, null, null, null)); } } final boolean[] deletedInRepos = new boolean[] {false}; ISVNStatusHandler realHandler = new ISVNStatusHandler() { public void handleStatus(SVNStatus status) { if (deletedInRepos[0]) { status.setRemoteStatus(SVNStatusType.STATUS_DELETED, null, null, null); } handler.handleStatus(status); } }; SVNStatusEditor statusEditor = new SVNStatusEditor(getOptions(), wcAccess, realHandler, parentExternals, includeIgnored, reportAll, recursive); if (remote) { SVNURL url = wcAccess.getAnchor().getEntries().getEntry("", true).getSVNURL(); SVNRepository repos = createRepository(url, true); SVNNodeKind kind = repos.checkPath("", -1); if (kind == SVNNodeKind.NONE) { deletedInRepos[0] = true; } else { SVNRepository locksRepos = createRepository(url, false);  SVNReporter reporter = new SVNReporter(wcAccess, false, recursive); SVNStatusReporter statusReporter = new SVNStatusReporter(locksRepos, reporter, statusEditor); String target = "".equals(wcAccess.getTargetName()) ? null : wcAccess.getTargetName();  repos.status(-1, target, recursive, statusReporter, SVNCancellableEditor.newInstance(statusEditor, this)); } }  statusEditor.closeEdit(); if (remote && statusEditor.getTargetRevision() >= 0) { SVNEvent event = SVNEventFactory.createStatusCompletedEvent(wcAccess, statusEditor.getTargetRevision()); handleEvent(event, ISVNEventHandler.UNKNOWN); } wcAccess.close(false); if (!isIgnoreExternals() && recursive) { Map externals = statusEditor.getCollectedExternals(); for (Iterator paths = externals.keySet().iterator(); paths.hasNext();) { String externalPath = (String) paths.next(); File externalFile = new File(wcAccess.getAnchor().getRoot(),externalPath); if (!externalFile.exists() || !externalFile.isDirectory() || !SVNWCUtil.isWorkingCopyRoot(externalFile, true)) { continue; } handleEvent(SVNEventFactory.createStatusExternalEvent(wcAccess, externalPath), ISVNEventHandler.UNKNOWN); setEventPathPrefix(externalPath); try { doStatus(externalFile, recursive, remote, reportAll, includeIgnored, false, handler); } catch (SVNException e) {  } finally { setEventPathPrefix(externalPath); } } } return statusEditor.getTargetRevision();
doStatus(path, recursive, remote, reportAll, includeIgnored, false, handler);
    public long doStatus(File path, boolean recursive, boolean remote,                         boolean reportAll, boolean includeIgnored,                         boolean collectParentExternals, final ISVNStatusHandler handler)            throws SVNException {        if (handler == null) {            return -1;        }        SVNWCAccess wcAccess = createWCAccess(path);        wcAccess.open(false, recursive);        Map parentExternals = new HashMap();        if (collectParentExternals) {            parentExternals = collectParentExternals(path, wcAccess.getAnchor() != wcAccess.getTarget());            SVNExternalInfo thisExternal = (SVNExternalInfo) parentExternals.remove("");            if (thisExternal != null) {                // report this as external first.                handler.handleStatus(new SVNStatus(null, path, SVNNodeKind.DIR,                                                   SVNRevision.UNDEFINED, SVNRevision.UNDEFINED, null,                                                   null, SVNStatusType.STATUS_EXTERNAL,                                                   SVNStatusType.STATUS_NONE, SVNStatusType.STATUS_NONE,                                                   SVNStatusType.STATUS_NONE, false, false, false, null,                                                   null, null, null, null, SVNRevision.UNDEFINED, null,                                                   null, null));            }        }        final boolean[] deletedInRepos = new boolean[] {false};        ISVNStatusHandler realHandler = new ISVNStatusHandler() {            public void handleStatus(SVNStatus status) {                if (deletedInRepos[0]) {                    status.setRemoteStatus(SVNStatusType.STATUS_DELETED, null, null, null);                }                handler.handleStatus(status);            }        };        SVNStatusEditor statusEditor = new SVNStatusEditor(getOptions(), wcAccess, realHandler, parentExternals, includeIgnored, reportAll, recursive);        if (remote) {            SVNURL url = wcAccess.getAnchor().getEntries().getEntry("", true).getSVNURL();            SVNRepository repos = createRepository(url, true);            SVNNodeKind kind = repos.checkPath("", -1);            if (kind == SVNNodeKind.NONE) {                deletedInRepos[0] = true;            } else {                SVNRepository locksRepos = createRepository(url, false);                    SVNReporter reporter = new SVNReporter(wcAccess, false, recursive);                SVNStatusReporter statusReporter = new SVNStatusReporter(locksRepos, reporter, statusEditor);                String target = "".equals(wcAccess.getTargetName()) ? null : wcAccess.getTargetName();                    repos.status(-1, target, recursive, statusReporter, SVNCancellableEditor.newInstance(statusEditor, this));            }        }        // to report all when there is completely no changes        statusEditor.closeEdit();        if (remote && statusEditor.getTargetRevision() >= 0) {            SVNEvent event = SVNEventFactory.createStatusCompletedEvent(wcAccess, statusEditor.getTargetRevision());            handleEvent(event, ISVNEventHandler.UNKNOWN);        }        wcAccess.close(false);        if (!isIgnoreExternals() && recursive) {            Map externals = statusEditor.getCollectedExternals();            for (Iterator paths = externals.keySet().iterator(); paths.hasNext();) {                String externalPath = (String) paths.next();                File externalFile = new File(wcAccess.getAnchor().getRoot(),externalPath);                if (!externalFile.exists() || !externalFile.isDirectory() || !SVNWCUtil.isWorkingCopyRoot(externalFile, true)) {                    continue;                }                handleEvent(SVNEventFactory.createStatusExternalEvent(wcAccess, externalPath), ISVNEventHandler.UNKNOWN);                setEventPathPrefix(externalPath);                try {                    doStatus(externalFile, recursive, remote, reportAll, includeIgnored, false, handler);                } catch (SVNException e) {                    // fire error event.                } finally {                    setEventPathPrefix(externalPath);                }            }        }        return statusEditor.getTargetRevision();    }