Package org.tmatesoft.svn.core

Examples of org.tmatesoft.svn.core.SVNNodeKind


        }

        String revNodeIDStr = (String) headers.get(FSRevisionNode.HEADER_ID);
        FSID revNodeID = FSID.fromString(revNodeIDStr);
       
        SVNNodeKind nodeKind = SVNNodeKind.parseKind((String) headers.get(FSRevisionNode.HEADER_TYPE));
        if (nodeKind != SVNNodeKind.DIR) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT,
                    "Recovery encountered a non-directory node");
            SVNErrorManager.error(err, SVNLogType.FSFS);
        }
       
        String textRep = (String) headers.get(FSRevisionNode.HEADER_TEXT);
        if (textRep == null) {
            return;
        }

        FSRevisionNode revNode = new FSRevisionNode();
        revNode.setId(revNodeID);
        revNode.setType(nodeKind);
        FSRevisionNode.parseRepresentationHeader(textRep, revNode, null, true, false);
        if (revNode.getTextRepresentation().getRevision() != rev) {
            return;
        }

        revFile.seek(revNode.getTextRepresentation().getOffset());
        FSInputStream.FSRepresentationState repState = FSInputStream.readRepresentationLine(revFile);
        if (repState.myIsDelta) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT,
                    "Recovery encountered a deltified directory representation");
            SVNErrorManager.error(err, SVNLogType.FSFS);
        }
       
        SVNProperties rawEntries = revFile.readProperties(false, false);
        for (Iterator entriesIter = rawEntries.nameSet().iterator(); entriesIter.hasNext();) {
            String name = (String) entriesIter.next();
            String unparsedEntry = rawEntries.getStringValue(name);
            int spaceInd = unparsedEntry.indexOf(' ');
            if (spaceInd == -1 || spaceInd == unparsedEntry.length() - 1 || spaceInd == 0) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Directory entry corrupt");
                SVNErrorManager.error(err, SVNLogType.FSFS);
            }
           
            String kindStr = unparsedEntry.substring(0, spaceInd);
           
            SVNNodeKind kind = SVNNodeKind.parseKind(kindStr);
            if (kind != SVNNodeKind.DIR && kind != SVNNodeKind.FILE) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_CORRUPT, "Directory entry corrupt");
                SVNErrorManager.error(err, SVNLogType.FSFS);
            }
           
View Full Code Here


        myAuthor = author;
    }
   
    public void deleteNode(String path) throws SVNException {
        FSParentPath parentPath = myTxnRoot.openPath(path, true, true);
        SVNNodeKind kind = parentPath.getRevNode().getType();
        if (parentPath.getParent() == null) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_ROOT_DIR,
                    "The root directory cannot be deleted");
            SVNErrorManager.error(err, SVNLogType.FSFS);
        }
View Full Code Here

    }

    public void changeNodeProperty(String path, String name, SVNPropertyValue propValue) throws SVNException {
        FSRepositoryUtil.validateProperty(name, propValue);
        FSParentPath parentPath = myTxnRoot.openPath(path, true, true);
        SVNNodeKind kind = parentPath.getRevNode().getType();

        if ((myTxnRoot.getTxnFlags() & FSTransactionRoot.SVN_FS_TXN_CHECK_LOCKS) != 0) {
            FSCommitter.allowLockedOperation(myFSFS, path, myAuthor, myLockTokens, false, false);
        }
View Full Code Here

        boolean closeDir = false;
        if (isDelete) {
            editor.deleteEntry(path, -1);
        }

        SVNNodeKind kind = null;
        if (!isDelete || isAdd) {
            kind = myRoot.checkNodeKind(absPath);
            if (kind != SVNNodeKind.DIR && kind != SVNNodeKind.FILE) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FOUND,
                    "Filesystem path ''{0}'' is neither a file nor a directory", path);
View Full Code Here

                myIsTargetDeleted = true;
            }
            return;
        }

        SVNNodeKind kind = entry.getKind();
        long previousRevision = entry.getRevision();
        SVNURL url = entry.getSVNURL();

        if (inSkippedTree(fullPath) && !inDeletedTree(fullPath, true)) {
            return;
View Full Code Here

                    }
                }
            }
        }
        if (reason != null) {
            SVNNodeKind leftKind = entry.isScheduledForAddition() ? SVNNodeKind.NONE : entry.isScheduledForDeletion() ? SVNNodeKind.UNKNOWN : entry.getKind();
            SVNURL repoRoot = entry.getRepositoryRootURL();
            String repoPath = SVNPathUtil.getPathAsChild(repoRoot.getPath(), entry.getSVNURL().getPath());
            repoPath = repoPath != null ? repoPath : "/";
            SVNConflictVersion srcLeftVersion = new SVNConflictVersion(repoRoot, repoPath, entry.getRevision(), leftKind);
View Full Code Here

public class SvnKitFileTypeChecker extends SvnKitAbstractRepository implements SvnFileTypeChecker {

  public SvnFileType getFileType(SvnProject project, String path, long targetRevision)
      throws SvnException {
    try {
      SVNNodeKind type = managerPool.getSvnRepository(project)
          .checkPath(path, targetRevision);
      if (type.equals(SVNNodeKind.FILE)) {
        return SvnFileType.FILE;
      }
      if (type.equals(SVNNodeKind.DIR)) {
        return SvnFileType.DIR;
      }
      if (type.equals(SVNNodeKind.NONE)) {
        return SvnFileType.NONE;
      }
      if (type.equals(SVNNodeKind.UNKNOWN)) {
        return SvnFileType.UNKNOWN;
      }
      throw new SvnException("Could not verify the type for path " + path);
    }
    catch (SVNException e) {
View Full Code Here

   
    public static SVNRepository getRepository(String url, String username, String password) {
        DAVRepositoryFactory.setup();
        SVNRepositoryFactoryImpl.setup();
        SVNRepository repository = null;
        SVNNodeKind nodeKind = null;
        try {
            repository = SVNRepositoryFactory.create(SVNURL.parseURIEncoded(url));
            ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(username, password);
            repository.setAuthenticationManager(authManager);
            nodeKind = repository.checkPath("", -1);
View Full Code Here

        if (makeParents) {
            CopyPair pair = (CopyPair) copyPairs.get(0);
            if (!pair.myDst.equals(rootURL)) {
                oldLocation = nonTopRepos.getLocation();
                nonTopRepos.setLocation(SVNURL.parseURIEncoded(pair.myDst).removePathTail(), false);
                SVNNodeKind kind = nonTopRepos.checkPath("", -1);
                while (kind == SVNNodeKind.NONE) {
                    newDirs.add(nonTopRepos.getLocation().toString());
                    nonTopRepos.setLocation(nonTopRepos.getLocation().removePathTail(), false);
                    kind = nonTopRepos.checkPath("", -1);
                }
            }
        } else if (Boolean.getBoolean("svnkit.compatibleHash")) {           
            // XXX: hack for tests to generate error message tests will like.
            // do not check paths above repository root.
            CopyPair pair = (CopyPair) copyPairs.get(0);
            if (!pair.myDst.equals(rootURL)) {
                oldLocation = nonTopRepos.getLocation();
                nonTopRepos.setLocation(SVNURL.parseURIEncoded(pair.myDst).removePathTail(), false);
                SVNNodeKind kind = nonTopRepos.checkPath("", -1);
                if (kind == SVNNodeKind.NONE) {
                    SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FOUND, "''{0}'' path not found", nonTopRepos.getLocation());
                    SVNErrorManager.error(err, SVNLogType.WC);
                }
            }
        }
        if (oldLocation != null) {
            nonTopRepos.setLocation(oldLocation, false);
        }

        /*
         * Check if source is dst child (while dst is not root).
         */
        for (int i = 0; i < copyPairs.size(); i++) {
            CopyPair pair = (CopyPair) copyPairs.get(i);
            CopyPathInfo info = (CopyPathInfo) pathInfos.get(i);
            if (!pair.myDst.equals(rootURL) && SVNPathUtil.getPathAsChild(pair.myDst, pair.mySource) != null) {
                info.isResurrection = true;
            }
        }

        long latestRevision = nonTopRepos.getLatestRevision();

        for (int i = 0; i < copyPairs.size(); i++) {
            CopyPair pair = (CopyPair) copyPairs.get(i);
            CopyPathInfo info = (CopyPathInfo) pathInfos.get(i);
            pair.mySourceRevisionNumber = getRevisionNumber(pair.mySourceRevision, nonTopRepos, null);
            info.mySourceRevisionNumber = pair.mySourceRevisionNumber;

            SVNRepositoryLocation[] locations = getLocations(SVNURL.parseURIEncoded(pair.mySource), null, null /*optimize topRepos*/, pair.mySourcePegRevision, pair.mySourceRevision, SVNRevision.UNDEFINED);
            pair.mySource = locations[0].getURL().toString();
           
            // tests:
            // src is equal to dst
            if (isMove && pair.mySource.equals(pair.myDst)) {
            //if ("".equals(srcRelative) && isMove) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE, "Cannot move URL ''{0}'' into itself", SVNURL.parseURIEncoded(pair.mySource));
                SVNErrorManager.error(err, SVNLogType.WC);
            }
            // src doesn't exist at source revision.
            nonTopRepos.setLocation(SVNURL.parseURIEncoded(pair.mySource), false);
            info.mySourceKind = nonTopRepos.checkPath("", pair.mySourceRevisionNumber);
            if (info.mySourceKind == SVNNodeKind.NONE) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_NOT_FOUND,
                        "Path ''{0}'' does not exist in revision {1}", new Object[] {SVNURL.parseURIEncoded(pair.mySource), new Long(pair.mySourceRevisionNumber)});
                SVNErrorManager.error(err, SVNLogType.WC);
            }
            // dst already exists at HEAD.
            nonTopRepos.setLocation(SVNURL.parseURIEncoded(pair.myDst), false);
            SVNNodeKind dstKind = nonTopRepos.checkPath("", latestRevision);
            if (dstKind != SVNNodeKind.NONE) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.FS_ALREADY_EXISTS,
                        "Path ''{0}'' already exists", pair.myDst);
                SVNErrorManager.error(err, SVNLogType.WC);
            }
View Full Code Here

        boolean save = false;

        for(Iterator entries = dir.entries(true); entries.hasNext();) {
            SVNEntry entry = (SVNEntry) entries.next();
            boolean deleted = entry.isDeleted();
            SVNNodeKind kind = entry.getKind();
            boolean force = false;
            if (entry.getDepth() == SVNDepth.EXCLUDE) {
                continue;
            }
View Full Code Here

TOP

Related Classes of org.tmatesoft.svn.core.SVNNodeKind

Copyright © 2018 www.massapicom. 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.