public static Commandline createCommandLine( GitScmProviderRepository repository, File workingDirectory, ScmVersion version ) { Commandline cl = GitCommandLineUtils.getBaseGitCommandLine( workingDirectory, "checkout" ); if ( version != null && StringUtils.isNotEmpty( version.getName() ) ) { cl.createArg().setValue( version.getName() ); } return cl; }
public TfsCommand createCommand( ScmProviderRepository r, ScmFileSet f, ScmVersion v ) { String serverPath = ( (TfsScmProviderRepository) r ).getServerPath(); TfsCommand command = new TfsCommand( "get", r, f, getLogger() ); command.addArgument( serverPath ); if ( v != null && !v.equals( "" ) ) { String vType = ""; if ( v.getType().equals( "Tag" ) ) { vType = "L"; } if ( v.getType().equals( "Revision" ) ) { vType = "C"; } command.addArgument( "-version:" + vType + v.getName() ); } return command; }
/** {@inheritDoc} */ public UpdateScmResult executeUpdateCommand( ScmProviderRepository repo, ScmFileSet fileSet, ScmVersion version ) throws ScmException { CvsScmProviderRepository repository = (CvsScmProviderRepository) repo; Commandline cl = CvsCommandUtils.getBaseCommand( "update", repository, fileSet, false ); cl.createArg().setValue( "-d" ); if ( version != null && StringUtils.isNotEmpty( version.getName() ) ) { cl.createArg().setValue( "-r" + version.getName() ); } List<File> files = fileSet.getFileList(); if ( !files.isEmpty() ) { Iterator<File> fileIterator = files.iterator(); while ( fileIterator.hasNext() ) { cl.createArg().setValue( ( (File) fileIterator.next() ).getPath() ); } } if ( getLogger().isInfoEnabled() ) { getLogger().info( "Executing: " + cl ); getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() ); } return executeCvsCommand( cl ); }
if ( version != null && !StringUtils.isEmpty( version.getName() ) ) cl.createArg().setValue( "-r" + version.getName() ); cl.createArg().setValue( "-R" ); cl.createArg().setValue( "-F" ); throw new ScmException( "Error while making a temporary commit message file." ); cl.createArg().setValue( messageFile.getAbsolutePath() ); List<File> files = fileSet.getFileList(); if ( getLogger().isInfoEnabled() ) getLogger().info( "Executing: " + cl ); getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() );
outputDirectory = fileSet.getBasedir().getAbsolutePath(); if ( version != null && StringUtils.isNotEmpty( version.getName() ) ) createCommandLine( (SvnScmProviderRepository) repo, fileSet.getBasedir(), version, url, outputDirectory ); SvnUpdateConsumer consumer = new SvnUpdateConsumer( getLogger(), fileSet.getBasedir() ); if ( getLogger().isInfoEnabled() ) getLogger().info( "Executing: " + SvnCommandLineUtils.cryptPassword( cl ) ); if ( cl.getWorkingDirectory() != null && Os.isFamily( Os.FAMILY_WINDOWS ) ) getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() ); throw new ScmException( "Error while executing command.", ex ); return new ExportScmResult( cl.toString(), "The svn command failed.", stderr.getOutput(), false );
boolean binary = parameters.getBoolean( CommandParameter.BINARY, false ); if ( fileSet.getBasedir().exists() ) FileUtils.deleteDirectory( fileSet.getBasedir() ); if ( getLogger().isWarnEnabled() ) getLogger().warn( "Can't delete " + fileSet.getBasedir().getAbsolutePath(), e ); cl.setWorkingDirectory( fileSet.getBasedir().getParentFile().getAbsolutePath() ); cl.createArg().setValue( "-kb" ); if ( version != null && !StringUtils.isEmpty( version.getName() ) ) cl.createArg().setValue( "-r" ); cl.createArg().setValue( version.getName() ); cl.createArg().setValue( repository.getModule() ); if ( getLogger().isInfoEnabled() ) getLogger().info( "Executing: " + cl );
throws ScmException Commandline cl = new Commandline(); cl.setExecutable( CCM ); cl.createArg().setValue( CO ); cl.createArg().setValue( "-subprojects" ); // Checkout sub-projects cl.createArg().setValue( "-rel" ); // Relative if ( version != null && StringUtils.isNotEmpty( version.getName() ) ) cl.createArg().setValue( "-t" ); // Version cl.createArg().setValue( version.getName() ); throw new ScmException( "Invalid directory", e );
args.add( "M" ); if ( startLabel != null && StringUtils.isNotEmpty( startLabel.getName() ) ) args.add( startLabel.getName() ); if ( endLabel != null && StringUtils.isNotEmpty( endLabel.getName() ) ) args.add( endLabel.getName() ); if ( endLabel != null && ( startLabel == null || StringUtils.isEmpty( startLabel.getName() ) ) ) throw new ScmException( "Missing start label." );
String url = repository.getURI(); File checkoutDir = fileSet.getBasedir(); try if ( getLogger().isInfoEnabled() ) getLogger().info( "Removing " + checkoutDir ); throw new ScmException( "Cannot remove " + checkoutDir ); checkoutCmd.add( url ); checkoutCmd.add( checkoutDir.getAbsolutePath() ); if ( version != null && StringUtils.isNotEmpty( version.getName() ) ) checkoutCmd.add( "tag:" + version.getName() ); if ( !result.isSuccess() ) throw new ScmException( result.getProviderMessage() );
public static Commandline createDeleteLocalCommand( StarteamScmProviderRepository repo, ScmFileSet dir, ScmVersion version ) { List<String> args = new ArrayList<String>(); if ( version != null && StringUtils.isNotEmpty( version.getName() ) ) { args.add( "-cfgl" ); args.add( version.getName() ); } args.add( "-filter" ); args.add( "N" ); return StarteamCommandLineUtils.createStarteamCommandLine( "delete-local", args, dir, repo ); }
throws ScmException if ( getLogger().isDebugEnabled() ) getLogger().debug( "executing checkout command..." ); File workingDirectory = fileSet.getBasedir(); if ( version != null && getLogger().isDebugEnabled() ) getLogger().debug( version.getType() + ": " + version.getName() ); if ( getLogger().isInfoEnabled() ) getLogger().info( "Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString() ); if ( version != null && StringUtils.isNotEmpty( version.getName() ) ) if ( getLogger().isInfoEnabled() ) getLogger().info( "Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString() ); throw new ScmException( "Error while executing clearcase command.", ex ); throw new ScmException( "Error while deleting working directory.", ex );
if ( version != null && StringUtils.isNotEmpty( version.getName() ) ) throw new ScmException( "The local scm doesn't support tags." ); File baseDestination = fileSet.getBasedir(); throw new ScmException( "The working directory doesn't exist (" + baseDestination.getAbsolutePath() + ")." ); throw new ScmException( "The base directory doesn't exist (" + root.getAbsolutePath() + ")." ); List<File> files = fileSet.getFileList(); if ( getLogger().isDebugEnabled() ) getLogger().debug( "fileContents:" + fileContents ); getLogger().debug( "repoFileContents:" + repoFileContents );
&& repository.getFetchInfo().getPath().indexOf( fileSet.getBasedir().getPath() ) >= 0 ) throw new ScmException( "remote repository must not be the working directory" ); String branch = version != null ? version.getName() : null; if ( StringUtils.isBlank( branch ) ) getLogger().debug( "try checkout of branch: " + branch ); if ( !fileSet.getBasedir().exists() || !( new File( fileSet.getBasedir(), ".git" ).exists() ) ) if ( fileSet.getBasedir().exists() ) getLogger().info( "cloning [" + branch + "] to " + fileSet.getBasedir() ); CloneCommand command = Git.cloneRepository().setURI( repository.getFetchUrl() ); command.setCredentialsProvider( credentials ).setBranch( branch ).setDirectory( fileSet.getBasedir() ); if ( version != null && StringUtils.isNotEmpty( version.getName() ) && ( version instanceof ScmTag ) ) getLogger().debug( "fetch..." ); git.fetch().setCredentialsProvider( credentials ).setProgressMonitor( monitor ).call(); throw new ScmException( "JGit checkout failure!", e );
String url = repository.getURI(); File checkoutDir = fileSet.getBasedir(); try if ( getLogger().isInfoEnabled() ) getLogger().info( "Removing " + checkoutDir ); throw new ScmException( "Cannot remove " + checkoutDir ); if ( scmVersion != null && !StringUtils.isEmpty( scmVersion.getName() ) ) cmdList.add( scmVersion.getName() );
String start = startRev != null && StringUtils.isNotEmpty( startRev.getName() ) ? "@" + startRev.getName() : ""; String end = endRev != null && StringUtils.isNotEmpty( endRev.getName() ) ? "@" + endRev.getName() : "@now"; IFileSpec fileSpec1 = new FileSpec( files.getBasedir().getAbsolutePath() + "/..." + start ); IFileSpec fileSpec2 = new FileSpec( ((P4ScmProviderRepository)repo).getPath() + "/..." + end ); throw new ScmException( e.getLocalizedMessage(), e );
throws ScmException if ( tag != null && !StringUtils.isEmpty( tag.getName() ) ) throw new ScmException( "This provider can't handle tags for this operation" ); File workingDir = fileSet.getBasedir(); String branchName = HgUtils.getCurrentBranchName( getLogger(), workingDir ); boolean differentOutgoingBranch = List<File> files = fileSet.getFileList(); if ( files.isEmpty() ) commitCmd = HgUtils.expandCommandLine( commitCmd, fileSet ); ScmResult result = HgUtils.execute( new HgConsumer( getLogger() ), getLogger(), fileSet.getBasedir(), commitCmd );
/** {@inheritDoc} */ protected DiffScmResult executeDiffCommand( ScmProviderRepository repo, ScmFileSet fileSet, ScmVersion startRevision, ScmVersion endRevision ) throws ScmException { String[] diffCmd; if ( startRevision != null && StringUtils.isNotEmpty( startRevision.getName() ) ) { String revArg = startRevision.getName(); if ( endRevision != null && StringUtils.isNotEmpty( endRevision.getName() ) ) { revArg += ".." + endRevision.getName(); } diffCmd = new String[]{BazaarConstants.DIFF_CMD, BazaarConstants.REVISION_OPTION, revArg}; } else { diffCmd = new String[]{BazaarConstants.DIFF_CMD}; } diffCmd = BazaarUtils.expandCommandLine( diffCmd, fileSet ); BazaarDiffConsumer consumer = new BazaarDiffConsumer( getLogger(), fileSet.getBasedir() ); ScmResult result = BazaarUtils.execute( consumer, getLogger(), fileSet.getBasedir(), diffCmd ); return new DiffScmResult( consumer.getChangedFiles(), consumer.getDifferences(), consumer.getPatch(), result ); } }
ScmVersion endVersion = parameters.getScmVersion( CommandParameter.END_SCM_VERSION, null ); if ( startVersion != null && StringUtils.isNotEmpty( startVersion.getName() ) ) : repository.getAccuRevVersion( endVersion ); if ( !StringUtils.equals( fromVersion.getBasisStream(), toVersion.getBasisStream() ) ) throw new ScmException( "Start or end date cannot be set if num days is set." ); throw new ScmException( "The end date is set but the start date isn't." ); getLogger().warn( "Skipping out of range " + message ); getLogger().info( message ); getLogger().warn( "Skipping diff of " + stream + " due to start date out of range" ); if ( StringUtils.isBlank( errorString ) )
/** {@inheritDoc} */ protected DiffScmResult executeDiffCommand( ScmProviderRepository repo, ScmFileSet fileSet, ScmVersion startRevision, ScmVersion endRevision ) throws ScmException { String[] diffCmd; if ( startRevision != null && !StringUtils.isEmpty( startRevision.getName() ) ) { String revArg = startRevision.getName(); if ( endRevision != null && !StringUtils.isEmpty( endRevision.getName() ) ) { revArg += ".." + endRevision; } diffCmd = new String[] { HgCommandConstants.DIFF_CMD, HgCommandConstants.REVISION_OPTION, revArg }; } else { diffCmd = new String[] { HgCommandConstants.DIFF_CMD }; } diffCmd = HgUtils.expandCommandLine( diffCmd, fileSet ); HgDiffConsumer consumer = new HgDiffConsumer( getLogger(), fileSet.getBasedir() ); ScmResult result = HgUtils.execute( consumer, getLogger(), fileSet.getBasedir(), diffCmd ); return new DiffScmResult( consumer.getChangedFiles(), consumer.getDifferences(), consumer.getPatch(), result ); } }
throws ScmException if ( scmVersion != null && StringUtils.isNotEmpty( scmVersion.getName() ) ) throw new ScmException( "This provider command can't handle tags." ); if ( getLogger().isDebugEnabled() ) getLogger().debug( "Executing checkin command..." ); if ( jazzRepo.isPushChangesAndHaveFlowTargets() && StringUtils.isNotEmpty( jazzRepo.getWorkItem() ) )