Examples of SVNPath


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

        return true;
    }

    public void run() throws SVNException {
        List targets = getSVNEnvironment().combineTargets(new ArrayList(), true);
        SVNPath source1 = null;
        SVNPath source2 = null;
        SVNPath target = null;
        SVNRevision pegRevision1 = null;
        SVNRevision pegRevision2 = null;
       
        if (targets.size() >= 1) {
            source1 = new SVNPath((String) targets.get(0), true);
            pegRevision1 = source1.getPegRevision();
            if (targets.size() >= 2) {
                source2 = new SVNPath((String) targets.get(1), true);
                pegRevision2 = source2.getPegRevision();
            }
        }
       
        boolean twoSourcesSpecified = true;
        if (targets.size() <= 1) {
            twoSourcesSpecified = false;
        } else if (targets.size() == 2) {
            if (source1.isURL() && !source2.isURL()) {
                twoSourcesSpecified = false;
            }
        }
       
        List rangesToMerge = getSVNEnvironment().getRevisionRanges();
        SVNRevision firstRangeStart = SVNRevision.UNDEFINED;
        SVNRevision firstRangeEnd = SVNRevision.UNDEFINED;
        if (!rangesToMerge.isEmpty()) {
          SVNRevisionRange range = (SVNRevisionRange) rangesToMerge.get(0);
          firstRangeStart = range.getStartRevision();
          firstRangeEnd = range.getEndRevision();
        }
        if (firstRangeStart != SVNRevision.UNDEFINED) {
          if (firstRangeEnd == SVNRevision.UNDEFINED) {
            SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_INSUFFICIENT_ARGS,
                "Second revision required");
            SVNErrorManager.error(err, SVNLogType.CLIENT);
          }
          twoSourcesSpecified = false;
        }
       
        if (!twoSourcesSpecified) {
            if (targets.size() > 2) {
                SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR,
                    "Too many arguments given"), SVNLogType.CLIENT);
            }
            if (targets.isEmpty()) {
                pegRevision1 = SVNRevision.HEAD;
            } else {
                source2 = source1;
                if (pegRevision1 == null || pegRevision1 == SVNRevision.UNDEFINED) {
                    pegRevision1 = source1.isURL() ? SVNRevision.HEAD : SVNRevision.WORKING;
                }
                if (targets.size() == 2) {
                    target = new SVNPath((String) targets.get(1));
                    if (target.isURL()) {
                      SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR,
                          "Cannot specifify a revision range with two URLs");
                      SVNErrorManager.error(err, SVNLogType.CLIENT);
                    }
                }
            }
        } else {
            if (targets.size() < 2) {
                SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_INSUFFICIENT_ARGS), SVNLogType.CLIENT);
            } else if (targets.size() > 3) {
                SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CL_ARG_PARSING_ERROR,
                    "Too many arguments given"), SVNLogType.CLIENT);
            }
           
            firstRangeStart = pegRevision1;
            firstRangeEnd = pegRevision2;
           
            if (((firstRangeStart == null || firstRangeStart == SVNRevision.UNDEFINED) && !source1.isURL()) ||
                    ((pegRevision2 == null || pegRevision2 == SVNRevision.UNDEFINED) && !source2.isURL())) {
                SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.CLIENT_BAD_REVISION,
                    "A working copy merge source needs an explicit revision"), SVNLogType.CLIENT);
            }
            if (firstRangeStart == null || firstRangeStart == SVNRevision.UNDEFINED) {
                firstRangeStart = SVNRevision.HEAD;
            }
            if (firstRangeEnd == null || firstRangeEnd == SVNRevision.UNDEFINED) {
                firstRangeEnd = SVNRevision.HEAD;
            }
            if (targets.size() >= 3) {
                target = new SVNPath((String) targets.get(2));
            }
        }
       
        if (source1 != null && source2 != null && target == null) {
            if (source1.isURL()) {
                String name1 = SVNPathUtil.tail(source1.getTarget());
                String name2 = SVNPathUtil.tail(source2.getTarget());
                if (name1.equals(name2)) {
                    String decodedPath = SVNEncodingUtil.uriDecode(name1);
                    SVNPath decodedPathTarget = new SVNPath(decodedPath);
                    if (SVNFileType.getType(decodedPathTarget.getFile()) == SVNFileType.FILE) {
                        target = decodedPathTarget;
                    }
                }
            } else if (source1.equals(source2)) {
                String decodedPath = SVNEncodingUtil.uriDecode(source1.getTarget());
                SVNPath decodedPathTarget = new SVNPath(decodedPath);
                if (SVNFileType.getType(decodedPathTarget.getFile()) == SVNFileType.FILE) {
                    target = decodedPathTarget;
                }
            }
        }
        if (target == null) {
            target = new SVNPath("");
        }
        SVNDiffClient client = getSVNEnvironment().getClientManager().getDiffClient();
        if (!getSVNEnvironment().isQuiet()) {
            client.setEventHandler(new SVNNotifyPrinter(getSVNEnvironment()));
        }
View Full Code Here

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

    public void run() throws SVNException {
        List targets = getSVNEnvironment().combineTargets(getSVNEnvironment().getTargets(), true);
        for (Iterator ts = targets.iterator(); ts.hasNext();) {
            String targetName = (String) ts.next();
            SVNPath target = new SVNPath(targetName);
            if (target.isURL()) {
                SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.WC_BAD_PATH, "Must give local path (not URL) as the target of commit");
                SVNErrorManager.error(err, SVNLogType.CLIENT);
            }
        }
        if (targets.isEmpty()) {
            targets.add(".");
        }
        SVNDepth depth = getSVNEnvironment().getDepth();
        if (depth == SVNDepth.UNKNOWN) {
            depth = SVNDepth.INFINITY;
        }
        SVNCommitClient client = getSVNEnvironment().getClientManager().getCommitClient();
        Collection filesList = new ArrayList();
        for (Iterator ts = targets.iterator(); ts.hasNext();) {
            String targetName = (String) ts.next();
            SVNPath target = new SVNPath(targetName);
            if (target.isFile()) {
                filesList.add(target.getFile());
            } else {
                getSVNEnvironment().getOut().println("Skipped '" + targetName + "'");
            }
        }
        if (filesList.isEmpty()) {
View Full Code Here

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

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

        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

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

        }
        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

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

           
            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

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

        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

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

                    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

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

        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

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

            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
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.