StringBuilder urlSb = new StringBuilder( repoUrl.getProtocol() ); boolean urlSupportsUserInformation = false; if ( PROTOCOL_SSH.equals( repoUrl.getProtocol() ) || PROTOCOL_RSYNC.equals( repoUrl.getProtocol() ) || PROTOCOL_GIT.equals( repoUrl.getProtocol() ) || PROTOCOL_HTTP.equals( repoUrl.getProtocol() ) || PROTOCOL_HTTPS.equals( repoUrl.getProtocol() ) || PROTOCOL_NONE.equals( repoUrl.getProtocol() ) ) if ( repoUrl.getProtocol() != null && repoUrl.getProtocol().length() > 0 ) String userName = repoUrl.getUserName(); String password = repoUrl.getPassword(); if ( getPassword() != null && getPassword().length() > 0 ) urlSb.append( repoUrl.getHost() ); if ( repoUrl.getPort() != null && repoUrl.getPort().length() > 0 ) urlSb.append( ':' ).append( repoUrl.getPort() ); urlSb.append( repoUrl.getPath() );
/** * Parse the given url string and store all the extracted * information in a {@code RepositoryUrl} * * @param url to parse * @return filled with the information from the given URL * @throws ScmException */ private RepositoryUrl parseUrl( String url ) throws ScmException { RepositoryUrl repoUrl = new RepositoryUrl(); url = parseProtocol( repoUrl, url ); url = parseUserInfo( repoUrl, url ); url = parseHostAndPort( repoUrl, url ); // the rest of the url must be the path to the repository on the server repoUrl.setPath( url ); return repoUrl; }
repoUrl.setProtocol( PROTOCOL_FILE ); repoUrl.setProtocol( PROTOCOL_HTTPS ); repoUrl.setProtocol( PROTOCOL_HTTP ); repoUrl.setProtocol( PROTOCOL_SSH ); repoUrl.setProtocol( PROTOCOL_GIT ); repoUrl.setProtocol( PROTOCOL_RSYNC ); repoUrl.setProtocol( PROTOCOL_NONE ); return url; url = url.substring( repoUrl.getProtocol().length() + 3 );
throws ScmException if ( PROTOCOL_FILE.equals( repoUrl.getProtocol() ) ) if ( indexPwdSep < 0 ) repoUrl.setUserName( userInfo ); repoUrl.setUserName( userInfo.substring( 0, indexPwdSep ) ); repoUrl.setPassword( userInfo.substring( indexPwdSep + 1 ) );
if ( GitScmProviderRepository.PROTOCOL_FILE.equals( repository.getFetchInfo().getProtocol() ) && repository.getFetchInfo().getPath().indexOf( fileSet.getBasedir().getPath() ) >= 0 )
repoUrl.setPort( "" ); repoUrl.setHost( "" ); if ( PROTOCOL_FILE.equals( repoUrl.getProtocol() ) ) repoUrl.setHost( hostAndPortMatcher.group( 1 ) ); repoUrl.setPort( hostAndPortMatcher.group( 2 ) );
setUser( pushInfo.getUserName() ); setPassword( pushInfo.getPassword() ); setHost( pushInfo.getHost() ); if ( pushInfo.getPort() != null && pushInfo.getPort().length() > 0 ) setPort( Integer.parseInt( pushInfo.getPort() ) );
public JGitTransportConfigCallback(GitScmProviderRepository repo, ScmLogger logger) { if (repo.getFetchInfo().getProtocol().equals("ssh")) { if (!StringUtils.isEmptyOrNull(repo.getPrivateKey()) && repo.getPassphrase() == null) { logger.debug("using private key with passphrase: " + repo.getPrivateKey()); sshSessionFactory = new UnprotectedPrivateKeySessionFactory(repo); } else if (!StringUtils.isEmptyOrNull(repo.getPrivateKey()) && repo.getPassphrase() != null) { logger.debug("using private key: " + repo.getPrivateKey()); sshSessionFactory = new ProtectedPrivateKeyFileSessionFactory(repo); } else { sshSessionFactory = new SimpleSessionFactory(); } } }
GitScmProviderRepository repository = (GitScmProviderRepository) repo; if (GitScmProviderRepository.PROTOCOL_FILE.equals(repository.getFetchInfo().getProtocol()) && repository.getFetchInfo().getPath().indexOf(fileSet.getBasedir().getPath()) >= 0) { throw new ScmException("remote repository must not be the working directory");
throws ScmException if ( PROTOCOL_FILE.equals( repoUrl.getProtocol() ) ) if ( indexPwdSep < 0 ) repoUrl.setUserName( userInfo ); repoUrl.setUserName( userInfo.substring( 0, indexPwdSep ) ); repoUrl.setPassword( userInfo.substring( indexPwdSep + 1 ) );
repoUrl.setPort( "" ); repoUrl.setHost( "" ); if ( PROTOCOL_FILE.equals( repoUrl.getProtocol() ) ) repoUrl.setHost( hostAndPortMatcher.group( 1 ) ); repoUrl.setPort( hostAndPortMatcher.group( 2 ) );
repoUrl.setProtocol( PROTOCOL_FILE ); repoUrl.setProtocol( PROTOCOL_HTTPS ); repoUrl.setProtocol( PROTOCOL_HTTP ); repoUrl.setProtocol( PROTOCOL_SSH ); repoUrl.setProtocol( PROTOCOL_GIT ); repoUrl.setProtocol( PROTOCOL_RSYNC ); repoUrl.setProtocol( PROTOCOL_NONE ); return url; url = url.substring( repoUrl.getProtocol().length() + 3 );
setUser( pushInfo.getUserName() ); setPassword( pushInfo.getPassword() ); setHost( pushInfo.getHost() ); if ( pushInfo.getPort() != null && pushInfo.getPort().length() > 0 ) setPort( Integer.parseInt( pushInfo.getPort() ) );
if ( GitScmProviderRepository.PROTOCOL_FILE.equals( repository.getFetchInfo().getProtocol() ) && repository.getFetchInfo().getPath().indexOf( fileSet.getBasedir().getPath() ) >= 0 )
StringBuilder urlSb = new StringBuilder( repoUrl.getProtocol() ); boolean urlSupportsUserInformation = false; if ( PROTOCOL_SSH.equals( repoUrl.getProtocol() ) || PROTOCOL_RSYNC.equals( repoUrl.getProtocol() ) || PROTOCOL_GIT.equals( repoUrl.getProtocol() ) || PROTOCOL_HTTP.equals( repoUrl.getProtocol() ) || PROTOCOL_HTTPS.equals( repoUrl.getProtocol() ) || PROTOCOL_NONE.equals( repoUrl.getProtocol() ) ) if ( repoUrl.getProtocol() != null && repoUrl.getProtocol().length() > 0 ) String userName = repoUrl.getUserName(); String password = repoUrl.getPassword(); if ( getPassword() != null && getPassword().length() > 0 ) urlSb.append( repoUrl.getHost() ); if ( repoUrl.getPort() != null && repoUrl.getPort().length() > 0 ) urlSb.append( ':' ).append( repoUrl.getPort() ); urlSb.append( repoUrl.getPath() );
/** * Parse the given url string and store all the extracted * information in a {@code RepositoryUrl} * * @param url to parse * @return filled with the information from the given URL * @throws ScmException */ private RepositoryUrl parseUrl( String url ) throws ScmException { RepositoryUrl repoUrl = new RepositoryUrl(); url = parseProtocol( repoUrl, url ); url = parseUserInfo( repoUrl, url ); url = parseHostAndPort( repoUrl, url ); // the rest of the url must be the path to the repository on the server repoUrl.setPath( url ); return repoUrl; }
if ( GitScmProviderRepository.PROTOCOL_FILE.equals( repository.getFetchInfo().getProtocol() ) && repository.getFetchInfo().getPath().indexOf( fileSet.getBasedir().getPath() ) >= 0 )
if ( GitScmProviderRepository.PROTOCOL_FILE.equals( repository.getFetchInfo().getProtocol() ) && repository.getFetchInfo().getPath().indexOf( fileSet.getBasedir().getPath() ) >= 0 )
if ( GitScmProviderRepository.PROTOCOL_FILE.equals( repository.getFetchInfo().getProtocol() ) && repository.getFetchInfo().getPath().indexOf( fileSet.getBasedir().getPath() ) >= 0 )
if ( GitScmProviderRepository.PROTOCOL_FILE.equals( repository.getFetchInfo().getProtocol() ) && repository.getFetchInfo().getPath().indexOf( fileSet.getBasedir().getPath() ) >= 0 )