public SVNURL getSVNURL() throws SVNException { return SVNURL.parseURIDecoded(url); }
public SVNURL getSVNURL() throws SVNException { return SVNURL.parseURIDecoded(url); }
/** * Returns the SVNURL object that was wrapped * @return If this object has not been serialized yet, the original * SVNURL used to construct this object will be returned, after * serialization a new SVNURL object will be constructed based on * the decoded string of the original SVNURL object * @throws SVNException */ public SVNURL getSVNURL() throws SVNException { if (url == null) { url = SVNURL.parseURIDecoded(decodedUrl); } return url; }
public SVNURL getSVNURL() throws SVNException { return SVNURL.parseURIDecoded(url); }
/** * Creates a <span class="javastring">"file:///"</span> <b>SVNURL</b> * representation given a filesystem style repository path. * * @param repositoryPath a repository path as a filesystem path * @return an <b>SVNURL</b> representation * @throws SVNException */ public static SVNURL fromFile(File repositoryPath) throws SVNException { if (repositoryPath == null) { return null; } String path = repositoryPath.getAbsoluteFile().getAbsolutePath(); path = path.replace(File.separatorChar, '/'); if (!path.startsWith("/")) { path = "/" + path; } return SVNURL.parseURIDecoded("file://" + path); }
/** * Creates a <span class="javastring">"file:///"</span> <b>SVNURL</b> * representation given a filesystem style repository path. * * @param repositoryPath a repository path as a filesystem path * @return an <b>SVNURL</b> representation * @throws SVNException */ public static SVNURL fromFile(File repositoryPath) throws SVNException { if (repositoryPath == null) { return null; } String path = repositoryPath.getAbsoluteFile().getAbsolutePath(); path = path.replace(File.separatorChar, '/'); if (!path.startsWith("/")) { path = "/" + path; } return SVNURL.parseURIDecoded("file://" + path); }
/** * Creates a <span class="javastring">"file:///"</span> <b>SVNURL</b> * representation given a filesystem style repository path. * * @param repositoryPath a repository path as a filesystem path * @return an <b>SVNURL</b> representation * @throws SVNException */ public static SVNURL fromFile(File repositoryPath) throws SVNException { if (repositoryPath == null) { return null; } String path = repositoryPath.getAbsoluteFile().getAbsolutePath(); path = path.replace(File.separatorChar, '/'); if (!path.startsWith("/")) { path = "/" + path; } return SVNURL.parseURIDecoded("file://" + path); }
public synchronized Object readResolve() throws ObjectStreamException, SVNException { try { return new SerializableSVNURL(SVNURL.parseURIDecoded(decodedUrl)); } catch (SVNException e) { StreamCorruptedException x = new StreamCorruptedException("Failed to load SVNURL"); x.initCause(e); throw x; } } }
/** * Gets the value of the {@value #REPOSITORY_URL_ATTRIB_NAME} attribute. * * @param configElement resource configuration element * * @return value of the attribute * * @throws BeanCreationException thrown if the attribute is missing or contains an invalid SVN URL */ protected SVNURL getRespositoryUrl(Element configElement) throws BeanCreationException { if (!configElement.hasAttributeNS(null, REPOSITORY_URL_ATTRIB_NAME)) { log.error("SVN resource definition missing required '" + REPOSITORY_URL_ATTRIB_NAME + "' attribute"); throw new BeanCreationException("SVN resource definition missing required '" + REPOSITORY_URL_ATTRIB_NAME + "' attribute"); } String repositoryUrl = DatatypeHelper.safeTrimOrNullString(configElement.getAttributeNS(null, REPOSITORY_URL_ATTRIB_NAME)); try { return SVNURL.parseURIDecoded(repositoryUrl); } catch (SVNException e) { log.error("SVN remote repository URL " + repositoryUrl + " is not valid", e); throw new BeanCreationException("SVN remote repository URL " + repositoryUrl + " is not valid", e); } }
private SubversionRepoUUIDAndRootPath remoteUUIDAndRootPathFromCacheOrFromSVN(Job job, SCM scm, ModuleLocation moduleLocation, String urlFromConfiguration) throws SVNException { SubversionRepoUUIDAndRootPath uuidAndRootPath = null; for (Map.Entry<String, UUID> e : remoteUUIDCache.entrySet()) { String remoteRepoRootURL = e.getKey(); String remoteRepoRootURLWithSlash = remoteRepoRootURL + "/"; if (urlFromConfiguration.startsWith(remoteRepoRootURLWithSlash) || urlFromConfiguration.equals(remoteRepoRootURL)) { UUID uuid = e.getValue(); String rootPath = SVNURL.parseURIDecoded(e.getKey()).getPath(); uuidAndRootPath = new SubversionRepoUUIDAndRootPath(uuid, rootPath); LOGGER.finer("Using cached uuid for module location " + urlFromConfiguration + " of job "+ job); break; } } if (uuidAndRootPath == null) { if (LOGGER.isLoggable(FINER)) { LOGGER.finer("Could not find " + urlFromConfiguration + " in " + remoteUUIDCache.keySet()); } UUID remoteUUID = moduleLocation.getUUID(job, scm); SVNURL repositoryRoot = moduleLocation.getRepositoryRoot(job, scm); remoteUUIDCache.put(repositoryRoot.toString(), remoteUUID); uuidAndRootPath = new SubversionRepoUUIDAndRootPath(remoteUUID, repositoryRoot.getPath()); } return uuidAndRootPath; }
@Before public void setUp() throws Exception { repo = SVNURL.parseURIDecoded("http://subversion.tigris.org/svn/subclipse"); // during the test, don't pollute the user's configuration (esp. authentication cache). System.setProperty(SubversionSCM.class.getName() + ".configDir", tmp.newFolder().getAbsolutePath()); }
public SVNConnector build(String login, String pass) { if (repository == null) { DAVRepositoryFactory.setup(); SVNURL url; try { url = SVNURL.parseURIDecoded(SVNURI + SVNTestRepo); repository = SVNRepositoryFactory.create(url, null); } catch (SVNException e1) { e1.printStackTrace(); } } ISVNAuthenticationManager authManager = new BasicAuthenticationManager(login, pass); repository.setAuthenticationManager(authManager); return instance; }
/** * Constructs a new <b>SVNURL</b> representation removing a tail path * segment from the path component of this representation. * * @return a new <b>SVNURL</b> representation */ public SVNURL removePathTail() throws SVNException { String newPath = SVNPathUtil.removeTail(myPath); String url = composeURL(getProtocol(), getUserInfo(), getHost(), myIsDefaultPort ? -1 : getPort(), newPath); return parseURIDecoded(url); } /**
/** * Constructs a new <b>SVNURL</b> representation removing a tail path * segment from the path component of this representation. * * @return a new <b>SVNURL</b> representation * @throws SVNException */ public SVNURL removePathTail() throws SVNException { String newPath = SVNPathUtil.removeTail(myPath); String url = composeURL(getProtocol(), getUserInfo(), getHost(), myIsDefaultPort ? -1 : getPort(), newPath); return parseURIDecoded(url); } /**
/** * Constructs a new <b>SVNURL</b> representation removing a tail path * segment from the path component of this representation. * * @return a new <b>SVNURL</b> representation * @throws SVNException */ public SVNURL removePathTail() throws SVNException { String newPath = SVNPathUtil.removeTail(myPath); String url = composeURL(getProtocol(), getUserInfo(), getHost(), myIsDefaultPort ? -1 : getPort(), newPath); return parseURIDecoded(url); } /**
protected void doOpenConnection() throws SVNException { String url = getSubversionURL(); SVNURL repoUrl = SVNURL.parseURIDecoded(url); queryRepo = SVNRepositoryFactory.create(repoUrl); configureAuthenticationManager(queryRepo); // when URL is given like http://svn.dev.java.net/svn/abc/trunk/xyz, we need to compute // repositoryRoot=http://svn.dev.java.net/abc and rootPath=/trunk/xyz rootPath = repoUrl.getPath().substring(queryRepo.getRepositoryRoot(true).getPath().length()); if(rootPath.startsWith("/")) rootPath=rootPath.substring(1); // at least in case of file:// URL, the commit editor remembers the root path // portion and that interferes with the way we work, so re-open the repository // with the correct root. SVNURL repoRoot = queryRepo.getRepositoryRoot(true); queryRepo.setLocation(repoRoot,false); // open another one for commit commitRepo = SVNRepositoryFactory.create(repoRoot); configureAuthenticationManager(commitRepo); // prepare a commit ISVNEditor svnEditor = commitRepo.getCommitEditor("Upload by wagon-svn", new CommitMediator()); svnEditor.openRoot(-1); // if openRoot fails, Maven calls closeConnection anyway, so don't let the incorrect // editor state show through. this.editor = svnEditor; }
private SessionInfo openSourceRepository(SVNRepository targetRepos) throws SVNException { String fromURL = targetRepos.getRevisionPropertyValue(0, SVNRevisionProperty.FROM_URL); String fromUUID = targetRepos.getRevisionPropertyValue(0, SVNRevisionProperty.FROM_UUID); String lastMergedRev = targetRepos.getRevisionPropertyValue(0, SVNRevisionProperty.LAST_MERGED_REVISION); if (fromURL == null || fromUUID == null || lastMergedRev == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Destination repository has not been initialized"); SVNErrorManager.error(err); } SVNURL srcURL = SVNURL.parseURIDecoded(fromURL); SVNRepository srcRepos = createRepository(srcURL, false); checkIfRepositoryIsAtRoot(srcRepos, srcURL); String reposUUID = srcRepos.getRepositoryUUID(true); if (!fromUUID.equals(reposUUID)) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "UUID of destination repository ({0}) does not match expected UUID ({1})", new String[] { reposUUID, fromUUID }); SVNErrorManager.error(err); } return new SessionInfo(srcRepos, Long.parseLong(lastMergedRev)); }
private SessionInfo openSourceRepository(SVNRepository targetRepos) throws SVNException { SVNPropertyValue fromURL = targetRepos.getRevisionPropertyValue(0, SVNRevisionProperty.FROM_URL); SVNPropertyValue fromUUID = targetRepos.getRevisionPropertyValue(0, SVNRevisionProperty.FROM_UUID); SVNPropertyValue lastMergedRev = targetRepos.getRevisionPropertyValue(0, SVNRevisionProperty.LAST_MERGED_REVISION); if (fromURL == null || fromUUID == null || lastMergedRev == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Destination repository has not been initialized"); SVNErrorManager.error(err, SVNLogType.FSFS); } SVNURL srcURL = SVNURL.parseURIDecoded(fromURL.getString()); SVNRepository srcRepos = createRepository(srcURL, fromUUID.getString(), false); try { return new SessionInfo(srcRepos, Long.parseLong(lastMergedRev.getString())); } catch (NumberFormatException nfe) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.IO_ERROR, nfe), SVNLogType.FSFS); } return null; }
private SessionInfo openSourceRepository(SVNRepository targetRepos) throws SVNException { SVNPropertyValue fromURL = targetRepos.getRevisionPropertyValue(0, SVNRevisionProperty.FROM_URL); SVNPropertyValue fromUUID = targetRepos.getRevisionPropertyValue(0, SVNRevisionProperty.FROM_UUID); SVNPropertyValue lastMergedRev = targetRepos.getRevisionPropertyValue(0, SVNRevisionProperty.LAST_MERGED_REVISION); if (fromURL == null || fromUUID == null || lastMergedRev == null) { SVNErrorMessage err = SVNErrorMessage.create(SVNErrorCode.IO_ERROR, "Destination repository has not been initialized"); SVNErrorManager.error(err, SVNLogType.FSFS); } SVNURL srcURL = SVNURL.parseURIDecoded(fromURL.getString()); SVNRepository srcRepos = createRepository(srcURL, fromUUID.getString(), false); try { return new SessionInfo(srcRepos, Long.parseLong(lastMergedRev.getString())); } catch (NumberFormatException nfe) { SVNErrorManager.error(SVNErrorMessage.create(SVNErrorCode.IO_ERROR, nfe), SVNLogType.FSFS); } return null; }
public void process( @NotNull CmdLine cmdLine ) throws IOException, SVNException { cmdLine.out( SubversionMessageHandler.get( "module.list.repository.entries" ) ); String repositoryUrl = cmdLine.read( SubversionMessageHandler.get( "wich.repository.shall.be.used" ), subversionSupport.getRepositoryUrls(), null ); subversionSupport.addRepositoryUrl( repositoryUrl ); cmdLine.warning( SubversionMessageHandler.get( "listing.repository.entries" ) ); cmdLine.out( SubversionMessageHandler.get( "repository" ) ); cmdLine.success( '\t' + repositoryUrl ); SVNURL svnurl = SVNURL.parseURIDecoded( repositoryUrl ); SVNRepository repository = SVNRepositoryFactory.create( svnurl ); repository.setAuthenticationManager( subversionSupport.getAuthenticationManager() ); Collection<SVNDirEntry> dirEntry = repository.getDir( ".", repository.getLatestRevision(), null, ( Collection<?> ) null ); for ( SVNDirEntry entry : dirEntry ) { cmdLine.out( entry.getRelativePath() + "\t\t(" + entry.getKind() + ")" ); } } }