Package org.tmatesoft.svn.core.internal.wc

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


        client.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment()));
        Collection paths = new ArrayList();
        Collection urls = new ArrayList();
        for (Iterator ts = targets.iterator(); ts.hasNext();) {
            String targetName = (String) ts.next();
            SVNPath target = new SVNPath(targetName);
            if (target.isURL()) {
                urls.add(target.getURL());
            } else {
                paths.add(target.getFile());
            }
        }
        if (!paths.isEmpty()) {
            File[] filesArray = (File[]) paths.toArray(new File[paths.size()]);
            client.doUnlock(filesArray, getSVNEnvironment().isForce());
View Full Code Here


        if (targets.size() > 2) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR);
            SVNErrorManager.error(err, SVNLogType.CLIENT);
        }
       
        SVNPath toURL = new SVNPath((String) targets.get(0));
        if (!toURL.isURL()) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR,
                    "Path ''{0}'' is not a URL", toURL.getTarget());
            SVNErrorManager.error(err, SVNLogType.CLIENT);
        }
       
        SVNPath fromURL = new SVNPath((String) targets.get(1));
        if (!fromURL.isURL()) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR,
                    "Path ''{0}'' is not a URL", fromURL.getTarget());
            SVNErrorManager.error(err, SVNLogType.CLIENT);
        }
       
        SVNAdminClient client = getEnvironment().getClientManager().getAdminClient();
        client.setEventHandler(this);
        client.doInitialize(fromURL.getURL(), toURL.getURL());
    }
View Full Code Here

        }
        if (targets.size() > 1) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR);
            SVNErrorManager.error(err, SVNLogType.CLIENT);
        }
        SVNPath toURL = new SVNPath((String) targets.get(0));
        if (!toURL.isURL()) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR,
                    "Path ''{0}'' is not a URL", toURL.getTarget());
            SVNErrorManager.error(err, SVNLogType.CLIENT);
        }

        SVNAdminClient client = getEnvironment().getClientManager().getAdminClient();
        SVNSyncInfo info = client.doInfo(toURL.getURL());
        getSVNSyncEnvironment().getOut().println("Source URL: " + info.getSrcURL());
        if (info.getSourceRepositoryUUID() != null) {
            getSVNSyncEnvironment().getOut().println("Source Repository UUID: " + info.getSourceRepositoryUUID());
        }
       
View Full Code Here

           
            Collection changeLists = getSVNEnvironment().getChangelistsCollection();
            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()) {
                    boolean success = true;
                    try {
                        if (target.isFile()) {
                            client.doSetProperty(target.getFile(), propertyName, propertyValue,
                                    getSVNEnvironment().isForce(), depth, this, changeLists);
                        } else {
                            client.setCommitHandler(getSVNEnvironment());
                            client.doSetProperty(target.getURL(), propertyName, propertyValue, SVNRevision.HEAD, getSVNEnvironment().getMessage(),
                                    getSVNEnvironment().getRevisionProperties(), getSVNEnvironment().isForce(), this);
                        }
                    } catch (SVNException e) {
                        success = getSVNEnvironment().handleWarning(e.getErrorMessage(),
                                new SVNErrorCode[]{SVNErrorCode.UNVERSIONED_RESOURCE, SVNErrorCode.ENTRY_NOT_FOUND},
View Full Code Here

        if (targets.size() != 1) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_INSUFFICIENT_ARGS);
            SVNErrorManager.error(err, SVNLogType.CLIENT);
        }
       
        SVNPath toURL = new SVNPath((String) targets.get(0));
        if (!toURL.isURL()) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR,
                    "Path ''{0}'' is not a URL", toURL.getTarget());
            SVNErrorManager.error(err, SVNLogType.CLIENT);
        }
       
        SVNAdminClient client = getEnvironment().getClientManager().getAdminClient();
        client.setEventHandler(this);
        client.doCopyRevisionProperties(toURL.getURL(), startRevisionNumber, endRevisionNumber);
    }
View Full Code Here

                    getSVNEnvironment().checkCancelled();
                }
            });
            for (Iterator ts = targets.iterator(); ts.hasNext();) {
                String targetName = (String) ts.next();
                SVNPath target = new SVNPath(targetName);
                if (target.isFile()) {
                    boolean success = true;
                    try {
                        if (target.isFile()){
                            client.doSetProperty(target.getFile(), propertyName, null,
                                    getSVNEnvironment().isForce(), depth, this, changeLists);                               
                        } else {
                            client.setCommitHandler(getSVNEnvironment());
                            client.doSetProperty(target.getURL(), propertyName, null, SVNRevision.HEAD, getSVNEnvironment().getMessage(),
                                    getSVNEnvironment().getRevisionProperties(), getSVNEnvironment().isForce(), this);
                        }
                        if (deletedNonExistent[0]) {
                            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CLIENT_PROPERTY_NAME, "Attempting to delete nonexistent property ''{0}''", propertyName);
                            SVNErrorManager.error(err, SVNLogType.CLIENT);
View Full Code Here

        if (getSVNEnvironment().getTargets() != null) {
            targets.addAll(getSVNEnvironment().getTargets());
        }
        targets = getSVNEnvironment().combineTargets(targets, true);
       
        SVNPath oldTarget = null;
        SVNPath newTarget = null;
        SVNRevision start = getSVNEnvironment().getStartRevision();
        SVNRevision end = getSVNEnvironment().getEndRevision();
        boolean peggedDiff = false;
       
        if (targets.size() == 2 &&
                getSVNEnvironment().getOldTarget() == null &&
                getSVNEnvironment().getNewTarget() == null &&
                SVNCommandUtil.isURL((String) targets.get(0)) &&
                SVNCommandUtil.isURL((String) targets.get(1)) &&
                getSVNEnvironment().getStartRevision() == SVNRevision.UNDEFINED &&
                getSVNEnvironment().getEndRevision() == SVNRevision.UNDEFINED) {
            oldTarget = new SVNPath((String) targets.get(0), true);
            newTarget = new SVNPath((String) targets.get(1), true);
            start = oldTarget.getPegRevision();
            end = newTarget.getPegRevision();
            targets.clear();
            if (start == SVNRevision.UNDEFINED) {
                start = SVNRevision.HEAD;
            }
            if (end == SVNRevision.UNDEFINED) {
                end = SVNRevision.HEAD;
            }
        } else if (getSVNEnvironment().getOldTarget() != null) {
            targets.clear();
            targets.add(getSVNEnvironment().getOldTarget());
            targets.add(getSVNEnvironment().getNewTarget() != null ? getSVNEnvironment().getNewTarget() : getSVNEnvironment().getOldTarget());
           
            oldTarget = new SVNPath((String) targets.get(0), true);
            newTarget = new SVNPath((String) targets.get(1), true);
            start = getSVNEnvironment().getStartRevision();
            end = getSVNEnvironment().getEndRevision();
            if (oldTarget.getPegRevision() != SVNRevision.UNDEFINED) {
                start = oldTarget.getPegRevision();
            }
            if (newTarget.getPegRevision() != SVNRevision.UNDEFINED) {
                end = newTarget.getPegRevision();
            }
            if (start == SVNRevision.UNDEFINED) {
                start = oldTarget.isURL() ? SVNRevision.HEAD : SVNRevision.BASE;
            }
            if (end == SVNRevision.UNDEFINED) {
                end = newTarget.isURL() ? SVNRevision.HEAD : SVNRevision.WORKING;
            }
            targets = getSVNEnvironment().combineTargets(null, true);
        } else if (getSVNEnvironment().getNewTarget() != null) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR,
                    "'--new' option only valid with '--old' option");
            SVNErrorManager.error(err, SVNLogType.CLIENT);
        } else {
            if (targets.isEmpty()) {
                targets.add("");
            }
            oldTarget = new SVNPath("");
            newTarget = new SVNPath("");
            boolean hasURLs = false;
            boolean hasWCs = false;
           
            for(int i = 0; i < targets.size(); i++) {
                SVNPath target = new SVNPath((String) targets.get(i));
                hasURLs |= target.isURL();
                hasWCs |= target.isFile();
            }
           
            if (hasURLs && hasWCs) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.UNSUPPORTED_FEATURE, "Target lists to diff may not contain both working copy paths and URLs");
                SVNErrorManager.error(err, SVNLogType.CLIENT);
            }
            start = getSVNEnvironment().getStartRevision();
            end = getSVNEnvironment().getEndRevision();
            if (start == SVNRevision.UNDEFINED && hasWCs) {
                start = SVNRevision.BASE;
            }
            if (end == SVNRevision.UNDEFINED) {
                end = hasWCs ? SVNRevision.WORKING : SVNRevision.HEAD;
            }
            peggedDiff = (start != SVNRevision.BASE && start != SVNRevision.WORKING) || (end != SVNRevision.BASE && end != SVNRevision.WORKING);
        }
        if (targets.isEmpty()) {
            targets.add("");
        }

        SVNDiffClient client = getSVNEnvironment().getClientManager().getDiffClient();
        DefaultSVNDiffGenerator diffGenerator = new DefaultSVNDiffGenerator();
        if (getSVNEnvironment().getDiffCommand() != null) {
            diffGenerator.setExternalDiffCommand(getSVNEnvironment().getDiffCommand());
            diffGenerator.setRawDiffOptions(getSVNEnvironment().getExtensions());
        } else {
            diffGenerator.setDiffOptions(getSVNEnvironment().getDiffOptions());
        }
       
        diffGenerator.setDiffDeleted(!getSVNEnvironment().isNoDiffDeleted());
        diffGenerator.setForcedBinaryDiff(getSVNEnvironment().isForce());
        diffGenerator.setBasePath(new File("").getAbsoluteFile());
        diffGenerator.setFallbackToAbsolutePath(true);
        diffGenerator.setOptions(client.getOptions());
        client.setDiffGenerator(diffGenerator);
       
        PrintStream ps = getSVNEnvironment().getOut();
        Collection changeLists = getSVNEnvironment().getChangelistsCollection();
        for(int i = 0; i < targets.size(); i++) {
            String targetName = (String) targets.get(i);
            if (!peggedDiff) {
                SVNPath target1 = new SVNPath(SVNPathUtil.append(oldTarget.getTarget(), targetName));
                SVNPath target2 = new SVNPath(SVNPathUtil.append(newTarget.getTarget(), targetName));
                if (getSVNEnvironment().isSummarize()) {
                    if (target1.isURL() && target2.isURL()) {
                        client.doDiffStatus(target1.getURL(), start, target2.getURL(), end, getSVNEnvironment().getDepth(), getSVNEnvironment().isNoticeAncestry(), this);
                    } else if (target1.isURL()) {
                        client.doDiffStatus(target1.getURL(), start, target2.getFile(), end, getSVNEnvironment().getDepth(), getSVNEnvironment().isNoticeAncestry(), this);
                    } else if (target2.isURL()) {
                        client.doDiffStatus(target1.getFile(), start, target2.getURL(), end, getSVNEnvironment().getDepth(), getSVNEnvironment().isNoticeAncestry(), this);
                    } else {
                        client.doDiffStatus(target1.getFile(), start, target2.getFile(), end, getSVNEnvironment().getDepth(), getSVNEnvironment().isNoticeAncestry(), this);
                    }
                } else {
                    if (target1.isURL() && target2.isURL()) {
                        client.doDiff(target1.getURL(), start, target2.getURL(), end,
                                getSVNEnvironment().getDepth(), getSVNEnvironment().isNoticeAncestry(), ps);
                    } else if (target1.isURL()) {
                        client.doDiff(target1.getURL(), start, target2.getFile(), end,
                                getSVNEnvironment().getDepth(), getSVNEnvironment().isNoticeAncestry(), ps,
                                changeLists);
                    } else if (target2.isURL()) {
                        client.doDiff(target1.getFile(), start, target2.getURL(), end,
                                getSVNEnvironment().getDepth(), getSVNEnvironment().isNoticeAncestry(), ps,
                                changeLists);
                    } else {
                        client.doDiff(target1.getFile(), start, target2.getFile(), end,
                                getSVNEnvironment().getDepth(), getSVNEnvironment().isNoticeAncestry(), ps,
                                changeLists);
                    }
                }
            } else {
                SVNPath target = new SVNPath(targetName, true);
                SVNRevision pegRevision = target.getPegRevision();
                if (pegRevision == SVNRevision.UNDEFINED) {
                    pegRevision = target.isURL() ? SVNRevision.HEAD : SVNRevision.WORKING;
                }
                if (getSVNEnvironment().isSummarize()) {
                    if (target.isURL()) {
                        client.doDiffStatus(target.getURL(), start, end, pegRevision, getSVNEnvironment().getDepth(), getSVNEnvironment().isNoticeAncestry(), this);
                    } else {
                        client.doDiffStatus(target.getFile(), start, end, pegRevision, getSVNEnvironment().getDepth(), getSVNEnvironment().isNoticeAncestry(), this);
                    }
                } else {
                    if (target.isURL()) {
                        client.doDiff(target.getURL(), pegRevision, start, end, getSVNEnvironment().getDepth(),
                                getSVNEnvironment().isNoticeAncestry(), ps);
                    } else {
                        client.doDiff(target.getFile(), pegRevision, start, end, getSVNEnvironment().getDepth(),
                                getSVNEnvironment().isNoticeAncestry(), ps, changeLists);
                    }
                }
            }
        }
View Full Code Here

            boolean likeProplist = getSVNEnvironment().isVerbose() && !getSVNEnvironment().isStrict();
            Collection changeLists = getSVNEnvironment().getChangelistsCollection();
            SVNWCClient client = getSVNEnvironment().getClientManager().getWCClient();
            for (Iterator ts = targets.iterator(); ts.hasNext();) {
                String targetPath = (String) ts.next();
                SVNPath target = new SVNPath(targetPath, true);
                SVNRevision pegRevision = target.getPegRevision();
                boolean printFileNames = false;
                if (target.isURL()) {
                    client.doGetProperty(target.getURL(), propertyName, pegRevision,
                            getSVNEnvironment().getStartRevision(), depth, this);
                    printFileNames = !getSVNEnvironment().isStrict() && (getSVNEnvironment().isVerbose() ||
                            depth.compareTo(SVNDepth.EMPTY) > 0 || targets.size() > 1 || getURLProperties().size() > 1);
                } else {
                    client.doGetProperty(target.getFile(), propertyName, pegRevision,
                            getSVNEnvironment().getStartRevision(), depth, this, changeLists);
                    printFileNames = !getSVNEnvironment().isStrict() && (getSVNEnvironment().isVerbose() ||
                            depth.compareTo(SVNDepth.EMPTY) > 0 || targets.size() > 1 || getPathProperties().size() > 1);
                }
                if (!getSVNEnvironment().isXML()) {
                    printCollectedProperties(printFileNames, target.isURL(), likeProplist);
                } else {
                    printCollectedPropertiesXML(target.isURL());
                }
                clearCollectedProperties();
            }
            if (getSVNEnvironment().isXML()) {
                printXMLFooter("properties");
View Full Code Here

        }
        if (targets.isEmpty() || index > targets.size() - 1 ) {
            SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR,
                    "Repository argument required"), SVNLogType.CLIENT);
        }
        SVNPath target = new SVNPath((String) targets.get(index));
        if (target.isURL()) {
            SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR,
                    "'" + target.getTarget() + "' is an URL when it should be a path"), SVNLogType.CLIENT);
        }
        return target.getFile();
    }
View Full Code Here

        }
       
        List fileTargets = new LinkedList();
        for (Iterator targetsIter = targets.iterator(); targetsIter.hasNext();) {
            String targetName = (String) targetsIter.next();
            SVNPath target = new SVNPath(targetName);
            fileTargets.add(target.getFile());
        }
       
        if (getSVNEnvironment().getChangelists() != null) {
            Collection changeLists = getSVNEnvironment().getChangelistsCollection();
            SVNDepth clDepth = getSVNEnvironment().getDepth();
            if (clDepth == SVNDepth.UNKNOWN) {
                clDepth = SVNDepth.INFINITY;
            }
            SVNChangelistClient changelistClient = getSVNEnvironment().getClientManager().getChangelistClient();
            final List targetPaths = new LinkedList();
            ISVNChangelistHandler handler = new ISVNChangelistHandler() {
                public void handle(File path, String changelistName) {
                    targetPaths.add(path.getAbsolutePath());
                }
            };
            changelistClient.doGetChangeListPaths(changeLists, fileTargets, clDepth, handler);
            targets = targetPaths;
        }
       
        SVNUpdateClient client = getSVNEnvironment().getClientManager().getUpdateClient();
        if (!getSVNEnvironment().isQuiet()) {
            client.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment()));
        }
       
        SVNDepth depth = getSVNEnvironment().getDepth();
        boolean depthIsSticky = false;
        if (getSVNEnvironment().getSetDepth() != SVNDepth.UNKNOWN) {
            depth = getSVNEnvironment().getSetDepth();
            depthIsSticky = true;
        }
       
        List files = new ArrayList(targets.size());
        for (Iterator ts = targets.iterator(); ts.hasNext();) {
            String targetName = (String) ts.next();
            SVNPath target = new SVNPath(targetName);
            if (!target.isFile()) {
                // skip it.
                getSVNEnvironment().getOut().println("Skipped '" + targetName + "'");
                continue;
            }
            files.add(target.getFile());
        }
        File[] filesArray = (File[]) files.toArray(new File[files.size()]);
        client.doUpdate(filesArray, getSVNEnvironment().getStartRevision(), depth,
                getSVNEnvironment().isForce(), depthIsSticky);
    }
View Full Code Here

TOP

Related Classes of org.tmatesoft.svn.core.internal.wc.SVNPath

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.