Package org.tmatesoft.svn.core.wc

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


            throwException(e);
        }
    }

    public Info2[] info2(String pathOrUrl, Revision revision, Revision pegRevision, boolean recurse) throws ClientException {
        SVNWCClient client = getSVNWCClient();
        final Collection infos = new ArrayList();
        ISVNInfoHandler handler = new ISVNInfoHandler(){
            public void handleInfo(SVNInfo info) {
                infos.add(JavaHLObjectFactory.createInfo2(info));
            }
        };
        try {
            if(isURL(pathOrUrl)){
                client.doInfo(SVNURL.parseURIEncoded(pathOrUrl),
                        JavaHLObjectFactory.getSVNRevision(pegRevision),
                        JavaHLObjectFactory.getSVNRevision(revision),
                        recurse, handler);
            }else{
                client.doInfo(new File(pathOrUrl).getAbsoluteFile(),
                        JavaHLObjectFactory.getSVNRevision(revision),
                        recurse, handler);
            }
            return (Info2[]) infos.toArray(new Info2[infos.size()]);
        } catch (SVNException e) {
View Full Code Here


    private void runLocally(final PrintStream out, PrintStream err) {
        boolean force = getCommandLine().hasArgument(SVNArgument.FORCE);

        getClientManager().setEventHandler(new SVNCommandEventProcessor(out, err, false));

        SVNWCClient client = getClientManager().getWCClient();
        boolean error = false;
        for (int i = 0; i < getCommandLine().getPathCount(); i++) {
            final String absolutePath = getCommandLine().getPathAt(i);
            try {
                client.doDelete(new File(absolutePath), force, false);
            } catch (SVNException e) {
                err.println(e.getMessage());
                error = true;
            }
        }
View Full Code Here

    public final void run(final PrintStream out, final PrintStream err) throws SVNException {
        final boolean recursive = getCommandLine().hasArgument(SVNArgument.RECURSIVE);
       
        getClientManager().setEventHandler(new SVNCommandEventProcessor(out, err, false));
        SVNWCClient wcClient = getClientManager().getWCClient();
        for (int i = 0; i < getCommandLine().getPathCount(); i++) {
            final String absolutePath = getCommandLine().getPathAt(i);
            // hack to make schedule 9 test pass
            if ("".equals(absolutePath) || ".".equals(absolutePath)) {
                File path = new File(SVNPathUtil.validateFilePath(absolutePath)).getAbsoluteFile();
                if (path.isDirectory()) {
                    SVNStatus status = getClientManager().getStatusClient().doStatus(path, false);
                    if (status.getContentsStatus() == SVNStatusType.STATUS_ADDED) {
                        // we're inside an added directory, skip it.
                        System.err.println("Skipped: " + absolutePath);
                        continue;
                    }
                }
            }
            wcClient.doRevert(new File(absolutePath), recursive);
        }
    }
View Full Code Here

        run(out, err);
    }

    public void run(final PrintStream out, final PrintStream err) throws SVNException {
        String path = getCommandLine().getPathAt(0);
        SVNWCClient client = getClientManager().getWCClient();
        client.doCleanup(new File(path).getAbsoluteFile());
    }
View Full Code Here

        }
        if (paths.isEmpty()) {
            return;
        }
        getClientManager().setEventHandler(new SVNCommandEventProcessor(out, err, false));
        SVNWCClient wcClient = getClientManager().getWCClient();
        boolean recursive = !getCommandLine().hasArgument(SVNArgument.NON_RECURSIVE);
        for (Iterator files = paths.iterator(); files.hasNext();) {
            File file = (File) files.next();
            try {
                wcClient.doAdd(file, false, true, false, recursive, false);
            } catch (SVNException e) {
                err.println(e.getMessage());
            }
        }
    }
View Full Code Here

    public void run(InputStream in, PrintStream out, PrintStream err) throws SVNException {
        run(out, err);
    }

    public void run(PrintStream out, PrintStream err) throws SVNException {
        SVNWCClient wcClient = getClientManager().getWCClient();
        SVNRevision revision = SVNRevision.BASE;

        if (getCommandLine().hasArgument(SVNArgument.REVISION)) {
            revision = SVNRevision.parse((String) getCommandLine().getArgumentValue(SVNArgument.REVISION));
        }
        for (int index = 0; index < getCommandLine().getPathCount(); index++) {
            final String absolutePath = getCommandLine().getPathAt(index);
            SVNRevision pegRevision = getCommandLine().getPathPegRevision(index);
            try {
                wcClient.doGetFileContents(new File(absolutePath), pegRevision, revision, true, out);
            } catch (SVNException e) {
                String message = e.getMessage();
                err.println(message);               
            }
            out.flush();
        }

        revision = SVNRevision.HEAD;
        if (getCommandLine().hasArgument(SVNArgument.REVISION)) {
            revision = SVNRevision.parse((String) getCommandLine().getArgumentValue(SVNArgument.REVISION));
        }
        for (int index = 0; index < getCommandLine().getURLCount(); index++) {
            final String url = getCommandLine().getURL(index);
            SVNRevision pegRevision = getCommandLine().getPegRevision(index);
            try {
                wcClient.doGetFileContents(SVNURL.parseURIEncoded(url), pegRevision, revision, true, out);
            } catch (SVNException e) {
                String message = e.getMessage();
                err.println(message);               
            }
            out.flush();
View Full Code Here

    public void run(PrintStream out, PrintStream err) throws SVNException {
        boolean force = getCommandLine().hasArgument(SVNArgument.FORCE);
        String message = (String) getCommandLine().getArgumentValue(SVNArgument.MESSAGE);
        getClientManager().setEventHandler(new SVNCommandEventProcessor(out, err, false));
        SVNWCClient wcClient = getClientManager().getWCClient();
       
        Collection files = new ArrayList();
        for (int i = 0; i < getCommandLine().getPathCount(); i++) {
            files.add(new File(getCommandLine().getPathAt(i)));
        }
        File[] filesArray = (File[]) files.toArray(new File[files.size()]);
        if (filesArray.length > 0) {
            wcClient.doLock(filesArray, force, message);
        }
        files.clear();
       
        for (int i = 0; i < getCommandLine().getURLCount(); i++) {
            files.add(getCommandLine().getURL(i));
        }
        String[] urls = (String[]) files.toArray(new String[files.size()]);
        SVNURL[] svnURLs = new SVNURL[urls.length];
        for (int i = 0; i < urls.length; i++) {
            svnURLs[i] = SVNURL.parseURIEncoded(urls[i]);
        }
        if (urls.length > 0) {
            wcClient.doLock(svnURLs, force, message);
        }
    }
View Full Code Here

      ISVNAuthenticationManager authManager = new BasicAuthenticationManager(
          svnUser, svnPassword);
      svnClientManager.setAuthenticationManager(authManager);
    }

    SVNWCClient wcClient = svnClientManager.getWCClient();

    wcClient.setIgnoreExternals(false);

    wcClient.doInfo(SVNURL.parseURIDecoded(svnUrl), SVNRevision.HEAD,
        SVNRevision.HEAD, SVNDepth.IMMEDIATES, new ISVNInfoHandler() {

          @Override
          public void handleInfo(SVNInfo info) throws SVNException {
View Full Code Here

     *      The target to run "svn info".
     */
    static SVNInfo parseSvnInfo(SVNURL remoteUrl, ISVNAuthenticationProvider authProvider) throws SVNException {
        final SvnClientManager manager = createClientManager(authProvider);
        try {
            final SVNWCClient svnWc = manager.getWCClient();
            return svnWc.doInfo(remoteUrl, SVNRevision.HEAD, SVNRevision.HEAD);
        } finally {
            manager.dispose();
        }
    }
View Full Code Here

                if (authProvider == null) {
                    authProvider = defaultAuthProvider;
                }
                final SvnClientManager manager = createClientManager(authProvider);
                try {
                    final SVNWCClient svnWc = manager.getWCClient();
                    // invoke the "svn info"
                    try {
                        SvnInfo info =
                                new SvnInfo(svnWc.doInfo(new File(ws, module.getLocalDir()), SVNRevision.WORKING));
                        revisions.add(new SvnInfoP(info, false));
                    } catch (SVNException e) {
                        e.printStackTrace(listener.error("Failed to parse svn info for " + module.remote));
                    }
                } finally {
                    manager.dispose();
                }
            }
            final SvnClientManager manager = createClientManager(defaultAuthProvider);
            try {
                final SVNWCClient svnWc = manager.getWCClient();
                for (External ext : externals) {
                    try {
                        SvnInfo info = new SvnInfo(svnWc.doInfo(new File(ws, ext.path), SVNRevision.WORKING));
                        revisions.add(new SvnInfoP(info, ext.isRevisionFixed()));
                    } catch (SVNException e) {
                        e.printStackTrace(
                                listener.error("Failed to parse svn info for external " + ext.url + " at " + ext.path));
                    }
View Full Code Here

TOP

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

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.