public GitScmProviderRepository( String url, String user, String password ) throws ScmException { this( url ); setUser( user ); setPassword( password ); }
/** * 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; }
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(); } } }
/** * {@inheritDoc} */ public String getRelativePath( ScmProviderRepository ancestor ) { if ( ancestor instanceof GitScmProviderRepository ) { GitScmProviderRepository gitAncestor = (GitScmProviderRepository) ancestor; //X TODO review! String url = getFetchUrl(); String path = url.replaceFirst( gitAncestor.getFetchUrl() + "/", "" ); if ( !path.equals( url ) ) { return path; } } return null; }
/** * The git-submodule(1) command is available since Git 1.5.3, so modules will * be activated in a later stage */ private ScmUrlParserResult parseScmUrl( String scmSpecificUrl, char delimiter ) throws ScmException { ScmUrlParserResult result = new ScmUrlParserResult(); result.repository = new GitScmProviderRepository( scmSpecificUrl ); return result; }
/** * Create the documentation to provide an developer access with a <code>Git</code> SCM. For example, generate * the following command line: * <p> * git clone repo * </p> * * @param gitRepo */ private void developerAccessGit( GitScmProviderRepository gitRepo ) { sink.paragraph(); linkPatternedText( getI18nString( "devaccess.git.intro" ) ); sink.paragraph_(); gitClone( gitRepo.getPushUrl() ); }
@Override protected JSch createDefaultJSch(FS fs) throws JSchException { JSch defaultJSch = super.createDefaultJSch(fs); defaultJSch.addIdentity(getRepo().getPrivateKey(), getRepo().getPassphrase()); return defaultJSch; } }
/** * {@inheritDoc} */ public String getRelativePath( ScmProviderRepository ancestor ) { if ( ancestor instanceof GitScmProviderRepository ) { GitScmProviderRepository gitAncestor = (GitScmProviderRepository) ancestor; //X TODO review! String url = getFetchUrl(); String path = url.replaceFirst( gitAncestor.getFetchUrl() + "/", "" ); if ( !path.equals( url ) ) { return path; } } return null; }
/** * The git-submodule(1) command is available since Git 1.5.3, so modules will * be activated in a later stage */ private ScmUrlParserResult parseScmUrl( String scmSpecificUrl, char delimiter ) throws ScmException { ScmUrlParserResult result = new ScmUrlParserResult(); result.repository = new GitScmProviderRepository( scmSpecificUrl ); return result; }
/** * 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; }
public GitScmProviderRepository( String url, String user, String password ) throws ScmException { this( url ); setUser( user ); setPassword( password ); }
/** * Create the documentation to provide an anonymous access with a * <code>Git</code> SCM. For example, generate the following command line: * <p> * git clone uri * </p> * * @param gitRepo */ private void anonymousAccessGit(GitScmProviderRepository gitRepo) { sink.paragraph(); linkPatternedText(getI18nString("anonymousaccess.git.intro")); sink.paragraph_(); gitClone(gitRepo.getFetchUrl()); }
@Override protected ScmProviderRepository getScmProviderRepository() throws Exception { return new GitScmProviderRepository( getScmUrl().substring( "scm:git:".length() ) ); }
/** * @return the URL used to fetch from the upstream repository */ public String getFetchUrl() { return getUrl( fetchInfo ); }
@Override protected ScmProviderRepository getScmProviderRepository() throws Exception { return new GitScmProviderRepository( getScmUrl().substring( "scm:git:".length() ) ); }
/** * @return the URL used to fetch from the upstream repository */ public String getFetchUrl() { return getUrl( fetchInfo ); }
/** * @return the URL used to push to the upstream repository */ public String getPushUrl() { return getUrl( pushInfo ); }
/** * @return the URL used to push to the upstream repository */ public String getPushUrl() { return getUrl( pushInfo ); }