Examples of SVNRepository


Examples of org.tmatesoft.svn.core.io.SVNRepository

            path = SVNEncodingUtil.uriDecode(path);
            pathsToTokens.put(path, null);
        }

        checkCancelled();
        SVNRepository repository = createRepository(topURL, null, null, true);
        if (!breakLock) {
            pathsToTokens = fetchLockTokens(repository, pathsToTokens);
        }
        repository.unlock(pathsToTokens, breakLock, new ISVNLockHandler() {
            public void handleLock(String path, SVNLock lock, SVNErrorMessage error) throws SVNException {
            }

            public void handleUnlock(String path, SVNLock lock, SVNErrorMessage error) throws SVNException {
                if (error != null) {
View Full Code Here

Examples of org.tmatesoft.svn.core.io.SVNRepository

        if (pegRevision == null || !pegRevision.isValid()) {
            pegRevision = revision;
        }

        long[] revNum = { SVNRepository.INVALID_REVISION };
        SVNRepository repos = createRepository(url, null, null, pegRevision, revision, revNum);
       
        url = repos.getLocation();
        SVNDirEntry rootEntry = null;
        SVNURL reposRoot = repos.getRepositoryRoot(true);
        String reposUUID = repos.getRepositoryUUID(true);
        String baseName = SVNPathUtil.tail(url.getPath());

        try {
            rootEntry = repos.info("", revNum[0]);
        } catch (SVNException e) {
            if (e.getErrorMessage() != null &&
                    e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_NOT_IMPLEMENTED) {
                // for svnserve older then 1.2.0
                if (url.equals(reposRoot)) {
                    if (depth.compareTo(SVNDepth.EMPTY) > 0) {
                        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++) {
                            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();
View Full Code Here

Examples of org.tmatesoft.svn.core.io.SVNRepository

        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        setupLibrary();

        try {
            SVNRepository repository = null;

            /*
             * Creates an instance of SVNRepository to work with the repository.
             * All user's requests to the repository are relative to the
             * repository location used to create this SVNRepository. SVNURL is
             * a wrapper for URL strings that refer to repository locations.
             */
            repository = SVNRepositoryFactoryImpl.create( SVNURL.parseURIEncoded( url ) );

            /*
             * User's authentication information is provided via an
             * ISVNAuthenticationManager instance. SVNWCUtil creates a default
             * usre's authentication manager given user's name and password.
             */
            ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager( username,
                                                                                                  password );

            /*
             * Sets the manager of the user's authentication information that
             * will be used to authenticate the user to the server (if needed)
             * during operations handled by the SVNRepository.
             */
            repository.setAuthenticationManager( authManager );

            /*
             * This Map will be used to get the file properties. Each Map key is
             * a property name and the value associated with the key is the
             * property value.
             */
            Map fileProperties = new HashMap();

            /*
             * Checks up if the specified path really corresponds to a file. If
             * doesn't the program exits. SVNNodeKind is that one who says what
             * is located at a path in a revision. -1 means the latest revision.
             */
            SVNNodeKind nodeKind = repository.checkPath( "",
                                                         -1 );

            if ( nodeKind == SVNNodeKind.NONE ) {
                logger.error( "There is no entry at '" + url + "'." );

            } else if ( nodeKind == SVNNodeKind.DIR ) {
                logger.error( "The entry at '" + url + "' is a directory while a file was expected." );

            }

            /*
             * Gets the contents and properties of the file located at filePath
             * in the repository at the latest revision (which is meant by a
             * negative revision number).
             */
            repository.getFile( "",
                                version,
                                fileProperties,
                                baos );

        } catch ( SVNException e ) {
View Full Code Here

Examples of org.tmatesoft.svn.core.io.SVNRepository

         * initializes the library (it must be done before ever using the
         * library itself)
         */
        setupLibrary();
        try {
            SVNRepository repository = SVNRepositoryFactory.create( SVNURL.parseURIEncoded( url ) );
            // we need to narrow down collection list to resources in a folder
            // before
            // this call
            Collection entries = repository.getDir( url,
                                                    -1,
                                                    null,
                                                    (Collection) null );

            Collections.sort( resourceList );
View Full Code Here

Examples of org.tmatesoft.svn.core.io.SVNRepository

        try {
            logger.debug( "Subversion authentication for : username=" + username + ", password=" + password + ", repositoryURL=" + repositoryUrl );

            setupLibrary();
            SVNRepository repository = null;

            /*
             * Creates an instance of SVNRepository to work with the repository.
             * All user's requests to the repository are relative to the
             * repository location used to create this SVNRepository. SVNURL is
             * a wrapper for URL strings that refer to repository locations.
             */
            repository = SVNRepositoryFactory.create( SVNURL.parseURIEncoded( repositoryUrl ) );

            /*
             * User's authentication information is provided via an
             * ISVNAuthenticationManager instance. SVNWCUtil creates a default
             * usre's authentication manager given user's name and password.
             */
            ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager( username,
                                                                                                  password );

            /*
             * Sets the manager of the user's authentication information that
             * will be used to authenticate the user to the server (if needed)
             * during operations handled by the SVNRepository.
             */
            repository.setAuthenticationManager( authManager );
            repository.testConnection();
        } catch ( SVNException e ) {
            logger.error( e.getErrorMessage() );
            return false;
        }

View Full Code Here

Examples of org.tmatesoft.svn.core.io.SVNRepository

            System.out.println("My repos. ......");
            String svnUrl = SVNConnectorTestUtil.createURL("src/test/resources/dummy_svn_repos", "target/copy_of dummy_svn_repos");
            String username = "sp";
            String password = "";
            System.out.println(svnUrl);
            SVNRepository trunkWorkspace = createRepository(svnUrl + "/trunk", username, password);
            System.out.println("Repository location: " + trunkWorkspace.getLocation().toString());
            System.out.println("Repository Root: " + trunkWorkspace.getRepositoryRoot(true));
            System.out.println("Repository UUID: " + trunkWorkspace.getRepositoryUUID(true));
            /**
             * Returns the repository location to which this object is set. It may be the location that was used to create this
             * object (see {@link SVNRepositoryFactory#create(SVNURL)}), or the recent one the object was set to.
             */
            System.out.println("location: " + trunkWorkspace.getLocation().getPath());
            System.out.println("decoded location: " + trunkWorkspace.getLocation().toDecodedString());
            System.out.println("last seg: " + getRepositoryWorspaceName(trunkWorkspace));

            final Collection<SVNDirEntry> dirEntries = trunkWorkspace.getDir("", -1, null, (Collection<SVNDirEntry>)null);
            for (SVNDirEntry dirEntry : dirEntries) {
                System.out.println("name: " + dirEntry.getName());
            }

            // //
View Full Code Here

Examples of org.tmatesoft.svn.core.io.SVNRepository

        FSRepositoryFactory.setup();
        // for SVN (over svn and svn+ssh)
        SVNRepositoryFactoryImpl.setup();

        // The factory knows how to create a DAVRepository
        SVNRepository repository = SVNRepositoryFactory.create(SVNURL.parseURIDecoded(url));
        ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager(username, password);
        repository.setAuthenticationManager(authManager);
        return repository;
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.io.SVNRepository

        ByteArrayOutputStream baos = new ByteArrayOutputStream();

        setupLibrary();

        try {
            SVNRepository repository = null;

            /*
             * Creates an instance of SVNRepository to work with the repository.
             * All user's requests to the repository are relative to the
             * repository location used to create this SVNRepository. SVNURL is
             * a wrapper for URL strings that refer to repository locations.
             */
            repository = SVNRepositoryFactoryImpl.create( SVNURL.parseURIEncoded( url ) );

            /*
             * User's authentication information is provided via an
             * ISVNAuthenticationManager instance. SVNWCUtil creates a default
             * usre's authentication manager given user's name and password.
             */
            ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager( username,
                                                                                                  password );

            /*
             * Sets the manager of the user's authentication information that
             * will be used to authenticate the user to the server (if needed)
             * during operations handled by the SVNRepository.
             */
            repository.setAuthenticationManager( authManager );

            /*
             * This Map will be used to get the file properties. Each Map key is
             * a property name and the value associated with the key is the
             * property value.
             */
            Map fileProperties = new HashMap();

            /*
             * Checks up if the specified path really corresponds to a file. If
             * doesn't the program exits. SVNNodeKind is that one who says what
             * is located at a path in a revision. -1 means the latest revision.
             */
            SVNNodeKind nodeKind = repository.checkPath( "",
                                                         -1 );

            if ( nodeKind == SVNNodeKind.NONE ) {
                logger.error( "There is no entry at '" + url + "'." );

            } else if ( nodeKind == SVNNodeKind.DIR ) {
                logger.error( "The entry at '" + url + "' is a directory while a file was expected." );

            }

            /*
             * Gets the contents and properties of the file located at filePath
             * in the repository at the latest revision (which is meant by a
             * negative revision number).
             */
            repository.getFile( "",
                                version,
                                fileProperties,
                                baos );

        } catch ( SVNException e ) {
View Full Code Here

Examples of org.tmatesoft.svn.core.io.SVNRepository

         * initializes the library (it must be done before ever using the
         * library itself)
         */
        setupLibrary();
        try {
            SVNRepository repository = SVNRepositoryFactory.create( SVNURL.parseURIEncoded( url ) );
            // we need to narrow down collection list to resources in a folder
            // before
            // this call
            Collection entries = repository.getDir( url,
                                                    -1,
                                                    null,
                                                    (Collection) null );

            Collections.sort( resourceList );
View Full Code Here

Examples of org.tmatesoft.svn.core.io.SVNRepository

        try {
            logger.debug( "Subversion authentication for : username=" + username + ", password=" + password + ", repositoryURL=" + repositoryUrl );

            setupLibrary();
            SVNRepository repository = null;

            /*
             * Creates an instance of SVNRepository to work with the repository.
             * All user's requests to the repository are relative to the
             * repository location used to create this SVNRepository. SVNURL is
             * a wrapper for URL strings that refer to repository locations.
             */
            repository = SVNRepositoryFactory.create( SVNURL.parseURIEncoded( repositoryUrl ) );

            /*
             * User's authentication information is provided via an
             * ISVNAuthenticationManager instance. SVNWCUtil creates a default
             * usre's authentication manager given user's name and password.
             */
            ISVNAuthenticationManager authManager = SVNWCUtil.createDefaultAuthenticationManager( username,
                                                                                                  password );

            /*
             * Sets the manager of the user's authentication information that
             * will be used to authenticate the user to the server (if needed)
             * during operations handled by the SVNRepository.
             */
            repository.setAuthenticationManager( authManager );
            repository.testConnection();
        } catch ( SVNException e ) {
            logger.error( e.getErrorMessage().getFullMessage() );
            return false;
        }

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.