/** * {@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; }
/** * {@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; }
config.setString( "remote", "origin", "url", repository.getFetchUrl() ); config.setString( "remote", "origin", "pushURL", repository.getPushUrl() ); logger.info( "fetch url: " + repository.getFetchUrl().replace( password, "******" ) ); logger.info( "push url: " + repository.getPushUrl().replace( password, "******" ) ); return getCredentials( repository );
/** * 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()); }
config.setString( "remote", "origin", "url", repository.getFetchUrl() ); config.setString( "remote", "origin", "pushURL", repository.getPushUrl() ); logger.info( "fetch url: " + repository.getFetchUrl().replace( password, "******" ) ); logger.info( "push url: " + repository.getPushUrl().replace( password, "******" ) ); return getCredentials( repository );
/** * 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() ); }
/** * create the command line for updating the current branch with the info from the foreign repository. */ public static Commandline createCommandLine( GitScmProviderRepository repository, File workingDirectory, ScmVersion scmVersion ) { Commandline cl = GitCommandLineUtils.getBaseGitCommandLine( workingDirectory, "pull" ); cl.createArg().setLine( repository.getFetchUrl() ); // now set the branch where we would like to pull from if ( scmVersion instanceof ScmBranch ) { cl.createArg().setLine( scmVersion.getName() ); } return cl; }
/** * create the command line for updating the current branch with the info from the foreign repository. */ public static Commandline createCommandLine( GitScmProviderRepository repository, File workingDirectory, ScmVersion scmVersion ) { Commandline cl = GitCommandLineUtils.getBaseGitCommandLine( workingDirectory, "pull" ); cl.createArg().setLine( repository.getFetchUrl() ); // now set the branch where we would like to pull from if ( scmVersion instanceof ScmBranch ) { cl.createArg().setLine( scmVersion.getName() ); } return cl; }
cl.createArg().setValue( repository.getFetchUrl() ); cl.createArg().setValue( repository.getFetchUrl() ); cl.createArg().setValue( repository.getFetchUrl() ); cl.createArg().setValue( "master" );
cl.createArg().setValue( repository.getFetchUrl() ); cl.createArg().setValue( repository.getFetchUrl() ); cl.createArg().setValue( repository.getFetchUrl() ); cl.createArg().setValue( "master" );
/** * Create a "git remote add origin" command. * * @param workingDirectory the working directory. * @param repository the SCM repository. * * @return the command line to add the remote origin. */ private Commandline createRemoteAddOriginCommand(File workingDirectory, GitScmProviderRepository repository) { Commandline cl = GitCommandLineUtils.getBaseGitCommandLine(workingDirectory, "remote"); cl.createArg().setValue("add"); cl.createArg().setValue("origin"); cl.createArg().setValue(repository.getFetchUrl()); return cl; }
@Override public RemoteInfoScmResult executeRemoteInfoCommand( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters ) throws ScmException { GitScmProviderRepository gitRepository = (GitScmProviderRepository) repository; CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer(); Commandline clLsRemote = createCommandLine( gitRepository ); GitRemoteInfoConsumer consumer = new GitRemoteInfoConsumer( getLogger(), clLsRemote.toString() ); int exitCode = GitCommandLineUtils.execute( clLsRemote, consumer, stderr, getLogger() ); if ( exitCode != 0 ) { throw new ScmException( "unbale to execute ls-remote on " + gitRepository.getFetchUrl() ); } return consumer.getRemoteInfoScmResult(); }
/** * create a git-clone repository command */ private Commandline createCloneCommand( GitScmProviderRepository repository, File workingDirectory, ScmVersion version, boolean binary, boolean shallow ) { Commandline cl = GitCommandLineUtils.getBaseGitCommandLine( workingDirectory.getParentFile(), "clone" ); forceBinary( cl, binary ); if ( shallow ) { cl.createArg().setValue( "--depth" ); cl.createArg().setValue( "1" ); } if ( version != null && ( version instanceof ScmBranch ) ) { cl.createArg().setValue( "--branch" ); cl.createArg().setValue( version.getName() ); } cl.createArg().setValue( repository.getFetchUrl() ); cl.createArg().setValue( workingDirectory.getName() ); return cl; }
/** * create a git-clone repository command */ private Commandline createCloneCommand( GitScmProviderRepository repository, File workingDirectory, ScmVersion version, boolean binary, boolean shallow ) { Commandline cl = GitCommandLineUtils.getBaseGitCommandLine( workingDirectory.getParentFile(), "clone" ); forceBinary( cl, binary ); if ( shallow ) { cl.createArg().setValue( "--depth" ); cl.createArg().setValue( "1" ); } if ( version != null && ( version instanceof ScmBranch ) ) { cl.createArg().setValue( "--branch" ); cl.createArg().setValue( version.getName() ); } cl.createArg().setValue( repository.getFetchUrl() ); cl.createArg().setValue( workingDirectory.getName() ); return cl; }
@Override public RemoteInfoScmResult executeRemoteInfoCommand( ScmProviderRepository repository, ScmFileSet fileSet, CommandParameters parameters ) throws ScmException { GitScmProviderRepository gitRepository = (GitScmProviderRepository) repository; CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer(); Commandline clLsRemote = createCommandLine( gitRepository ); GitRemoteInfoConsumer consumer = new GitRemoteInfoConsumer( getLogger(), clLsRemote.toString() ); int exitCode = GitCommandLineUtils.execute( clLsRemote, consumer, stderr, getLogger() ); if ( exitCode != 0 ) { throw new ScmException( "unbale to execute ls-remote on " + gitRepository.getFetchUrl() ); } return consumer.getRemoteInfoScmResult(); }
CloneCommand command = Git.cloneRepository().setURI( repository.getFetchUrl() ); command.setCredentialsProvider( credentials ).setBranch( branch ).setDirectory( fileSet.getBasedir() ); command.setProgressMonitor( monitor );
CloneCommand command = Git.cloneRepository().setURI( repository.getFetchUrl() );