Examples of SVNUpdateClient


Examples of org.exist.versioning.svn.wc.SVNUpdateClient

        if (pair.mySourceKind == SVNNodeKind.DIR) {
            // do checkout
            String srcURL = pair.myOriginalSource;
            SVNURL url = SVNURL.parseURIEncoded(srcURL);
            SVNUpdateClient updateClient = new SVNUpdateClient(getRepositoryPool(), getOptions());
            updateClient.setEventHandler(getEventDispatcher());

            File dstFile = new Resource(pair.myDst);
            SVNRevision srcRevision = pair.mySourceRevision;
            SVNRevision srcPegRevision = pair.mySourcePegRevision;
            updateClient.doCheckout(url, dstFile, srcPegRevision, srcRevision, SVNDepth.INFINITY, false);

            if (sameRepositories) {
                url = SVNURL.parseURIEncoded(pair.mySource);

                SVNAdminArea dstArea = dstAccess.open(dstFile, true, SVNWCAccess.INFINITE_DEPTH);
View Full Code Here

Examples of org.exist.versioning.svn.wc.SVNUpdateClient

     */
    public long checkout(SVNURL url,
            SVNRevision revision, File destPath, boolean isRecursive)
            throws SVNException {

        SVNUpdateClient updateClient = ourClientManager.getUpdateClient();
        /*
         * sets externals not to be ignored during the checkout
         */
        updateClient.setIgnoreExternals(false);
        /*
         * returns the number of the revision at which the working copy is
         */
        return updateClient.doCheckout(url, destPath, revision, revision, SVNDepth.fromRecurse(isRecursive),
                false);
    }
View Full Code Here

Examples of org.exist.versioning.svn.wc.SVNUpdateClient

     * recursive - if true and an entry is a directory then doUpdate(..) recursively
     * updates the entire directory, otherwise - only child entries of the directory;  
     */
    public long update(File wcPath, SVNRevision updateToRevision, boolean isRecursive) throws SVNException {

        SVNUpdateClient updateClient = ourClientManager.getUpdateClient();
        /*
         * sets externals not to be ignored during the update
         */
        updateClient.setIgnoreExternals(false);
        /*
         * returns the number of the revision wcPath was updated to
         */
        return updateClient.doUpdate(wcPath, updateToRevision, SVNDepth.fromRecurse(isRecursive), false, false);
    }
View Full Code Here

Examples of org.exist.versioning.svn.wc.SVNUpdateClient

     *
     * recursive - if true and an entry (file) is a directory then doSwitch(..) recursively
     * switches the entire directory, otherwise - only child entries of the directory;  
     */
    public long switchToURL(File wcPath, SVNURL url, SVNRevision updateToRevision, boolean isRecursive) throws SVNException {
        SVNUpdateClient updateClient = ourClientManager.getUpdateClient();
        /*
         * sets externals not to be ignored during the switch
         */
        updateClient.setIgnoreExternals(false);
        /*
         * returns the number of the revision wcPath was updated to
         */
        return updateClient.doSwitch(wcPath, url, SVNRevision.UNDEFINED, updateToRevision,
                SVNDepth.getInfinityOrFilesDepth(isRecursive), false, false);
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.wc.SVNUpdateClient

       * Creates an instance of SVNClientManager providing authentication
       * information (name, password) and an options driver
       */
      SVNClientManager ourClientManager = SVNClientManager
          .newInstance(options);
      SVNUpdateClient updateClient = ourClientManager.getUpdateClient();

      /*
       * Creates the event handler to display information
       */
      ourClientManager.setEventHandler(new SVNEventAdapter() {
        public void handleEvent(SVNEvent event, double progress) {
          SVNEventAction action = event.getAction();
          File curFile = event.getFile();

          String path = curFile.getAbsolutePath();
          path = path.substring(path.indexOf(FOLDER_NAME));

          if (action == SVNEventAction.ADD
              || action == SVNEventAction.UPDATE_ADD) {
            m_taskOutput.append("Downloading " + path + " \n");

            m_taskOutput.setCaretPosition(m_taskOutput
                .getDocument().getLength());
            System.out.println("Downloading " + curFile.getName());
          }
          if (action == SVNEventAction.STATUS_COMPLETED
              || action == SVNEventAction.UPDATE_COMPLETED) {
            setProgress(100);
            m_taskOutput.append("Download completed. ");
            m_taskOutput.setCaretPosition(m_taskOutput
                .getDocument().getLength());
            System.out.println("Download completed. ");

          }
        }
      });

      /*
       * sets externals not to be ignored during the checkout
       */
      updateClient.setIgnoreExternals(false);

      /*
       * A url of a repository to check out
       */
      SVNURL url = null;
      try {
        url = SVNURL.parseURIDecoded("http://" + SVN_URL);
      } catch (SVNException e2) {
        e2.printStackTrace();
      }
      /*
       * A revision to check out
       */
      SVNRevision revision = SVNRevision.HEAD;

      /*
       * A revision for which you're sure that the url you specify is
       * exactly what you need
       */
      SVNRevision pegRevision = SVNRevision.HEAD;

      /*
       * A local path where a Working Copy will be ckecked out
       */
      File destPath = new File(m_installpath);

      /*
       * returns the number of the revision at which the working copy is
       */
      try {
        System.out.println(m_installpath);
        m_taskOutput.append("Game folder: " + m_installpath + "\n");
        boolean exists = destPath.exists();
        if (!exists) {
          m_taskOutput
              .append("Installing...\nPlease be patient while PokeNet is downloaded...\n");
          System.out.println("Installing...");
          updateClient.doCheckout(url, destPath, pegRevision,
              revision, SVNDepth.INFINITY, true);

        } else {
          ourClientManager.getWCClient().doCleanup(destPath);
          m_taskOutput.append("Updating...\n");
          System.out.println("Updating...\n");
          updateClient.doUpdate(destPath, revision,
              SVNDepth.INFINITY, true, true);
        }
      } catch (SVNException e1) {
        // It's probably locked, lets cleanup and resume.
        e1.printStackTrace();
        try {
          ourClientManager.getWCClient().doCleanup(destPath);
          m_taskOutput.append("Resuming Download...\n");
          System.out.println("Resuming Download...\n");
          updateClient.doUpdate(destPath, revision,
              SVNDepth.INFINITY, true, true);
        } catch (SVNException e) {
          e.printStackTrace();
        }
      }
View Full Code Here

Examples of org.tmatesoft.svn.core.wc.SVNUpdateClient

        if (pair.mySourceKind == SVNNodeKind.DIR) {
            // do checkout
            String srcURL = pair.myOriginalSource;
            SVNURL url = SVNURL.parseURIEncoded(srcURL);
            SVNUpdateClient updateClient = new SVNUpdateClient(getRepositoryPool(), getOptions());
            updateClient.setEventHandler(getEventDispatcher());

            File dstFile = new File(pair.myDst);
            SVNRevision srcRevision = pair.mySourceRevision;
            SVNRevision srcPegRevision = pair.mySourcePegRevision;
            updateClient.doCheckout(url, dstFile, srcPegRevision, srcRevision, SVNDepth.INFINITY, false);

            if (sameRepositories) {
                url = SVNURL.parseURIEncoded(pair.mySource);

                SVNAdminArea dstArea = dstAccess.open(dstFile, true, SVNWCAccess.INFINITE_DEPTH);
View Full Code Here

Examples of org.tmatesoft.svn.core.wc.SVNUpdateClient

            if(!userDir.mkdir()) {
                throw new IOException("Could not create directory " + userDir);
            }
        }

        final SVNUpdateClient updateClient = userClientManager.getUpdateClient();
        if (SVNWCUtil.isVersionedDirectory(userDir)) {
            final SVNStatusClient statusClient = userClientManager.getStatusClient();
            final SVNStatus status = statusClient.doStatus(userDir, false);
            final SVNStatusType contentStatus = status.getContentsStatus();
            logger.info("(svn) status for " + userDir + " is " + contentStatus);
            if (contentStatus == SVNStatusType.STATUS_NORMAL) {
                long elapsed = -System.currentTimeMillis();
                if (logger.isDebugEnabled()) {
                    logger.debug("(svn) current r" + status.getRevision().getNumber() " svn update " + svnUrl + " into " + userDir);
                }
                long workingDirRevision = updateClient.doUpdate(userDir, SVNRevision.HEAD, SVNDepth.INFINITY, false, false);
                elapsed += System.currentTimeMillis();
                logger.info(String.format("Updated working directory (%s) to revision %d in %d ms", userDir.getAbsolutePath(), workingDirRevision, elapsed));
            } else {
                logger.warn(String.format("Working directory (%s) is in a bad state: %s Cleaning up and checking out fresh.", userDir.getAbsolutePath(), contentStatus));
                if (logger.isDebugEnabled()) {
                    logger.debug(String.format("Deleting working directory contents (%s)", userDir.getAbsolutePath()));
                }
                deleteDirectoryContents(userDir);
                long elapsed = -System.currentTimeMillis();
                if (logger.isDebugEnabled()) {
                    logger.debug("(svn) svn co " + svnUrl + " into " + userDir);
                }
                long workingDirRevision = updateClient.doCheckout(svnUrl, userDir, null, SVNRevision.HEAD, SVNDepth.INFINITY, false);
                elapsed += System.currentTimeMillis();
                logger.info(String.format("Checked out working directory (%s) to revision %d in %d ms", userDir.getAbsolutePath(), workingDirRevision, elapsed));
            }
        } else {
            long elapsed = -System.currentTimeMillis();
            if (logger.isDebugEnabled()) {
                logger.debug("(svn) svn co " + svnUrl + " into " + userDir);
            }
            long workingDirRevision = updateClient.doCheckout(svnUrl, userDir, null, SVNRevision.HEAD, SVNDepth.INFINITY, false);
            elapsed += System.currentTimeMillis();
            logger.info(String.format("Checked out working directory (%s) to revision %d in %d ms", userDir.getAbsolutePath(), workingDirRevision, elapsed));
        }
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.wc.SVNUpdateClient

            //commit local changes
            SVNCommitClient commitClient = clientManager.getCommitClient();
            commitClient.doCommit(new File[] { wcRoot }, false, "committing changes", null, null, false, false, SVNDepth.INFINITY);
           
            //roll back changes in the working copy - update to revision 1
            SVNUpdateClient updateClient = clientManager.getUpdateClient();
            updateClient.doUpdate(wcRoot, SVNRevision.create(1), SVNDepth.INFINITY, false, false);
           
            //now diff the base revision of the working copy against the repository
            SVNDiffClient diffClient = clientManager.getDiffClient();

            /*
 
View Full Code Here

Examples of org.tmatesoft.svn.core.wc.SVNUpdateClient

       
        return commitEditor.closeEdit();
    }
   
    public static void checkOutWorkingCopy(SVNURL url, File wcRoot) throws SVNException {
        SVNUpdateClient updateClient = SVNClientManager.newInstance().getUpdateClient();
        updateClient.doCheckout(url, wcRoot, SVNRevision.UNDEFINED, SVNRevision.HEAD, SVNDepth.INFINITY,
                false);
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.wc.SVNUpdateClient

    public long[] update(String[] path, Revision revision, int depth, boolean depthIsSticky, boolean ignoreExternals, boolean allowUnverObstructions) throws ClientException {
        if (path == null || path.length == 0) {
            return new long[]{};
        }
        long[] updated = new long[path.length];
        SVNUpdateClient updater = getSVNUpdateClient();
        boolean oldIgnore = updater.isIgnoreExternals();
        updater.setIgnoreExternals(ignoreExternals);
        updater.setEventPathPrefix("");
        SVNDepth svnDepth = JavaHLObjectFactory.getSVNDepth(depth);
        SVNRevision rev = JavaHLObjectFactory.getSVNRevision(revision);
        try {
            for (int i = 0; i < updated.length; i++) {
                updated[i] = updater.doUpdate(new File(path[i]).getAbsoluteFile(), rev, svnDepth,
                        allowUnverObstructions, depthIsSticky);
            }
        } catch (SVNException e) {
            throwException(e);
        } finally {
            updater.setIgnoreExternals(oldIgnore);
            updater.setEventPathPrefix(null);
            resetLog();
            SVNFileUtil.sleepForTimestamp();
        }
        return updated;
    }
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.