Examples of SVNClientManager

  • org.tmatesoft.svn.core.wc.SVNClientManager
    ault options and authentication drivers to use SVNClientManager clientManager = SVNClientManager.newInstance(); ... //2.provided options and default authentication drivers to use ISVNOptions myOptions; ... SVNClientManager clientManager = SVNClientManager.newInstance(myOptions); ... //3.provided options and authentication drivers to use ISVNOptions myOptions; ISVNAuthenticationManager myAuthManager; ... SVNClientManager clientManager = SVNClientManager.newInstance(myOptions, myAuthManager); ... //4.provided options driver and user's credentials to make //a default authentication driver use them ISVNOptions myOptions; ... SVNClientManager clientManager = SVNClientManager.newInstance(myOptions, "name", "passw");
    Having instantiated an SVNClientManager in one of these ways, all the SVN*Client objects it will provide you will share those drivers, so you don't need to code much to provide the same drivers to each SVN*Client instance by yourself.
  • With SVNClientManager you don't need to create and keep your SVN*Client objects by youself - SVNClientManager will do all the work for you, so this will certainly bring down your efforts on coding and your code will be clearer and more flexible. All you need is to create an SVNClientManager instance.
  • Actually every SVN*Client object is instantiated only at the moment of the first call to an appropriate SVNClientManager's get method:
     SVNClientManager clientManager; ... //an update client will be created only at that moment when you  //first call this method for getting your update client, but if you //have already called it once before, then the method will return //that update client object instantiated in previous... so, it's //quite cheap, you see..  SVNUpdateClient updateClient = clientManager.getUpdateClient();

  • You can provide a single event handler that will be used by all SVN*Client objects provided by SVNClientManager:
     import org.tmatesoft.svn.core.wc.ISVNEventHandler; ... ISVNEventHandler commonEventHandler; SVNClientManager clientManager = SVNClientManager.newInstance(); ... //will be used by all SVN*Client objects //obtained from your client manager clientManager.setEventHandler(commonEventHandler); 
  • @version 1.3 @author TMate Software Ltd. @since 1.2 @see ISVNEventHandler @see Examples

  • Examples of org.tmatesoft.svn.core.wc.SVNClientManager

               
                //now make some changes to the working copy
                SamplesUtility.writeToFile(new File(wcRoot, "iota"), "New text appended to 'iota'", true);
                SamplesUtility.writeToFile(new File(wcRoot, "A/mu"), "New text in 'mu'", false);
               
                SVNClientManager clientManager = SVNClientManager.newInstance();
                SVNWCClient wcClient = SVNClientManager.newInstance().getWCClient();
                wcClient.doSetProperty(new File(wcRoot, "A/B"), "spam", SVNPropertyValue.create("egg"), false,
                        SVNDepth.EMPTY, null, null);

                //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();

                /*
                 * This corresponds to 'svn diff -rBASE:HEAD'.
                 */
                diffClient.doDiff(wcRoot, SVNRevision.UNDEFINED, SVNRevision.BASE, SVNRevision.HEAD,
    View Full Code Here

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

                SVNURL reposURL = SVNURL.fromFile(reposRoot);
                //checkout the entire repository tree
                SamplesUtility.checkOutWorkingCopy(reposURL, wcRoot);

                SVNClientManager clientManager = SVNClientManager.newInstance();
                SVNStatusClient statusClient = clientManager.getStatusClient();
                ISVNStatusHandler handler = new StatusHandler();

                statusClient.doStatus(wcRoot, SVNRevision.WORKING, SVNDepth.INFINITY, true, true, false, false,
                        handler, null);
               
                SVNWCClient wcClient = clientManager.getWCClient();
                wcClient.doSetWCFormat(wcRoot, 4);
               
                statusClient.doStatus(wcRoot, SVNRevision.WORKING, SVNDepth.INFINITY, false, true, false, false,
                        handler, null);
               
    View Full Code Here

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

               
                //now make some changes to the working copy
                SamplesUtility.writeToFile(new File(wcRoot, "iota"), "New text appended to 'iota'", true);
                SamplesUtility.writeToFile(new File(wcRoot, "A/mu"), "New text in 'mu'", false);
               
                SVNClientManager clientManager = SVNClientManager.newInstance();
                SVNWCClient wcClient = SVNClientManager.newInstance().getWCClient();
                wcClient.doSetProperty(new File(wcRoot, "A/B"), "spam", SVNPropertyValue.create("egg"), false,
                        SVNDepth.EMPTY, null, null);
               
                //now run diff the working copy against the repository
                SVNDiffClient diffClient = clientManager.getDiffClient();

                /*
                 * This corresponds to 'svn diff -rHEAD'.
                 */
                diffClient.doDiff(wcRoot, SVNRevision.UNDEFINED, SVNRevision.WORKING, SVNRevision.HEAD,
    View Full Code Here

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

            FileUtils.deleteDirectory(LOCAL_REPO);
            FileUtils.deleteDirectory(WORKING_COPY);
        }

        public void testConversion() throws SVNException, IOException {
            SVNClientManager ourClientManager = SVNClientManager.newInstance();
            // checkout working copy
            SVNUpdateClient updateClient = ourClientManager.getUpdateClient();
            updateClient.setIgnoreExternals(false);
            updateClient.doCheckout(tgtURL, WORKING_COPY, SVNRevision.UNDEFINED, SVNRevision.HEAD, SVNDepth.INFINITY, true);
            // add file under version control
            int id1 = 45;
            create(ourClientManager, id1);
            modify(ourClientManager, id1);
            int id2 = 2;
            create(ourClientManager, id2);
            modify(ourClientManager, id2);

            delete(ourClientManager, id1);
            delete(ourClientManager, id2);

            final SVNRepository repository = SVNRepositoryFactory.create(tgtURL);
            MyLogEntryHandler logEntryHandler = new MyLogEntryHandler();
            repository.log(new String[]{""}, 0, -1, true, true, logEntryHandler);
            final List<MetadataAction> metadataActionList = logEntryHandler.getMetadataActionList();
            // only partial assertion of entered data
            for (MetadataAction metadataAction : metadataActionList) {
                Assert.assertEquals("admin", metadataAction.getUsername());
                Assert.assertEquals("0:0:0:0:0:0:0:1", metadataAction.getIp());
            }
            final MetadataAction firstEntry = metadataActionList.get(0);
            Assert.assertEquals("all", firstEntry.getSubject());
            Assert.assertEquals(id1, firstEntry.getId());
            Assert.assertEquals('A', firstEntry.getAction());
            Assert.assertNotNull(firstEntry.getDate());
            final MetadataAction lastEntry = metadataActionList.get(metadataActionList.size() - 1);
            Assert.assertEquals('D', lastEntry.getAction());
            Assert.assertEquals("all", lastEntry.getSubject());

            ourClientManager.dispose();
        }
    View Full Code Here

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

            ourClientManager.dispose();
        }

        public void testTitleAdding() throws SVNException, IOException, JDOMException {
            SVNClientManager ourClientManager = SVNClientManager.newInstance();
            // checkout working copy
            SVNUpdateClient updateClient = ourClientManager.getUpdateClient();
            updateClient.setIgnoreExternals(false);
            updateClient.doCheckout(tgtURL, WORKING_COPY, SVNRevision.UNDEFINED, SVNRevision.HEAD, SVNDepth.INFINITY, true);
            // add file under version control
            int id = 1;
            create(ourClientManager, id);
    View Full Code Here

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

                String sourceURL = getCommandLine().getURL(1);
                if (matchTabsInURL(sourceURL, err)) {
                    return;
                }
               
                SVNClientManager manager = getClientManager();
                SVNAdminClient adminClient = manager.getAdminClient();
                adminClient.doInitialize(SVNURL.parseURIDecoded(sourceURL), SVNURL.parseURIDecoded(destURL));
                SVNCommand.println(out, "Copied properties for revision 0.");
            }
        }
    View Full Code Here

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

                String destURL = getCommandLine().getURL(0);
                if (matchTabsInURL(destURL, err)) {
                    return;
                }

                SVNClientManager manager = getClientManager();
                SVNAdminClient adminClient = manager.getAdminClient();
                final PrintStream outStream = out;
                adminClient.setReplayHandler(new ISVNLogEntryHandler() {
                    public void handleLogEntry(SVNLogEntry logEntry) throws SVNException {
                        SVNCommand.println(outStream, "Committed revision " + logEntry.getRevision() + ".");
                    }
    View Full Code Here

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

                   
                } else {
                    revNumber = revision.getNumber();
                }
               
                SVNClientManager manager = getClientManager();
                SVNAdminClient adminClient = manager.getAdminClient();
                adminClient.doCopyRevisionProperties(SVNURL.parseURIDecoded(destURL), revNumber);
            }
        }
    View Full Code Here

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

       *            used for authentication on the repository's server
       */
      private void checkProjectRepository(String svnUrl, String svnUser,
          String svnPassword) throws SVNException {

        SVNClientManager svnClientManager = SVNClientManager.newInstance();

        if (!svnUser.isEmpty() && !svnPassword.isEmpty()) {

          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() {
    View Full Code Here

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

       
        public void setUp() throws Exception {
            super.setUp();
            File repo = new CopyExisting(DefaultSVNLogFilter.class.getResource("JENKINS-10449.zip")).allocate();
            SVNURL svnUrl = SVNURL.fromFile(repo);
            SVNClientManager svnMgr = SVNClientManager.newInstance();
            svnRepo = svnMgr.createRepository(svnUrl, 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.