Package org.tmatesoft.svn.core.wc

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


    public long[] update(String[] path, Revision revision, boolean recurse, boolean ignoreExternals) 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("");
        try {
            for (int i = 0; i < updated.length; i++) {
                updated[i] = update(path[i], revision, recurse);
            }
        } finally {
            updater.setIgnoreExternals(oldIgnore);
            updater.setEventPathPrefix(null);
            SVNFileUtil.sleepForTimestamp();
        }
        return updated;
    }
View Full Code Here


    public long doExport(String srcPath, String destPath, Revision revision, boolean force) throws ClientException {
        return doExport(srcPath, destPath, revision, null, force, false, true, "");
    }

    public long doExport(String srcPath, String destPath, Revision revision, Revision pegRevision, boolean force, boolean ignoreExternals, boolean recurse, String nativeEOL) throws ClientException {
        SVNUpdateClient updater = getSVNUpdateClient();
        boolean oldIgnore = updater.isIgnoreExternals();
        updater.setIgnoreExternals(ignoreExternals);
        try {
            if(isURL(srcPath)){
                return updater.doExport(SVNURL.parseURIEncoded(srcPath), new File(destPath).getAbsoluteFile(),
                        JavaHLObjectFactory.getSVNRevision(pegRevision), JavaHLObjectFactory.getSVNRevision(revision), nativeEOL, force, recurse);
            }
            return updater.doExport(new File(srcPath).getAbsoluteFile(), new File(destPath).getAbsoluteFile(),
                    JavaHLObjectFactory.getSVNRevision(pegRevision), JavaHLObjectFactory.getSVNRevision(revision), nativeEOL, force, recurse);
        } catch (SVNException e) {
            throwException(e);
        } finally {
            updater.setIgnoreExternals(oldIgnore);
        }
        return -1;
    }
View Full Code Here

            path = getCommandLine().getPathAt(1);
        }

        SVNRevision revision = parseRevision(getCommandLine());
        getClientManager().setEventHandler(new SVNCommandEventProcessor(out, err, false, true));
        SVNUpdateClient updater = getClientManager().getUpdateClient();
        String eol = (String) getCommandLine().getArgumentValue(SVNArgument.EOL_STYLE);
        if (url != null) {
            if (revision != SVNRevision.HEAD && revision.getDate() == null && revision.getNumber() < 0) {
                revision = SVNRevision.HEAD;
            }
            updater.doExport(SVNURL.parseURIEncoded(url), new File(path).getAbsoluteFile(), revision, revision, eol,
                    getCommandLine().hasArgument(SVNArgument.FORCE), !getCommandLine().hasArgument(SVNArgument.NON_RECURSIVE));
        } else if (srcPath != null) {
            if (revision == SVNRevision.UNDEFINED) {
                revision = SVNRevision.WORKING;
            }
            updater.doExport(new File(srcPath).getAbsoluteFile(), new File(path).getAbsoluteFile(), SVNRevision.UNDEFINED, revision, eol,
                    getCommandLine().hasArgument(SVNArgument.FORCE), !getCommandLine().hasArgument(SVNArgument.NON_RECURSIVE));
        }
    }
View Full Code Here

      ISVNAuthenticationManager authManager = new BasicAuthenticationManager(
          user, password);
      clientManager.setAuthenticationManager(authManager);
    }

    SVNUpdateClient updateClient = clientManager.getUpdateClient();

    updateClient.setIgnoreExternals(false);

    return updateClient.doCheckout(svnUrl, destinationDir,
        SVNRevision.HEAD, SVNRevision.HEAD, SVNDepth.INFINITY, false);
  }
View Full Code Here

        return new UpdateTask() {
            private static final long serialVersionUID = 8349986526712487762L;

            @Override
            public List<External> perform() throws IOException, InterruptedException {
                final SVNUpdateClient svnuc = clientManager.getUpdateClient();
                final List<External> externals = new ArrayList<External>(); // store discovered externals to here

                listener.getLogger().println("Cleaning local Directory " + location.getLocalDir());
                Util.deleteContentsRecursive(new File(ws, location.getLocalDir()));

                // buffer the output by a separate thread so that the update operation
                // won't be blocked by the remoting of the data
                PipedOutputStream pos = new PipedOutputStream();
                StreamCopyThread sct = new StreamCopyThread("svn log copier", new PipedInputStream(pos), listener.getLogger());
                sct.start();

                try {
                 
                  SVNRevision r = getRevision(location);

                    String revisionName = r.getDate() != null ?
                        fmt.format(r.getDate()) : r.toString();
                 
                    listener.getLogger().println("Checking out " + location.remote + " at revision " + revisionName);

                    File local = new File(ws, location.getLocalDir());
                    SubversionUpdateEventHandler eventHandler = new SubversionUpdateEventHandler(new PrintStream(pos), externals, local, location.getLocalDir());
                    svnuc.setEventHandler(eventHandler);
                    svnuc.setExternalsHandler(eventHandler);
                    svnuc.setIgnoreExternals(location.isIgnoreExternalsOption());
                    SVNDepth svnDepth = getSvnDepth(location.getDepthOption());
                    SvnCheckout checkout = svnuc.getOperationsFactory().createCheckout();
                    checkout.setSource(SvnTarget.fromURL(location.getSVNURL(), SVNRevision.HEAD));
                    checkout.setSingleTarget(SvnTarget.fromFile(local.getCanonicalFile()));
                    checkout.setDepth(svnDepth);
                    checkout.setRevision(r);
                    checkout.setAllowUnversionedObstructions(true);
                    checkout.setIgnoreExternals(location.isIgnoreExternalsOption());
                    checkout.setExternalsHandler(SvnCodec.externalsHandler(svnuc.getExternalsHandler()));

                    // Workaround for SVNKIT-430 is to set the working copy format when
                    // a checkout is performed.
                    checkout.setTargetWorkingCopyFormat(SubversionWorkspaceSelector.workspaceFormat);
                    checkout.run();
View Full Code Here

           
            if (svnCommand == SvnCommandToUse.CHECKOUT) {
                return delegateTo(new CheckoutUpdater());
            }

            final SVNUpdateClient svnuc = clientManager.getUpdateClient();
            final List<External> externals = new ArrayList<External>(); // store discovered externals to here

            try {
                File local = new File(ws, location.getLocalDir());
                SubversionUpdateEventHandler eventHandler = new SubversionUpdateEventHandler(listener.getLogger(), externals, local, location.getLocalDir());
                svnuc.setEventHandler(eventHandler);
                svnuc.setExternalsHandler(eventHandler);

                SVNRevision r = getRevision(location);

                String revisionName = r.getDate() != null ?
                    fmt.format(r.getDate()) : r.toString();
               
                svnuc.setIgnoreExternals(location.isIgnoreExternalsOption());
                preUpdate(location, local);
                SVNDepth svnDepth = getSvnDepth(location.getDepthOption());
               
                switch (svnCommand) {
                    case UPDATE:
                        listener.getLogger().println("Updating " + location.remote + " at revision " + revisionName);
                        svnuc.doUpdate(local.getCanonicalFile(), r, svnDepth, true, true);
                        break;
                    case SWITCH:
                        listener.getLogger().println("Switching to " + location.remote + " at revision " + revisionName);
                        svnuc.doSwitch(local.getCanonicalFile(), location.getSVNURL(), r, r, svnDepth, true, true, true);
                        break;
                    case CHECKOUT:
                        // This case is handled by the (svnCommand == SvnCommandToUse.CHECKOUT) above.
                        break;
                }
View Full Code Here

   * only child entries of the directory;
   */
  private static 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,
        isRecursive);
  }
View Full Code Here

   * of the directory;
   */
  private static 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, isRecursive);
  }
View Full Code Here

   * of the directory;
   */
  private static 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, updateToRevision, isRecursive);
  }
View Full Code Here

    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

Related Classes of org.tmatesoft.svn.core.wc.SVNUpdateClient

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.