Package org.tmatesoft.svn.core.wc

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


    public long doExport(String srcPath, String destPath, Revision revision, Revision pegRevision, boolean force, boolean ignoreExternals, boolean recurse, String nativeEOL) throws ClientException {
        return doExport(srcPath, destPath, revision, pegRevision, force, ignoreExternals, JavaHLObjectFactory.infinityOrFiles(recurse), nativeEOL);
    }

    public long doExport(String srcPath, String destPath, Revision revision, Revision pegRevision, boolean force, boolean ignoreExternals, int depth, 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, JavaHLObjectFactory.getSVNDepth(depth));
            }
            return updater.doExport(new File(srcPath).getAbsoluteFile(), new File(destPath).getAbsoluteFile(),
                    JavaHLObjectFactory.getSVNRevision(pegRevision), JavaHLObjectFactory.getSVNRevision(revision), nativeEOL, force, JavaHLObjectFactory.getSVNDepth(depth));
        } catch (SVNException e) {
            throwException(e);
        } finally {
            updater.setIgnoreExternals(oldIgnore);
            resetLog();
        }
        return -1;
    }
View Full Code Here


            resetLog();
        }
    }

    public void relocate(String from, String to, String path, boolean recurse) throws ClientException {
        SVNUpdateClient client = getSVNUpdateClient();
        try {
            client.doRelocate(new File(path).getAbsoluteFile(), SVNURL.parseURIEncoded(from), SVNURL.parseURIEncoded(to), recurse);
        } catch (SVNException e) {
            throwException(e);
        } finally {
            resetLog();
        }
View Full Code Here

        return doSwitch(path, url, revision, Revision.HEAD, JavaHLObjectFactory.unknownOrFiles(recurse), false, false, false);
    }

    public long doSwitch(String path, String url, Revision revision, Revision pegRevision, int depth,
            boolean depthIsSticky, boolean ignoreExternals, boolean allowUnverObstructions) throws ClientException {
        SVNUpdateClient updater = getSVNUpdateClient();
        try {
            return updater.doSwitch(new File(path).getAbsoluteFile(), SVNURL.parseURIEncoded(url),
                    JavaHLObjectFactory.getSVNRevision(pegRevision),
                    JavaHLObjectFactory.getSVNRevision(revision), JavaHLObjectFactory.getSVNDepth(depth),
                    allowUnverObstructions, depthIsSticky);
        } catch (SVNException e) {
            throwException(e);
View Full Code Here

    public long checkout(String moduleName, String destPath, Revision revision, Revision pegRevision, boolean recurse, boolean ignoreExternals) throws ClientException {
        return checkout(moduleName, destPath, revision, pegRevision, JavaHLObjectFactory.infinityOrFiles(recurse), ignoreExternals, false);
    }

    public long checkout(String moduleName, String destPath, Revision revision, Revision pegRevision, int depth, boolean ignoreExternals, boolean allowUnverObstructions) throws ClientException {
        SVNUpdateClient updater = getSVNUpdateClient();
        boolean oldIgnoreExternals = updater.isIgnoreExternals();
        updater.setIgnoreExternals(ignoreExternals);
        try {
            File path = new File(destPath).getAbsoluteFile();
            return updater.doCheckout(SVNURL.parseURIEncoded(moduleName), path, JavaHLObjectFactory.getSVNRevision(pegRevision),
                    JavaHLObjectFactory.getSVNRevision(revision), JavaHLObjectFactory.getSVNDepth(depth), allowUnverObstructions);
        } catch (SVNException e) {
            throwException(e);
        } finally {
            updater.setIgnoreExternals(oldIgnoreExternals);
            resetLog();
        }
        return -1;
    }
View Full Code Here

        logger.info(msg + ": " + info);
               
        File  demoDir = new File(wcRoot, "demo"),
          customDir = new File(wcRoot, "custom");
       
        SVNUpdateClient updateClient = clientManager.getUpdateClient();
        updateClient.doCheckout(reposURL, wcRoot, SVNRevision.UNDEFINED, SVNRevision.HEAD, SVNDepth.INFINITY,
                false);
        logger.info("Checked out working copy to " + wcRoot);
       
        overwriteTree(newDemoTree, demoDir);
/*       
        for (File f: dirsCreated)
          clientManager.getWCClient( ).doAdd( f, false , false , false , false );
        for (File f: filesCreated)
          clientManager.getWCClient( ).doAdd( f, false , false , false , false );
*/
        msg = "Commit of newDMO (in demo tree)";
        info = commitClient.doCommit(new File[] { wcRoot }, false, msg, null, null, false,
                              false, SVNDepth.INFINITY);       
        //final long revNewDMO = info.getNewRevision();
/*
        diffClient.doDiffStatus(reposURL, SVNRevision.create(revOldDemo), reposURL, SVNRevision.create(revNewDMO),
            true, true, new ISVNDiffStatusHandler() {       
          public void handleDiffStatus(SVNDiffStatus arg0) throws SVNException {
            if (arg0.getURL().toString().endsWith(".pcode"))
            {
              logger.info("Diff in NewDMO-OldDMO: " + arg0.getURL());

               logger.info("path = " + arg0.getPath());
                  SVNProperties properties = SVNProperties.wrap(new HashMap());
                  if (repos.checkPath("/" + arg0.getPath(), revOldDemo) == SVNNodeKind.FILE
                      && repos.checkPath("/" + arg0.getPath(), revNewDMO) == SVNNodeKind.FILE)
                  {
                deltaOldDMONewDMO.add(arg0.getURL());
                    repos.getFile( "/" + arg0.getPath(), revOldDemo, properties, null);
                    String oldCheckSum = properties.getStringValue(SVNProperty.CHECKSUM);
                    repos.getFile("/" +arg0.getPath(), revNewDMO, properties, null);
                    String newCheckSum = properties.getStringValue(SVNProperty.CHECKSUM);
                    logger.info("Checksums: " + oldCheckSum + " " + newCheckSum);
                  }
            }
          }
        });
*/
        logger.info(msg + ":" + info);

        dirsCreated.clear(); filesCreated.clear();
        overwriteTree(oldDevTree, customDir);
/*
        msg = "Commit of old DEV";
        info = commitClient.doCommit(new File[] { wcRoot }, false, msg, null, null, false,
                              false, SVNDepth.INFINITY);         
        logger.info(msg + ":" + info);
        long revOldDEV = info.getNewRevision();
        diffClient.doDiffStatus(reposURL, SVNRevision.create(revNewDMO), reposURL, SVNRevision.create(revOldDEV),
            true, true, new ISVNDiffStatusHandler() {       
          public void handleDiffStatus(SVNDiffStatus arg0) throws SVNException {
            if (arg0.getURL().toString().endsWith(".pcode"))
            {
              logger.fine("Diff in DEV-oldDMO: " + arg0.getURL());
              deltaOldDMODev.add(arg0.getURL());
            }
          }
        });
*/
        updateClient = clientManager.getUpdateClient();
        updateClient.doCheckout(reposURL, wcRoot, SVNRevision.UNDEFINED, SVNRevision.HEAD, SVNDepth.INFINITY,
                false);
        logger.info("Checked out working copy to " + wcRoot);       
       
        File targetOfMerge = (mergeToDMO? demoDir: customDir);
        SVNURL sourceOfMerge = (mergeToDMO? customURL : demoURL);
View Full Code Here

                to = SVNEncodingUtil.uriDecode(to);
            }
        } else {
            to = (String) targets.get(1);
        }
        SVNUpdateClient client = getSVNEnvironment().getClientManager().getUpdateClient();
        if (!getSVNEnvironment().isQuiet()) {
            client.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment(), false, true, false));
        }
        SVNDepth depth = getSVNEnvironment().getDepth();
        if (depth == SVNDepth.UNKNOWN) {
            depth = SVNDepth.INFINITY;
        }
        try {
            SVNPath dst = new SVNPath(to);
            String eol = getSVNEnvironment().getNativeEOL();
            SVNRevision revision = getSVNEnvironment().getStartRevision();
            if (from.isFile()) {
                client.doExport(from.getFile(), dst.getFile(), pegRevision, revision, eol, getSVNEnvironment().isForce(), depth);
            } else {
                client.doExport(from.getURL(), dst.getFile(), pegRevision, revision, eol, getSVNEnvironment().isForce(), depth);
            }
        } catch (SVNException e) {
            SVNErrorMessage err = e.getErrorMessage();
            if (err != null && err.getErrorCode() == SVNErrorCode.WC_OBSTRUCTED_UPDATE) {
                err = err.wrap("Destination directory exists; please remove the directory or use --force to overwrite");
View Full Code Here

            }
            targets.add(lastTarget);
        } else if (targets.size() == 1){
            SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_INSUFFICIENT_ARGS), SVNLogType.CLIENT);
        }
        SVNUpdateClient client = getSVNEnvironment().getClientManager().getUpdateClient();
        if (!getSVNEnvironment().isQuiet()) {
            client.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment(), true, false, false));
        }

        SVNRevision revision = getSVNEnvironment().getStartRevision();
        for (int i = 0; i < targets.size() - 1; i++) {
            String targetName = (String) targets.get(i);
            SVNPath target = new SVNPath(targetName, true);
            if (!target.isURL()) {
                SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.BAD_URL, "''{0}'' doesn not appear to be a URL", targetName), SVNLogType.CLIENT);
            }
            String targetDir;
            SVNPath dstTarget;
            if (targets.size() == 2) {
                // url + path
                targetDir = lastTarget;
                dstTarget = new SVNPath(targetDir);
            } else {
                // all urls + base dst.
                targetDir = target.getURL().getPath();
                targetDir = SVNPathUtil.tail(targetDir);
                targetDir = SVNPathUtil.append(lastTarget, targetDir);
                dstTarget = new SVNPath(targetDir);
            }
            SVNRevision pegRevision = target.getPegRevision();
            if (revision == SVNRevision.UNDEFINED) {
                revision = pegRevision != SVNRevision.UNDEFINED ? pegRevision : SVNRevision.HEAD;
            }
            client.doCheckout(target.getURL(), dstTarget.getFile(), pegRevision, revision, getSVNEnvironment().getDepth(), getSVNEnvironment().isForce());
        }
    }
View Full Code Here

        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

  @Override
  public void execute() throws Exception
  {
    // Get the Update Client
    SVNUpdateClient client = this.getTask().getSvnClient().getUpdateClient();

    SVNURL svnurl = SVNURL.parseURIDecoded(url);

    this.getTask().log("checkout " + url + " " + path);

    long r = client.doCheckout(svnurl, path, pegRevision, revision, depth, force);
    this.getProject().setProperty(this.revisionProperty, new Long(r).toString());
  }
View Full Code Here

    File filePath = new File(this.path);

    this.getTask().log("switch " + filePath.getCanonicalPath() + " to URL " + this.svnUrl + " at revision " + this.revision);

    // Get the Update Client
    SVNUpdateClient client = this.getTask().getSvnClient().getUpdateClient();

    // Execute svn switch
    client.doSwitch(filePath, this.svnUrl, this.pegRevision, this.revision, this.depth, this.allowUnversionedObstructions, this.recursive);
  }
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.