Examples of SVNLock


Examples of org.tmatesoft.svn.core.SVNLock

                        }

                        locks = locks == null ? new SVNLock[0] : locks;
                        Map locksMap = new SVNHashMap();
                        for (int i = 0; i < locks.length; i++) {
                            SVNLock lock = locks[i];
                            locksMap.put(lock.getPath(), lock);
                        }

                        pushDirInfo(repos, SVNRevision.create(revNum[0]), "", repos.getRepositoryRoot(true),
                                reposUUID, url, locksMap, depth, handler);
                        return;
                    }
                    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE,
                            "Server does not support retrieving information about the repository root");
                    SVNErrorManager.error(err, SVNLogType.WC);
                }
               
                SVNNodeKind urlKind = repos.checkPath("", revNum[0]);
                if (urlKind == SVNNodeKind.NONE) {
                    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_ILLEGAL_URL,
                            "URL ''{0}'' non-existent in revision {1}",
                            new Object[]{ url, new Long(revNum[0]) });
                    SVNErrorManager.error(err, SVNLogType.WC);
                }
               
                SVNRepository parentRepos = createRepository(url.removePathTail(), null, null, false);
                Collection dirEntries = parentRepos.getDir("", revNum[0], null, SVNDirEntry.DIRENT_KIND |
                        SVNDirEntry.DIRENT_CREATED_REVISION | SVNDirEntry.DIRENT_TIME |
                        SVNDirEntry.DIRENT_LAST_AUTHOR, ( Collection )null);
               
                for (Iterator ents = dirEntries.iterator(); ents.hasNext();) {
                    SVNDirEntry dirEntry = (SVNDirEntry) ents.next();
                    // dir entry name may differ from 'name', due to renames...
                    if (baseName.equals(dirEntry.getName())) {
                        rootEntry = dirEntry;
                        break;
                    }
                }
                if (rootEntry == null) {
                    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_ILLEGAL_URL,
                            "URL ''{0}'' non-existent in revision {1}",
                            new Object[]{ url, new Long(revNum[0]) });
                    SVNErrorManager.error(err, SVNLogType.WC);
                }
            } else {
                throw e;
            }
        }
       
        if (rootEntry == null || rootEntry.getKind() == SVNNodeKind.NONE) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.RA_ILLEGAL_URL,
                    "URL ''{0}'' non-existent in revision ''{1}''",
                    new Object[]{ url, new Long(revNum[0]) });
            SVNErrorManager.error(err, SVNLogType.WC);
        }

        SVNLock lock = null;
        if (rootEntry.getKind() == SVNNodeKind.FILE) {
            try {
                SVNRepositoryLocation[] locations = getLocations(url, null, null, SVNRevision.create(revNum[0]), SVNRevision.HEAD, SVNRevision.UNDEFINED);
                if (locations != null && locations.length > 0) {
                    SVNURL headURL = locations[0].getURL();
                    if (headURL.equals(url)) {
                        // get lock for this item (@headURL).
                        try {
                            lock = repos.getLock("");
                        } catch (SVNException e) {
                            if (!(e.getErrorMessage() != null &&
                                    e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_NOT_IMPLEMENTED)) {
                                throw e;
                            }
                        }
                    }
                }
            } catch (SVNException e) {
                SVNErrorCode code = e.getErrorMessage().getErrorCode();
                if (code != SVNErrorCode.FS_NOT_FOUND && code != SVNErrorCode.CLIENT_UNRELATED_RESOURCES) {
                    throw e;
                }
            }
        }

        SVNInfo info = SVNInfo.createInfo(baseName, reposRoot, reposUUID, url, SVNRevision.create(revNum[0]), rootEntry, lock);
        handler.handleInfo(info);
       
        if (depth.compareTo(SVNDepth.EMPTY) > 0 && rootEntry.getKind() == SVNNodeKind.DIR) {
            SVNLock[] locks = null;
            if (pegRevision == SVNRevision.HEAD) {
                try {
                    locks = repos.getLocks("");
                } catch (SVNException svne) {
                    SVNErrorCode code = svne.getErrorMessage().getErrorCode();
                    if (code == SVNErrorCode.RA_NOT_IMPLEMENTED ||
                            code == SVNErrorCode.UNSUPPORTED_FEATURE) {
                        locks = new SVNLock[0];
                    } else {
                        throw svne;
                    }
                }
            } else {
                locks = new SVNLock[0];
            }

            locks = locks == null ? new SVNLock[0] : locks;
            Map locksMap = new SVNHashMap();
            for (int i = 0; i < locks.length; i++) {
                lock = locks[i];
                locksMap.put(lock.getPath(), lock);
            }

            pushDirInfo(repos, SVNRevision.create(revNum[0]), "", repos.getRepositoryRoot(true),
                    reposUUID, url, locksMap, depth, handler);
        }
View Full Code Here

Examples of org.tmatesoft.svn.core.SVNLock

                displayPath = displayPath.substring(1);
            }
            if ("".equals(displayPath)) {
                displayPath = path;
            }
            SVNLock lock = (SVNLock) locks.get(path);
            SVNInfo info = SVNInfo.createInfo(displayPath, root, uuid, url, rev, child, lock);
            if (depth.compareTo(SVNDepth.IMMEDIATES) >= 0 || (depth == SVNDepth.FILES &&
                    child.getKind() == SVNNodeKind.FILE)) {
                handler.handleInfo(info);   
            }
View Full Code Here

Examples of org.tmatesoft.svn.core.SVNLock

    private Map fetchLockTokens(SVNRepository repository, Map pathsTokensMap) throws SVNException {
        Map tokens = new SVNHashMap();
        for (Iterator paths = pathsTokensMap.keySet().iterator(); paths.hasNext();) {
            String path = (String) paths.next();
            SVNLock lock = repository.getLock(path);
            if (lock == null || lock.getID() == null) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_MISSING_LOCK_TOKEN, "''{0}'' is not locked", path);
                SVNErrorManager.error(err, SVNLogType.WC);
                continue;
            }
            tokens.put(path, lock.getID());
        }
        return tokens;
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.SVNLock

        boolean isFileExternal = false;
       
        SVNStatusType textStatus = SVNStatusType.STATUS_NORMAL;
        SVNStatusType propStatus = SVNStatusType.STATUS_NONE;
       
        SVNLock repositoryLock = null;
       
        if (repositoryLocks != null) {
            SVNURL url = null;
            if (entry != null && entry.getSVNURL() != null) {
                url = entry.getSVNURL();
            } else if (parentEntry != null && parentEntry.getSVNURL() != null) {
                url = parentEntry.getSVNURL().appendPath(file.getName(), false);
            }
            if (url != null) {
                repositoryLock = getLock(repositoryLocks, url, reposRoot);
            }
        }
       
        if (fileKind == SVNNodeKind.UNKNOWN || fileKind == null) {
            SVNFileType fileType = SVNFileType.getType(file);
            fileKind = SVNFileType.getNodeKind(fileType);
            special = !SVNFileUtil.symlinksSupported() ? false : fileType == SVNFileType.SYMLINK;
        }
       
        SVNTreeConflictDescription treeConflict = wcAccess.getTreeConflict(file);
        if (entry == null) {
            SVNStatus status = new SVNStatus(null, file, SVNNodeKind.UNKNOWN,
                    SVNRevision.UNDEFINED, SVNRevision.UNDEFINED, null, null, SVNStatusType.STATUS_NONE,
                    SVNStatusType.STATUS_NONE, SVNStatusType.STATUS_NONE, SVNStatusType.STATUS_NONE, false,
                    false, false, false, null, null, null, null, null, SVNRevision.UNDEFINED, repositoryLock, null,
                    null, null, -1, treeConflict);
            status.setRemoteStatus(SVNStatusType.STATUS_NONE, SVNStatusType.STATUS_NONE, repositoryLock, SVNNodeKind.NONE);
            SVNStatusType text = SVNStatusType.STATUS_NONE;
            SVNFileType fileType = SVNFileType.getType(file);
            if (fileType != SVNFileType.NONE) {
                text = isIgnored ? SVNStatusType.STATUS_IGNORED : SVNStatusType.STATUS_UNVERSIONED;
            }
            if (fileType == SVNFileType.NONE && treeConflict != null) {
                text = SVNStatusType.STATUS_MISSING;
            }
            status.setContentsStatus(text);
            return status;
        }
        if (entry.getKind() == SVNNodeKind.DIR) {
            if (fileKind == SVNNodeKind.DIR) {
                if (wcAccess.isMissing(file)) {
                    textStatus = SVNStatusType.STATUS_OBSTRUCTED;
                }
            } else if (fileKind != SVNNodeKind.NONE) {
                textStatus = SVNStatusType.STATUS_OBSTRUCTED;
            }
        }
       
        if (entry.getExternalFilePath() != null) {
            isFileExternal = true;
        } else if (entry.getSVNURL() != null && parentEntry != null && parentEntry.getSVNURL() != null) {
            String urlName = SVNPathUtil.tail(entry.getSVNURL().getURIEncodedPath());
            if (!SVNEncodingUtil.uriEncode(file.getName()).equals(urlName)) {
                isSwitched = true;
            }
            if (!isSwitched && !entry.getSVNURL().removePathTail().equals(parentEntry.getSVNURL())) {
                isSwitched = true;
            }
        }
        if (textStatus != SVNStatusType.STATUS_OBSTRUCTED) {
            String name = entry.getName();
            if (dir != null && dir.hasProperties(name)) {
                propStatus = SVNStatusType.STATUS_NORMAL;
                hasProps = true;
            }
            isPropsModified = dir != null && dir.hasPropModifications(name);
            if (hasProps) {
                isSpecial = dir != null && dir.getProperties(name).getPropertyValue(SVNProperty.SPECIAL) != null;
            }
            if (entry.getKind() == SVNNodeKind.FILE && special == isSpecial) {
                isTextModified = dir != null && dir.hasTextModifications(name, false);
            }
            if (isTextModified) {
                textStatus = SVNStatusType.STATUS_MODIFIED;
            }
            if (isPropsModified) {
                propStatus = SVNStatusType.STATUS_MODIFIED;
            }
            if (entry.getPropRejectFile() != null ||
                    entry.getConflictOld() != null || entry.getConflictNew() != null || entry.getConflictWorking() != null) {
                if (dir != null && dir.hasTextConflict(name)) {
                    textStatus = SVNStatusType.STATUS_CONFLICTED;
                }
                if (dir != null && dir.hasPropConflict(name)) {
                    propStatus = SVNStatusType.STATUS_CONFLICTED;
                }
            }
            if (entry.isScheduledForAddition() && textStatus != SVNStatusType.STATUS_CONFLICTED) {
                textStatus = SVNStatusType.STATUS_ADDED;
                propStatus = SVNStatusType.STATUS_NONE;
            } else if (entry.isScheduledForReplacement() && textStatus != SVNStatusType.STATUS_CONFLICTED) {
                textStatus = SVNStatusType.STATUS_REPLACED;
                propStatus = SVNStatusType.STATUS_NONE;
            } else if (entry.isScheduledForDeletion() && textStatus != SVNStatusType.STATUS_CONFLICTED) {
                textStatus = SVNStatusType.STATUS_DELETED;
                propStatus = SVNStatusType.STATUS_NONE;
            }
            if (entry.isIncomplete() && textStatus != SVNStatusType.STATUS_DELETED && textStatus != SVNStatusType.STATUS_ADDED) {
                textStatus = SVNStatusType.STATUS_INCOMPLETE;
            } else if (fileKind == SVNNodeKind.NONE) {
                if (textStatus != SVNStatusType.STATUS_DELETED) {
                    textStatus = SVNStatusType.STATUS_MISSING;
                }
            } else if (fileKind != entry.getKind()) {
                textStatus = SVNStatusType.STATUS_OBSTRUCTED;
            } else if ((!isSpecial && special) || (isSpecial && !special)) {
                textStatus = SVNStatusType.STATUS_OBSTRUCTED;
            }
            if (fileKind == SVNNodeKind.DIR && entry.getKind() == SVNNodeKind.DIR) {
                isLocked = wcAccess.isLocked(file);
            }
        }
        if (!reportAll) {
            if ((textStatus == SVNStatusType.STATUS_NONE || textStatus == SVNStatusType.STATUS_NORMAL) &&
                (propStatus == SVNStatusType.STATUS_NONE || propStatus == SVNStatusType.STATUS_NORMAL) &&
                !isLocked && !isSwitched && entry.getLockToken() == null && repositoryLock == null &&
                entry.getChangelistName() == null && !isFileExternal && treeConflict == null) {
                return null;
            }
        }
        SVNLock localLock = null;
        if (entry.getLockToken() != null) {
            localLock = new SVNLock(null, entry.getLockToken(), entry.getLockOwner(), entry.getLockComment(),
                    SVNDate.parseDate(entry.getLockCreationDate()), null);
        }
        File conflictNew = dir != null ? dir.getFile(entry.getConflictNew()) : null;
        File conflictOld = dir != null ? dir.getFile(entry.getConflictOld()) : null;
        File conflictWrk = dir != null ? dir.getFile(entry.getConflictWorking()) : null;
View Full Code Here

Examples of org.tmatesoft.svn.core.SVNLock

        if (!(myFileInfo.myIsAdded || myFileInfo.myIsPropertiesChanged || myFileInfo.myIsContentsChanged)) {
            return;
        }
        SVNStatusType contentsStatus;
        SVNStatusType propertiesStatus;
        SVNLock remoteLock = null;
       
        if (myFileInfo.myIsAdded) {
            contentsStatus = SVNStatusType.STATUS_ADDED;
            propertiesStatus = myFileInfo.myIsPropertiesChanged ? SVNStatusType.STATUS_ADDED : SVNStatusType.STATUS_NONE;
        } else {
View Full Code Here

Examples of org.tmatesoft.svn.core.SVNLock

           */
          boolean isSwitched = status.isSwitched();
          /*
           * If the item is a file it may be locked.
           */
          SVNLock localLock = status.getLocalLock();
          /*
           * If  doStatus()  was  run  with  remote=true  and the item is a file,
           * checks whether a remote lock presents.
           */
          SVNLock remoteLock = status.getRemoteLock();
          String lockLabel = " ";

          if (localLock != null) {
              /*
               * at first suppose the file is locKed
               */
              lockLabel = "K";
              if (remoteLock != null) {
                  /*
                   * if the lock-token of the local lock differs from  the  lock-
                   * token of the remote lock - the lock was sTolen!
                   */
                  if (!remoteLock.getID().equals(localLock.getID())) {
                      lockLabel = "T";
                  }
              } else {
                  if(isRemote){
                    /*
 
View Full Code Here

Examples of org.tmatesoft.svn.core.SVNLock

         */
        boolean isSwitched = status.isSwitched();
        /*
         * If the item is a file it may be locked.
         */
        SVNLock localLock = status.getLocalLock();
        /*
         * If  doStatus()  was  run  with  remote=true  and the item is a file,
         * checks whether a remote lock presents.
         */
        SVNLock remoteLock = status.getRemoteLock();
        String lockLabel = " ";

        if (localLock != null) {
            /*
             * at first suppose the file is locKed
             */
            lockLabel = "K";
            if (remoteLock != null) {
                /*
                 * if the lock-token of the local lock differs from  the  lock-
                 * token of the remote lock - the lock was sTolen!
                 */
                if (!remoteLock.getID().equals(localLock.getID())) {
                    lockLabel = "T";
                }
            } else {
                if(myIsRemote){
                  /*
 
View Full Code Here

Examples of org.tmatesoft.svn.core.SVNLock

   
    static SVNInfo createInfo(File file, SVNEntry entry) throws SVNException {
        if (entry == null) {
            return null;
        }
        SVNLock lock = null;
        if (entry.getLockToken() != null) {
            lock = new SVNLock(null, entry.getLockToken(),
                    entry.getLockOwner(), entry.getLockComment(), SVNDate.parseDate(entry.getLockCreationDate()), null);
        }
        SVNTreeConflictDescription tc = null;
        if (entry.getAdminArea() != null && entry.getAdminArea().getWCAccess() != null) {
          tc = entry.getAdminArea().getWCAccess().getTreeConflict(file);
View Full Code Here

Examples of org.tmatesoft.svn.core.SVNLock

            }
            closeTag(CONFLICT_TAG);
        }
       
        if (info.getLock() != null) {
            SVNLock lock = info.getLock();
            openTag(LOCK_TAG);
            if (lock.getID() != null) {
                addTag(TOKEN_TAG, lock.getID());
            }
            if (lock.getOwner() != null) {
                addTag(OWNER_TAG, lock.getOwner());
            }
            if (lock.getComment() != null) {
                addTag(COMMENT_TAG, lock.getComment());
            }
            if (lock.getCreationDate() != null) {
                addTag(CREATED_TAG, SVNDate.formatDate(lock.getCreationDate()));
            }
            if (lock.getExpirationDate() != null) {
                addTag(EXPIRES_TAG, SVNDate.formatDate(lock.getExpirationDate()));
            }
            closeTag(LOCK_TAG);
        }
           
            
View Full Code Here

Examples of org.tmatesoft.svn.core.SVNLock

        addAttribute(REVISION_ATTR, entry.getRevision() + "");
        openTag(COMMIT_TAG);
        addTag(AUTHOR_TAG, entry.getAuthor());
        addTag(DATE_TAG, SVNDate.formatDate(entry.getDate()));
        closeTag(COMMIT_TAG);
        SVNLock lock = entry.getLock();
        if (lock != null) {
            openTag(LOCK_TAG);
            addTag(TOKEN_TAG, lock.getID());
            addTag(OWNER_TAG, lock.getOwner());
            addTag(COMMENT_TAG, lock.getComment());
            addTag(CREATED_TAG, SVNDate.formatDate(lock.getCreationDate()));
            if (lock.getExpirationDate() != null && lock.getExpirationDate().getTime() > 0) {
                addTag(EXPIRES_TAG, SVNDate.formatDate(lock.getExpirationDate()));
            }
            closeTag(LOCK_TAG);
        }
        closeTag(ENTRY_TAG);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.