if (wcAccess.getAnchor().getProperties(entry.getName(), false).getPropertyValue(SVNProperty.EXECUTABLE) != null) { SVNFileUtil.setExecutable(wcAccess.getAnchor().getFile(entry.getName()), true); }
    public void doLock(File[] paths, boolean stealLock, String lockMessage) throws SVNException {        final Map entriesMap = new HashMap();        for (int i = 0; i < paths.length; i++) {            SVNWCAccess wcAccess = createWCAccess(paths[i]);            try {                wcAccess.open(false, false);                SVNEntry entry = wcAccess.getTargetEntry();                if (entry == null || entry.isHidden()) {                    SVNErrorManager.error("svn: '" + entry.getName() + "' is not under version control");                }                if (entry.getURL() == null) {                    SVNErrorManager.error("svn: '" + entry.getName() + "' has no URL");                }                SVNRevision revision = stealLock ? SVNRevision.UNDEFINED : SVNRevision.create(entry.getRevision());                entriesMap.put(entry.getSVNURL(), new LockInfo(paths[i], revision));            } finally {                wcAccess.close(false);            }        }        checkCancelled();        SVNURL[] urls = (SVNURL[]) entriesMap.keySet().toArray(new SVNURL[entriesMap.size()]);        Collection urlPaths = new HashSet();        final SVNURL topURL = SVNURLUtil.condenceURLs(urls, urlPaths, false);        if (urlPaths.isEmpty()) {            urlPaths.add("");        }        if (topURL == null) {            SVNErrorManager.error("svn: Paths belong to different repositories");        }        // convert encoded paths to path->revision map.        Map pathsRevisionsMap = new HashMap();        for(Iterator encodedPaths = urlPaths. iterator(); encodedPaths.hasNext();) {            String encodedPath = (String) encodedPaths.next();            // get LockInfo for it.            SVNURL fullURL = topURL.appendPath(encodedPath, true);            LockInfo lockInfo = (LockInfo) entriesMap.get(fullURL);            encodedPath = SVNEncodingUtil.uriDecode(encodedPath);            if (lockInfo.myRevision == SVNRevision.UNDEFINED) {                pathsRevisionsMap.put(encodedPath, null);            } else {                pathsRevisionsMap.put(encodedPath, new Long(lockInfo.myRevision.getNumber()));            }        }        SVNRepository repository = createRepository(topURL, true);        SVNDebugLog.logInfo("top url is: " + topURL);        final SVNURL rootURL = repository.getRepositoryRoot(true);        SVNDebugLog.logInfo("root url is: " + rootURL);        repository.lock(pathsRevisionsMap, lockMessage, stealLock, new ISVNLockHandler() {            public void handleLock(String path, SVNLock lock, SVNException error) throws SVNException {                SVNURL fullURL = rootURL.appendPath(path, false);                SVNDebugLog.logInfo("updating locked file with path: " + path);                SVNDebugLog.logInfo("updating locked file with url: " + fullURL);                LockInfo lockInfo = (LockInfo) entriesMap.get(fullURL);                SVNDebugLog.logInfo("lock info is: " + lockInfo);                SVNDebugLog.logInfo("lock info file: " + lockInfo.myFile);                SVNWCAccess wcAccess = createWCAccess(lockInfo.myFile);                if (error == null) {                    try {                        wcAccess.open(true, false);                        SVNEntry entry = wcAccess.getTargetEntry();                        entry.setLockToken(lock.getID());                        entry.setLockComment(lock.getComment());                        entry.setLockOwner(lock.getOwner());                        entry.setLockCreationDate(SVNTimeUtil.formatDate(lock.getCreationDate()));                        if (wcAccess.getAnchor().getProperties(entry.getName(), false).getPropertyValue(SVNProperty.NEEDS_LOCK) != null) {                            SVNFileUtil.setReadonly(wcAccess.getAnchor().getFile(entry.getName()), false);                        }                        wcAccess.getAnchor().getEntries().save(true);                        wcAccess.getAnchor().getEntries().close();                        handleEvent(SVNEventFactory.createLockEvent(wcAccess, wcAccess.getTargetName(), SVNEventAction.LOCKED, lock, null),                                ISVNEventHandler.UNKNOWN);                    } finally {                        wcAccess.close(true);                    }                } else {                    handleEvent(SVNEventFactory.createLockEvent(wcAccess, wcAccess.getTargetName(), SVNEventAction.LOCK_FAILED, lock, error.getMessage()),                             ISVNEventHandler.UNKNOWN);                }            }            public void handleUnlock(String path, SVNLock lock, SVNException error) {            }        });    }