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

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


                    SVNAdminArea dir = parentAccess.open(parent, false, 0);
                    SVNVersionedProperties props = dir.getProperties(dir.getThisDirName());
                    SVNExternalInfo[] externals = SVNWCAccess.parseExternals("", props.getPropertyValue(SVNProperty.EXTERNALS));
                    // now externals could point to our dir.
                    for (int i = 0; i < externals.length; i++) {
                        SVNExternalInfo external = externals[i];
                        File externalFile = new File(parent, external.getPath());
                        if (externalFile.equals(versionedDir)) {
                            return parentRoot;
                        }
                    }
                } catch (SVNException e) {
View Full Code Here


                name = entry.getName();
            }
            doCanonicalizeURLs(adminAreaInfo, target, name, omitDefaultPort, recursive);
            if (recursive && !isIgnoreExternals()) {
                for(Iterator externals = adminAreaInfo.externals(); externals.hasNext();) {
                    SVNExternalInfo info = (SVNExternalInfo) externals.next();
                    try {
                        doCanonicalizeURLs(info.getFile(), omitDefaultPort, true);
                    } catch (SVNCancelException e) {
                        throw e;
                    } catch (SVNException e) {
                        getDebugLog().info(e);
                    }
View Full Code Here

        return null;
    }

    private void handleExternals(SVNAdminAreaInfo info) throws SVNException {
        for (Iterator externals = info.externals(); externals.hasNext();) {
            SVNExternalInfo external = (SVNExternalInfo) externals.next();
            if (external.getOldURL() == null && external.getNewURL() == null) {
                continue;
            }
            long revNumber = external.getNewRevision();
            SVNRevision revision = revNumber >= 0 ? SVNRevision.create(revNumber) : getExternalRevision(external.getFile(), external.getNewURL());
            setEventPathPrefix(external.getPath());
            try {
                if (external.getOldURL() == null) {
                    external.getFile().mkdirs();
                    dispatchEvent(SVNEventFactory.createUpdateExternalEvent(info, ""));
                    doCheckout(external.getNewURL(), external.getFile(), revision, revision, true);
                } else if (external.getNewURL() == null) {
                    SVNWCAccess wcAccess = createWCAccess();
                    SVNAdminArea area = wcAccess.open(external.getFile(), true, SVNWCAccess.INFINITE_DEPTH);
                    SVNException error = null;
                    try {
                        area.removeFromRevisionControl(area.getThisDirName(), true, false);
                    } catch (SVNException svne) {
                        error = svne;
                    }
                   
                    if (error == null || error.getErrorMessage().getErrorCode() == SVNErrorCode.WC_LEFT_LOCAL_MOD) {
                        try {
                            wcAccess.close();
                        } catch (SVNException svne) {
                            error = error == null ? svne : error;
                        }
                    }
                   
                    if (error != null && error.getErrorMessage().getErrorCode() != SVNErrorCode.WC_LEFT_LOCAL_MOD) {
                        throw error;
                    }
                } else {
                    dispatchEvent(SVNEventFactory.createUpdateExternalEvent(info, ""));
                    if (!external.getFile().isDirectory()) {
                        boolean created = external.getFile().mkdirs();
                        try {
                            doCheckout(external.getNewURL(), external.getFile(), revision, revision, true);
                        } catch (SVNException e) {
                            if (created && e.getErrorMessage().getErrorCode() == SVNErrorCode.RA_ILLEGAL_URL) {
                                SVNFileUtil.deleteAll(external.getFile(), true);
                            }
                            throw e;
                        }
                    } else {
                        File[] children = external.getFile().listFiles();
                        if (children != null && children.length == 0) {
                            // unversioned empty directory.
                            try {
                                doCheckout(external.getNewURL(), external.getFile(), revision, revision, true);
                            } catch (SVNException e) {
                                throw e;
                            }
                            continue;
                        }
                        SVNWCAccess wcAccess = createWCAccess();
                        SVNAdminArea area = wcAccess.open(external.getFile(), true, 0);
                        SVNEntry entry = area.getEntry(area.getThisDirName(), false);
                        wcAccess.close();
                        String url = entry.getURL();
                       
                        if (entry != null && entry.getURL() != null) {
                            if (external.getNewURL().toString().equals(url)) {
                                doUpdate(external.getFile(), revision, true);
                                continue;
                            } else if (entry.getRepositoryRoot() != null) {
                                if (!SVNPathUtil.isAncestor(entry.getRepositoryRoot(), external.getNewURL().toString())) {
                                    SVNRepository repos = createRepository(external.getNewURL(), true);
                                    SVNURL reposRoot = repos.getRepositoryRoot(true);
                                    try {
                                        doRelocate(external.getFile(), entry.getSVNURL(), reposRoot, true);
                                    } catch (SVNException svne) {
                                        if (svne.getErrorMessage().getErrorCode() == SVNErrorCode.WC_INVALID_RELOCATION ||
                                                svne.getErrorMessage().getErrorCode() == SVNErrorCode.CLIENT_INVALID_RELOCATION) {
                                            deleteExternal(external);
                                            external.getFile().mkdirs();
                                            doCheckout(external.getNewURL(), external.getFile(), revision, revision, true);
                                            continue;
                                        }
                                        throw svne;
                                    }
                                }
                                doSwitch(external.getFile(), external.getNewURL(), revision, true);
                                continue;
                            }
                        }
                        deleteExternal(external);
                        external.getFile().mkdirs();
                        doCheckout(external.getNewURL(), external.getFile(), revision, revision, true);
                    }
                }
            } catch (SVNException th) {
                if (th instanceof SVNCancelException) {
                    throw th;
                }
                getDebugLog().info(th);
                File file = external.getFile();
                SVNEvent event = SVNEventFactory.createSkipEvent(file, file, SVNEventAction.SKIP, SVNEventAction.UPDATE_EXTERNAL, SVNNodeKind.DIR);
                event.setErrorMessage(th.getErrorMessage());
                dispatchEvent(event);
            } finally {
                setEventPathPrefix(null);
View Full Code Here

        Collection result = new ArrayList();
       
        String relPath = adminArea.getRelativePath(myAnchor);
        SVNExternalInfo[] parsed = parseExternals(relPath, externals);
        for (int i = 0; i < parsed.length; i++) {
            SVNExternalInfo info = addExternal(adminArea, parsed[i].getPath(), parsed[i].getOldURL(), parsed[i].getOldRevision());
            result.add(info);
        }
        // get existing externals and update all that are not in result but in
        // this dir.
        for (Iterator exts = externals(); exts.hasNext();) {
            SVNExternalInfo info = (SVNExternalInfo) exts.next();
            if (!result.contains(info) && relPath.equals(info.getOwnerPath())) {
                info.setNewExternal(null, -1);
            }
        }
        return (SVNExternalInfo[]) result.toArray(new SVNExternalInfo[result.size()]);
    }
View Full Code Here

                } catch (SVNException e) {
                    continue;
                }
               
                try {
                    SVNExternalInfo info = new SVNExternalInfo("", null, path, SVNURL.parseURIEncoded(url), rev);
                    result.add(info);
                } catch (SVNException e) {
                }
            }
        }
View Full Code Here

    private SVNExternalInfo addExternal(SVNAdminArea adminArea, String path, SVNURL url, long revision) {
        if (myExternals == null) {
            myExternals = new TreeMap();
        }

        SVNExternalInfo info = (SVNExternalInfo) myExternals.get(path);
        if (info == null) {
            info = new SVNExternalInfo(adminArea.getRelativePath(myAnchor), new File(getAnchor().getRoot(), path), path, null, -1);
            myExternals.put(path, info);
        }
        info.setNewExternal(url, revision);
        return info;
    }
View Full Code Here

                } catch (SVNException e) {
                    continue;
                }
               
                try {
                    SVNExternalInfo info = new SVNExternalInfo("", null, path, SVNURL.parseURIEncoded(url), rev);
                    result.add(info);
                } catch (SVNException e) {
                }
            }
        }
View Full Code Here

TOP

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

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.