Examples of SVNPath


Examples of org.tmatesoft.svn.core.internal.wc.SVNPath

        sources = expandCopySources(sources);
        if (sources.length == 0) {
            return SVNCommitInfo.NULL;
        }
        try {
            return setupCopy(sources, new SVNPath(dst.toString()), isMove, makeParents, commitMessage,
                    revisionProperties, getCommitHandler(), getCommitParameters(), getExternalsHandler());
        } catch (SVNException e) {
            SVNErrorCode err = e.getErrorMessage().getErrorCode();
            if (!failWhenDstExists && sources.length == 1 && (err == SVNErrorCode.ENTRY_EXISTS || err == SVNErrorCode.FS_ALREADY_EXISTS)) {
                SVNCopySource source = sources[0];
                String baseName = source.getName();
                if (!source.isURL()) {
                    baseName = SVNEncodingUtil.uriEncode(baseName);
                }
                try {
                    return setupCopy(sources, new SVNPath(dst.appendPath(baseName, true).toString()), isMove,
                            makeParents, commitMessage, revisionProperties, getCommitHandler(), getCommitParameters(), getExternalsHandler());
                } catch (SVNException second) {
                    throw second;
                }
            }
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.wc.SVNPath

        return options;
    }

    public void run() throws SVNException {
        List targets = getSVNEnvironment().combineTargets(new ArrayList(), true);
        SVNPath url = null;
        SVNPath src = null;
        if (targets.isEmpty()) {
            SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_INSUFFICIENT_ARGS,
                    "Repository URL required when importing"), SVNLogType.CLIENT);
        } else if (targets.size() > 2) {
            SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR,
                "Too many arguments to import command"), SVNLogType.CLIENT);
        } else if (targets.size() == 1) {
            src = new SVNPath("");
            url = new SVNPath((String) targets.get(0));
        } else {
            src = new SVNPath((String) targets.get(0));
            url = new SVNPath((String) targets.get(1));
        }
        if (!url.isURL()) {
            SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR,
                    "Invalid URL ''{0}''", url.getTarget()), SVNLogType.CLIENT);
        }
        SVNCommitClient client = getSVNEnvironment().getClientManager().getCommitClient();
        if (!getSVNEnvironment().isQuiet()) {
            client.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment()));
        }
        SVNDepth depth = getSVNEnvironment().getDepth();
        if (depth == SVNDepth.UNKNOWN) {
            depth = SVNDepth.INFINITY;
        }
        client.setCommitHandler(getSVNEnvironment());
        SVNCommitInfo info = client.doImport(src.getFile(), url.getURL(), getSVNEnvironment().getMessage(),
                getSVNEnvironment().getRevisionProperties(), !getSVNEnvironment().isNoIgnore(),
                getSVNEnvironment().isForce(), depth);
        getSVNEnvironment().printCommitInfo(info);
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.wc.SVNPath

            SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_INSUFFICIENT_ARGS), SVNLogType.CLIENT);
        }
        if (targets.size() > 2) {
            SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR), SVNLogType.CLIENT);
        }
        SVNPath switchURL = new SVNPath((String) targets.get(0), true);
        if (!switchURL.isURL()) {
            SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.BAD_URL,
                    "''{0}'' doesn not appear to be a URL", switchURL.getTarget()), SVNLogType.CLIENT);
        }
        SVNPath target;
        if (targets.size() == 1) {
            target = new SVNPath("");
        } else {
            target = new SVNPath((String) targets.get(1));
        }
        if (!getSVNEnvironment().isVersioned(target.getTarget())) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.ENTRY_NOT_FOUND,
                    "''{0}'' does not appear to be a working copy path", target.getTarget());
            SVNErrorManager.error(err, SVNLogType.CLIENT);
        }
        SVNUpdateClient client = getSVNEnvironment().getClientManager().getUpdateClient();
        if (!getSVNEnvironment().isQuiet()) {
            client.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment(), false, false, false));
        }
       
        SVNDepth depth = getSVNEnvironment().getDepth();
        boolean depthIsSticky = false;
        if (getSVNEnvironment().getSetDepth() != SVNDepth.UNKNOWN) {
            depth = getSVNEnvironment().getSetDepth();
            depthIsSticky = true;
        }
       
        client.doSwitch(target.getFile(), switchURL.getURL(), switchURL.getPegRevision(),
                getSVNEnvironment().getStartRevision(), depth,
                getSVNEnvironment().isForce(), depthIsSticky);   
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.wc.SVNPath

   
    protected void relocate(List targets) throws SVNException {
        if (targets.size() < 2) {
            SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_INSUFFICIENT_ARGS), SVNLogType.CLIENT);
        }
        SVNPath from = new SVNPath((String) targets.get(0));
        SVNPath to = new SVNPath((String) targets.get(1));
        if (from.isURL() != to.isURL() || !from.isURL()) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.INCORRECT_PARAMS,
                    "''{0}'' to ''{1}'' is not a valid relocation", new Object[] {from.getTarget(), to.getTarget()});
            SVNErrorManager.error(err, SVNLogType.CLIENT);
        }
        SVNUpdateClient client = getSVNEnvironment().getClientManager().getUpdateClient();
        if (targets.size() == 2) {
            SVNPath target = new SVNPath("");
            client.doRelocate(target.getFile(), from.getURL(), to.getURL(), getSVNEnvironment().getDepth().isRecursive());
        } else {
            for(int i = 2; i < targets.size(); i++) {
                SVNPath target = new SVNPath((String) targets.get(i));
                client.doRelocate(target.getFile(), from.getURL(), to.getURL(), getSVNEnvironment().getDepth().isRecursive());
            }
        }
    }
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.wc.SVNPath

            depth = SVNDepth.EMPTY;
        }
        SVNWCClient client = getSVNEnvironment().getClientManager().getWCClient();
        for(int i = 0; i < targets.size(); i++) {
            String targetName = (String) targets.get(i);
            SVNPath target = new SVNPath(targetName, true);
            SVNRevision pegRevision = target.getPegRevision();
            if (target.isURL() && pegRevision == SVNRevision.UNDEFINED) {
                pegRevision = SVNRevision.HEAD;
            }
            try {
                if (target.isFile()) {
                    client.doInfo(target.getFile(), pegRevision, getSVNEnvironment().getStartRevision(), depth,
                            getSVNEnvironment().getChangelistsCollection(), this);
                } else {
                    client.doInfo(target.getURL(), pegRevision, getSVNEnvironment().getStartRevision(), depth, this);
                }
            } catch (SVNException e) {
                SVNErrorMessage err = e.getErrorMessage();
                if (err.getErrorCode() == SVNErrorCode.UNVERSIONED_RESOURCE) {
                    getSVNEnvironment().getErr().print(SVNCommandUtil.getLocalPath(target.getTarget()) + ": (Not a versioned resource)\n\n");
                } else if (err.getErrorCode() == SVNErrorCode.RA_ILLEGAL_URL) {
                    getSVNEnvironment().getErr().print(target.getTarget() + ": (Not a valid URL)\n\n");
                } else {
                    throw e;
                }
            }
        }
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.wc.SVNPath

        if (getSVNEnvironment().getStartRevision() != SVNRevision.UNDEFINED &&
                getSVNEnvironment().getStartRevision() != SVNRevision.HEAD) {
            SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE,
                    "Cannot specify revision (except HEAD) with move operation"), SVNLogType.CLIENT);
        }
        SVNPath dst = new SVNPath((String) targets.remove(targets.size() - 1));
        if (!dst.isURL()) {
            if (getSVNEnvironment().getMessage() != null || getSVNEnvironment().getFileData() != null || getSVNEnvironment().getRevisionProperties() != null) {
                SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_UNNECESSARY_LOG_MESSAGE,
                "Local, non-commit operations do not take a log message or revision properties"), SVNLogType.CLIENT);
            }
        }

        SVNCopyClient client = getSVNEnvironment().getClientManager().getCopyClient();
        if (!getSVNEnvironment().isQuiet()) {
            client.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment()));
        }
        client.setCommitHandler(getSVNEnvironment());
        Collection sources = new ArrayList();
        for (Iterator ts = targets.iterator(); ts.hasNext();) {
            String targetName = (String) ts.next();
            SVNPath source = new SVNPath(targetName);
            if (source.isURL()) {
                sources.add(new SVNCopySource(SVNRevision.HEAD, SVNRevision.UNDEFINED, source.getURL()));
            } else {
                sources.add(new SVNCopySource(getSVNEnvironment().getStartRevision(), SVNRevision.UNDEFINED, source.getFile()));
            }
        }
        SVNCopySource[] copySources = (SVNCopySource[]) sources.toArray(new SVNCopySource[sources.size()]);
        try {
            if (dst.isURL()) {
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.wc.SVNPath

        if (targets.size() != 1) {
            SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR,
                "Exactly one file argument required"), SVNLogType.CLIENT);
        }
       
        SVNPath target = new SVNPath((String) targets.get(0));
        if (!target.isFile()) {
            SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR,
                "Exactly one file argument required"), SVNLogType.CLIENT);
        }
        SVNPropertyValue propertyValue = SVNPropertyValue.create(SVNRevisionProperty.LOG, getEnvironment().readFromFile(target.getFile()));
        SVNURL url = SVNURL.fromFile(repos);
        FSRepository repository = (FSRepository) SVNRepositoryFactory.create(url);
        long rev = getRevisionNumber(getSVNAdminEnvironment().getStartRevision(), repository.getLatestRevision(), repository);

        repository.setRevisionPropertyValue(rev, SVNRevisionProperty.LOG, propertyValue, getSVNAdminEnvironment().isBypassHooks());
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.wc.SVNPath

                SVNErrorManager.error(err, SVNLogType.CLIENT);
            }
            SVNWCClient client = getSVNEnvironment().getClientManager().getWCClient();
            for (Iterator ts = targets.iterator(); ts.hasNext();) {
                String targetName = (String) ts.next();
                SVNPath target = new SVNPath(targetName);
                if (target.isFile()) {
                    if (getSVNEnvironment().getMessage() != null || getSVNEnvironment().getFileData() != null || getSVNEnvironment().getRevisionProperties() != null) {
                        SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_UNNECESSARY_LOG_MESSAGE,
                                "Local, non-commit operations do not take a log message or revision properties");
                        SVNErrorManager.error(err, SVNLogType.CLIENT);
                    }
                    SVNPropertyData property = client.doGetProperty(target.getFile(), propertyName,
                            SVNRevision.UNDEFINED, SVNRevision.WORKING);
                    SVNPropertyValue propertyValue = property != null ? property.getValue() : SVNPropertyValue.create("");
                    byte[] propBytes = SVNPropertyValue.getPropertyAsBytes(propertyValue);                  
                    byte[] bytes = SVNCommandUtil.runEditor(getSVNEnvironment(), getSVNEnvironment().getEditorCommand(), propBytes, "svn-prop");
                    SVNPropertyValue newPropertyValue = SVNPropertyValue.create(propertyName, bytes);
                    if (newPropertyValue != null && !newPropertyValue.equals(propertyValue)) {
                        checkBooleanProperty(propertyName, newPropertyValue);
                        client.doSetProperty(target.getFile(), propertyName, newPropertyValue,
                                getSVNEnvironment().isForce(), SVNDepth.EMPTY, this, null);
                        String message = "Set new value for property ''{0}'' on ''{1}''";
                        String path = SVNCommandUtil.getLocalPath(targetName);
                        message = MessageFormat.format(message, new Object[]{propertyName, path});
                        getSVNEnvironment().getOut().println(message);
                    } else {
                        String message = "No changes to property ''{0}'' on ''{1}''";
                        String path = SVNCommandUtil.getLocalPath(targetName);
                        message = MessageFormat.format(message, new Object[]{propertyName, path});
                        getSVNEnvironment().getOut().println(message);
                    }
                } else {
                    SVNPropertyData property = client.doGetProperty(target.getURL(), propertyName,
                            SVNRevision.UNDEFINED, SVNRevision.HEAD);
                    SVNPropertyValue propertyValue = property != null ? property.getValue() : SVNPropertyValue.create("");
                    byte[] propBytes = SVNPropertyValue.getPropertyAsBytes(propertyValue);                                      
                    byte[] bytes = SVNCommandUtil.runEditor(getSVNEnvironment(), getSVNEnvironment().getEditorCommand(), propBytes, "svn-prop");
                    SVNPropertyValue newPropertyValue = SVNPropertyValue.create(propertyName, bytes);
                    if (newPropertyValue != null && !newPropertyValue.equals(propertyValue)) {
                        checkBooleanProperty(propertyName, newPropertyValue);
                        client.setCommitHandler(getSVNEnvironment());
                        SVNCommitInfo info = client.doSetProperty(target.getURL(), propertyName,
                                newPropertyValue, SVNRevision.HEAD, getSVNEnvironment().getMessage(),
                                getSVNEnvironment().getRevisionProperties(), getSVNEnvironment().isForce(),
                                this);
                        String message = "Set new value for property ''{0}'' on ''{1}''";
                        message = MessageFormat.format(message, new Object[]{propertyName, targetName});
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.wc.SVNPath

        if (targets.size() != 2) {
            SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR,
                "Exactly one property name and one file argument required"), SVNLogType.CLIENT);
        }
        String propertyName = (String) targets.get(0);
        SVNPath target = new SVNPath((String) targets.get(1));
        if (!target.isFile()) {
            SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR,
                "Exactly one property name and one file argument required"), SVNLogType.CLIENT);
        }
        SVNPropertyValue propertyValue = SVNPropertyValue.create(propertyName, getEnvironment().readFromFile(target.getFile()));
        SVNURL url = SVNURL.fromFile(repos);
        FSRepository repository = (FSRepository) SVNRepositoryFactory.create(url);
        long rev = getRevisionNumber(getSVNAdminEnvironment().getStartRevision(), repository.getLatestRevision(), repository);

        repository.setRevisionPropertyValue(rev, propertyName, propertyValue,
View Full Code Here

Examples of org.tmatesoft.svn.core.internal.wc.SVNPath

        if (depth == SVNDepth.UNKNOWN) {
            depth = SVNDepth.EMPTY;
        }
        for (Iterator ts = targets.iterator(); ts.hasNext();) {
            String targetName = (String) ts.next();
            SVNPath target = new SVNPath(targetName);
            if (target.isFile()) {
                try {
                    client.doResolve(target.getFile(), depth, choice);
                } catch (SVNException e) {
                    SVNErrorMessage err = e.getErrorMessage();
                    getSVNEnvironment().handleWarning(err, new SVNErrorCode[] {err.getErrorCode()}, getSVNEnvironment().isQuiet());
                }
            }
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.