Examples of SVNCommitClient


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

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

            //now make some local changes to the A_copy tree
            //change file contents of A_copy/B/lambda and A_copy/mu
            SamplesUtility.writeToFile(new File(wcRoot, "A_copy/B/lambda"), "New text in copied 'lambda'", true);
            SamplesUtility.writeToFile(new File(wcRoot, "A_copy/mu"), "New text in copied 'mu'", false);
View Full Code Here

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

            final FileBasedProctorStore.RcsClient rcsClient = new SvnPersisterCoreImpl.SvnRcsClient(wcClient);
            final boolean thingsChanged = updater.doInWorkingDirectory(rcsClient, userDir);

            if (thingsChanged) {
                final SVNCommitClient commitClient = userClientManager.getCommitClient();
                final SVNCommitPacket commit = commitClient.doCollectCommitItems(new File[]{userDir}, false, false, SVNDepth.INFINITY, new String[0]);
                long elapsed = -System.currentTimeMillis();
                final SVNCommitInfo info = commitClient.doCommit(commit, /* keepLocks */ false, comment);
                elapsed += System.currentTimeMillis();
                if (logger.isDebugEnabled()) {
                    final StringBuilder changes = new StringBuilder("Committed " + commit.getCommitItems().length + " changes: ");
                    for (final SVNCommitItem item : commit.getCommitItems()) {
                        changes.append(item.getKind() + " - " + item.getPath() + ", ");
View Full Code Here

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

            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);
           
            //now diff the base revision of the working copy against the repository
            SVNDiffClient diffClient = clientManager.getDiffClient();
            SVNRevisionRange rangeToMerge = new SVNRevisionRange(SVNRevision.create(1), SVNRevision.HEAD);
           
            diffClient.doMerge(A_URL, SVNRevision.HEAD, Collections.singleton(rangeToMerge),
                    new File(wcRoot, "A_copy"), SVNDepth.UNKNOWN, true, false, false, false);
           
            //now make some changes to the A tree again
            //change file contents of iota and A/D/gamma
            SamplesUtility.writeToFile(new File(wcRoot, "iota"), "New text2 appended to 'iota'", true);
            SamplesUtility.writeToFile(new File(wcRoot, "A/D/gamma"), "New text in 'gamma'", false);
            //remove A/C from version control
            wcClient.doDelete(new File(wcRoot, "A/C"), false, true, false);

            //commit local changes
            commitClient.doCommit(new File[] { wcRoot }, false, "committing changes again", null, null, false, false, SVNDepth.INFINITY);

            /* do the same merge call, merge-tracking feature will merge only those revisions
             * which were not still merged.
             */
            diffClient.doMerge(A_URL, SVNRevision.HEAD, Collections.singleton(rangeToMerge),
View Full Code Here

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

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

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

        boolean areURLs = false;
        for (int i = 0; i < path.length; i++) {
            areURLs = areURLs || isURL(path[i]);
        }
        if (areURLs) {
            SVNCommitClient client = getSVNCommitClient();
            SVNURL[] urls = new SVNURL[path.length];
            for (int i = 0; i < urls.length; i++) {
                try {
                    urls[i] = SVNURL.parseURIEncoded(path[i]);
                } catch (SVNException e) {
                    throwException(e);
                }
            }
            try {
                SVNProperties revisionProperties = revprops == null ? null : SVNProperties.wrap(revprops);
                client.setCommitHandler(createCommitMessageHandler(true));
                client.doDelete(urls, message, revisionProperties);
            } catch (SVNException e) {
                throwException(e);
            } finally {
                if (client != null) {
                    client.setCommitHandler(null);
                }
                resetLog();
            }
        } else {
            SVNWCClient client = getSVNWCClient();
            for (int i = 0; i < path.length; i++) {
                try {
                    client.doDelete(new File(path[i]).getAbsoluteFile(), force, !keepLocal, false);
                } catch (SVNException e) {
                    throwException(e);
                } finally {
                    resetLog();
                }
View Full Code Here

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

    public long commit(String[] path, String message, int depth, boolean noUnlock, boolean keepChangelist, String[] changelists, Map revprops) throws ClientException {
        if (path == null || path.length == 0) {
            return 0;
        }
        SVNCommitClient client = getSVNCommitClient();
        File[] files = new File[path.length];
        for (int i = 0; i < path.length; i++) {
            files[i] = new File(path[i]).getAbsoluteFile();
        }
        try {
            client.setCommitHandler(createCommitMessageHandler(false, false));
            SVNDepth svnDepth = SVNDepth.fromID(depth);
            boolean recurse = SVNDepth.recurseFromDepth(svnDepth);
            SVNProperties revisionProperties = revprops == null ? null : SVNProperties.wrap(revprops);
            return client.doCommit(files, noUnlock, message, revisionProperties, changelists, keepChangelist, !recurse, svnDepth).getNewRevision();
        } catch (SVNException e) {
            throwException(e);
        } finally {
            if (client != null) {
                client.setCommitHandler(null);
            }
            resetLog();
        }
        return -1;
    }
View Full Code Here

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

    public long[] commit(String[] path, String message, int depth, boolean noUnlock, boolean keepChangelist, String[] changlelists, Map revprops, boolean atomicCommit) throws ClientException {
        if (path == null || path.length == 0) {
            return new long[0];
        }
        SVNCommitClient client = getSVNCommitClient();
        File[] files = new File[path.length];
        for (int i = 0; i < path.length; i++) {
            files[i] = new File(path[i]).getAbsoluteFile();
        }
        SVNCommitPacket[] packets = null;
        SVNCommitInfo[] commitResults = null;
        try {
            client.setCommitHandler(createCommitMessageHandler(false));
            SVNDepth svnDepth = SVNDepth.fromID(depth);   
            boolean recurse = SVNDepth.recurseFromDepth(svnDepth);
            packets = client.doCollectCommitItems(files, noUnlock, !recurse, svnDepth, atomicCommit, changlelists);
            commitResults = client.doCommit(packets, noUnlock, keepChangelist, message, revprops != null ? SVNProperties.wrap(revprops) : null);
        } catch (SVNException e) {
            throwException(e);
        } finally {
            if (client != null) {
                client.setCommitHandler(null);
            }
            resetLog();
        }
        if (commitResults != null && commitResults.length > 0) {
            long[] revisions = new long[commitResults.length];
View Full Code Here

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

    public void mkdir(String[] path, String message) throws ClientException {
        mkdir(path, message, false, null);
    }

    public void mkdir(String[] path, String message, boolean makeParents, Map revprops) throws ClientException {
        SVNCommitClient client = getSVNCommitClient();
        List urls = new ArrayList();
        List paths = new ArrayList();
        for (int i = 0; i < path.length; i++) {
            if (isURL(path[i])) {
                try {
                    urls.add(SVNURL.parseURIEncoded(path[i]));
                } catch (SVNException e) {
                    throwException(e);
                }
            } else {
                paths.add(new File(path[i]));
            }
        }
        SVNURL[] svnURLs = (SVNURL[]) urls.toArray(new SVNURL[urls.size()]);
        File[] files = (File[]) paths.toArray(new File[paths.size()]);
        if (svnURLs.length > 0) {
            try {
                SVNProperties revisionProperties = revprops == null ? null : SVNProperties.wrap(revprops);
                client.setCommitHandler(createCommitMessageHandler(true, true));
                client.doMkDir(svnURLs, message, revisionProperties, makeParents);
            } catch (SVNException e) {
                throwException(e);
            } finally {
                if (client != null) {
                    client.setCommitHandler(null);
                }
            }
           
        }
        if (files.length > 0) {
View Full Code Here

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

    public void doImport(String path, String url, String message, boolean recurse) throws ClientException {
        doImport(path, url, message, JavaHLObjectFactory.infinityOrFiles(recurse), false, false, null);
    }

    public void doImport(String path, String url, String message, int depth, boolean noIgnore, boolean ignoreUnknownNodeTypes, Map revprops) throws ClientException {
        SVNCommitClient commitClient = getSVNCommitClient();
        try {
            commitClient.setCommitHandler(createCommitMessageHandler(false, true));
            SVNProperties revisionProperties = revprops == null ? null : SVNProperties.wrap(revprops);
            commitClient.doImport(new File(path), SVNURL.parseURIEncoded(url), message, revisionProperties, !noIgnore, ignoreUnknownNodeTypes, JavaHLObjectFactory.getSVNDepth(depth));
        } catch (SVNException e) {
            throwException(e);
        } finally {
            if (commitClient != null) {
                commitClient.setCommitHandler(null);
            }
            resetLog();
        }
    }
View Full Code Here

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

        for (int i = 0; i < getCommandLine().getPathCount(); i++) {
            matchTabsInPath(getCommandLine().getPathAt(i), err);
            localPaths[i] = new File(getCommandLine().getPathAt(i));
        }
        getClientManager().setEventHandler(new SVNCommandEventProcessor(out, err, false));
        SVNCommitClient client = getClientManager().getCommitClient();
        SVNCommitInfo result = client.doCommit(localPaths, keepLocks, message, false, recursive);
        if (result != SVNCommitInfo.NULL) {
            out.println();
            out.println("Committed revision " + result.getNewRevision() + ".");
        }
        if (result.getErrorMessage() != null && result.getErrorMessage().getErrorCode() == SVNErrorCode.REPOS_POST_COMMIT_HOOK_FAILED) {
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.