Refine search
/** {@inheritDoc} */ protected StatusScmResult executeStatusCommand( ScmProviderRepository repository, ScmFileSet fileSet ) throws ScmException { return new StatusScmResult( null, Collections.<ScmFile>emptyList() ); } }
GitScmProviderRepository repository = (GitScmProviderRepository) repo; if (fileSet.getFileList().isEmpty()) { throw new ScmException("You must provide at least one file/directory to add"); statusCommand.setLogger(getLogger()); StatusScmResult status = statusCommand.executeStatusCommand(repository, fileSet); getLogger().warn("add - status - " + status.isSuccess()); for (ScmFile s : status.getChangedFiles()) { getLogger().warn("added " + s.getPath()); if (fileSet.getFileList().isEmpty()) { changedFiles = status.getChangedFiles(); } else { for (ScmFile scmfile : status.getChangedFiles()) { for (File f : fileSet.getFileList()) { if (FilenameUtils.separatorsToUnix(f.getPath()).equals(scmfile.getPath())) { changedFiles.add(scmfile); Commandline cl = createCommandLine(fileSet.getBasedir(), fileSet.getFileList()); return new AddScmResult(cl.toString(), changedFiles);
throws ScmException if ( getLogger().isDebugEnabled() ) getLogger().debug( "executing status command..." ); ClearCaseStatusConsumer consumer = new ClearCaseStatusConsumer( getLogger(), scmFileSet.getBasedir() ); if ( getLogger().isDebugEnabled() ) getLogger().debug( "Executing: " + cl.getWorkingDirectory().getAbsolutePath() + ">>" + cl.toString() ); throw new ScmException( "Error while executing clearcase command.", ex ); return new StatusScmResult( cl.toString(), "The cleartool command failed.", stderr.getOutput(), false ); return new StatusScmResult( cl.toString(), consumer.getCheckedOutFiles() );
throw new ScmException( "This provider can't handle tags." ); List<File> files = fileSet.getFileList(); if ( files.isEmpty() ) statusCmd.setLogger( getLogger() ); StatusScmResult status = statusCmd.executeStatusCommand( repo, fileSet ); List<ScmFile> statusFiles = status.getChangedFiles(); for ( ScmFile file : statusFiles ) if ( file.getStatus() == ScmFileStatus.ADDED || file.getStatus() == ScmFileStatus.DELETED || file.getStatus() == ScmFileStatus.MODIFIED ) commitedFiles.add( new ScmFile( file.getPath(), ScmFileStatus.CHECKED_IN ) ); commitCmd = BazaarUtils.expandCommandLine( commitCmd, fileSet ); ScmResult result = BazaarUtils.execute( new BazaarConsumer( getLogger() ), getLogger(), fileSet.getBasedir(), commitCmd ); if ( !repository.getURI().equals( fileSet.getBasedir().getAbsolutePath() ) && repo.isPushChanges() )
/** * {@inheritDoc} */ protected StatusScmResult executeStatusCommand( ScmProviderRepository repo, ScmFileSet fileSet ) throws ScmException { if ( getLogger().isInfoEnabled() ) { getLogger().info( "SVN status directory: " + fileSet.getBasedir().getAbsolutePath() ); } SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo; SvnStatusHandler handler = new SvnStatusHandler( fileSet.getBasedir() ); try { SvnJavaUtil.status( javaRepo.getClientManager(), fileSet.getBasedir(), true, // isRecursive true, // isRemote handler ); return new StatusScmResult( SvnJavaScmProvider.COMMAND_LINE, handler.getFiles() ); } catch ( SVNException e ) { return new StatusScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN status failed.", e.getMessage(), false ); } } }
/** {@inheritDoc} */ protected StatusScmResult executeStatusCommand( ScmProviderRepository repo, ScmFileSet fileSet ) throws ScmException { if ( getLogger().isInfoEnabled() ) { getLogger().info( "Working directory: " + fileSet.getBasedir().getAbsolutePath() ); } if ( fileSet.getFileList().size() != 0 ) { throw new ScmException( "This provider doesn't support checking status of a subsets of a directory" ); } StarteamScmProviderRepository repository = (StarteamScmProviderRepository) repo; StarteamStatusConsumer consumer = new StarteamStatusConsumer( getLogger(), fileSet.getBasedir() ); CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer(); Commandline cl = createCommandLine( repository, fileSet ); int exitCode = StarteamCommandLineUtils.executeCommandline( cl, consumer, stderr, getLogger() ); if ( exitCode != 0 ) { return new StatusScmResult( cl.toString(), "The starteam command failed.", stderr.getOutput(), false ); } return new StatusScmResult( cl.toString(), consumer.getChangedFiles() ); }
/** {@inheritDoc} */ protected StatusScmResult executeStatusCommand( ScmProviderRepository repo, ScmFileSet fileSet ) throws ScmException { Commandline cl = createCommandLine( (SvnScmProviderRepository) repo, fileSet ); SvnStatusConsumer consumer = new SvnStatusConsumer( getLogger(), fileSet.getBasedir() ); CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer(); if ( getLogger().isInfoEnabled() ) { getLogger().info( "Executing: " + SvnCommandLineUtils.cryptPassword( cl ) ); if ( Os.isFamily( Os.FAMILY_WINDOWS ) ) { getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() ); } } int exitCode; try { exitCode = SvnCommandLineUtils.execute( cl, consumer, stderr, getLogger() ); } catch ( CommandLineException ex ) { throw new ScmException( "Error while executing command.", ex ); } if ( exitCode != 0 ) { return new StatusScmResult( cl.toString(), "The svn command failed.", stderr.getOutput(), false ); } return new StatusScmResult( cl.toString(), consumer.getChangedFiles() ); }
protected StatusScmResult executeStatusCommand( ScmProviderRepository repo, ScmFileSet fileSet ) throws ScmException { Commandline cl = createCommandLine( fileSet ); CvsStatusConsumer consumer = new CvsStatusConsumer( getLogger(), fileSet.getBasedir() ); CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer(); getLogger().info( "Executing: " + cl ); getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() ); int exitCode; getLogger().debug( "Working directory: " + fileSet.getBasedir().getAbsolutePath() ); getLogger().debug( "Command line: " + cl ); try { exitCode = CommandLineUtils.executeCommandLine( cl, consumer, stderr ); } catch ( CommandLineException ex ) { throw new ScmException( "Error while executing command.", ex ); } if ( exitCode != 0 ) { return new StatusScmResult( cl.toString(), "The cvs command failed.", stderr.getOutput(), false ); } return new StatusScmResult( cl.toString(), consumer.getChangedFiles() ); }
throws ScmException if ( getLogger().isDebugEnabled() ) getLogger().debug( "executing remove command..." ); if ( getLogger().isDebugEnabled() ) getLogger().debug( "basedir: " + fileSet.getBasedir() ); if ( projectSpec == null ) throw new ScmException( "You should checkout a working project first" ); for ( File f : fileSet.getFileList() ) File source = new File( fileSet.getBasedir(), f.getPath() ); File dest = new File( destPath, f.getPath() ); SynergyUtil.delete( getLogger(), dest, ccmAddr, false ); for ( File file : fileSet.getFileList() ) scmFiles.add( new ScmFile( file.getPath(), ScmFileStatus.DELETED ) ); return new StatusScmResult( "", scmFiles );
if (!fileSet.getFileList().isEmpty()) { ScmSyncGitAddCommand addCommand = new ScmSyncGitAddCommand(); addCommand.setLogger(getLogger()); statusCommand.setLogger(getLogger()); StatusScmResult status = statusCommand.executeStatusCommand(repository, new ScmFileSet(fileSet.getBasedir())); List<ScmFile> changedFiles = null; if (status.isSuccess()) { changedFiles = status.getChangedFiles(); if (changedFiles.isEmpty()) { return new CheckInScmResult(null, changedFiles); if (exitCode != 0) { String msg = stderr.getOutput(); return new CheckInScmResult(clCommit.toString(), "The git-commit command failed.", msg, false); if (exitCode != 0) { String msg = stderr.getOutput(); return new CheckInScmResult(cl.toString(), "The git-push command failed.", msg, false); checkedInFiles.add(new ScmFile(changedFile.getPath(), ScmFileStatus.CHECKED_IN)); return new CheckInScmResult(clCommit.toString(), checkedInFiles); } finally { try {
protected StatusScmResult executeStatusCommand( ScmProviderRepository r, ScmFileSet f ) throws ScmException { TfsScmProviderRepository tfsRepo = (TfsScmProviderRepository) r; TfsCommand command = createCommand( tfsRepo, f ); ChangedFileConsumer out = new ChangedFileConsumer( getLogger() ); ErrorStreamConsumer err = new ErrorStreamConsumer(); int status = command.execute( out, err ); if ( status != 0 || err.hasBeenFed() ) { return new StatusScmResult( command.getCommandString(), "Error code for TFS status command - " + status, err.getOutput(), false ); } Iterator<ScmFile> iter = out.getChangedFiles().iterator(); getLogger().debug( "Iterating" ); while ( iter.hasNext() ) { ScmFile file = (ScmFile) iter.next(); getLogger().debug( file.getPath() + ":" + file.getStatus() ); } return new StatusScmResult( command.getCommandString(), out.getChangedFiles() ); }
private Set<String> localChanges(Set<ScmFileStatus> statusToInclude, ScmRepository repository, File scmRoot) throws ScmException { final StatusScmResult status = this.manager.status(repository, new ScmFileSet(scmRoot)); Set<String> affected = new LinkedHashSet<>(); for (final ScmFile file : status.getChangedFiles()) { if (statusToInclude.contains(file.getStatus())) { affected.add(file.getPath()); } } return affected; }
File baseDir = fileSet.getBasedir(); File parentFolder = ( baseDir.getParentFile() != null ) ? baseDir.getParentFile() : baseDir; statusCmd.setLogger( getLogger() ); StatusScmResult statusCmdResult = statusCmd.executeStatusCommand( repo, fileSet ); List<ScmFile> statusScmFiles = statusCmdResult.getChangedFiles(); getLogger().debug( "Iterating over statusScmFiles: " + file ); if ( file.getStatus() == ScmFileStatus.ADDED || file.getStatus() == ScmFileStatus.DELETED || file.getStatus() == ScmFileStatus.MODIFIED ) changedScmFiles.add( new ScmFile( file.getPath(), ScmFileStatus.CHECKED_IN ) ); List<File> files = fileSet.getFileList(); if ( files.size() == 0 )
getLogger().info( "Status of files changed in sandbox " + fileSet.getBasedir().getAbsolutePath() ); try String excludes = Sandbox.formatFilePatterns( fileSet.getExcludes() ); String includes = Sandbox.formatFilePatterns( fileSet.getIncludes() ); scmFileList.add( new ScmFile( memberFile.getAbsolutePath(), ScmFileStatus.UPDATED ) ); scmFileList.add( new ScmFile( memberFile.getAbsolutePath(), ScmFileStatus.DELETED ) ); getLogger().info( "No local changes found!" ); result = new StatusScmResult( scmFileList, new ScmResult( "si viewsandbox", "", "", true ) ); getLogger().error( "MKS API Exception: " + eh.getMessage() ); getLogger().debug( eh.getCommand() + " exited with return code " + eh.getExitCode() ); result = new StatusScmResult( eh.getCommand(), eh.getMessage(), "Exit Code: " + eh.getExitCode(), false );
throws ScmException if ( getLogger().isDebugEnabled() ) getLogger().debug( "Executing diff command..." ); File baseDir = fileSet.getBasedir(); File parentFolder = ( baseDir.getParentFile() != null ) ? baseDir.getParentFile() : baseDir; statusCmd.setLogger( getLogger() ); StatusScmResult statusCmdResult = statusCmd.executeStatusCommand( repo, fileSet ); List<ScmFile> statusScmFiles = statusCmdResult.getChangedFiles(); if ( file.getStatus() == ScmFileStatus.MODIFIED ) File fullPath = new File( parentFolder, file.getPath() ); String relativePath = fullPath.toString().substring( baseDir.toString().length() ); getLogger().debug( "Full Path : '" + fullPath + "'" ); getLogger().debug( "Relative Path : '" + relativePath + "'" ); return new DiffScmResult( diffCmd.toString(), statusCmdResult.getChangedFiles(), differences, patch.toString() );
private Set<File> filterUnchangedFiles(Set<File> originalFiles) throws MojoExecutionException { MavenProject topLevelProject = session.getTopLevelProject(); try { String connectionUrl = MoreObjects.firstNonNull( topLevelProject.getScm().getConnection(), topLevelProject.getScm().getDeveloperConnection()); ScmRepository repository = scmManager.makeScmRepository(connectionUrl); ScmFileSet scmFileSet = new ScmFileSet(topLevelProject.getBasedir()); String basePath = topLevelProject.getBasedir().getAbsoluteFile().getPath(); List<String> changedFiles = scmManager.status(repository, scmFileSet).getChangedFiles().stream() .map(f -> String.format("%s/%s", basePath, f.getPath())) .collect(Collectors.toList()); return originalFiles.stream() .filter(f -> changedFiles.contains(f.getPath())) .collect(Collectors.toSet()); } catch (ScmException e) { throw new MojoExecutionException(e.getMessage(), e); } }
throws ScmException if ( getLogger().isDebugEnabled() ) getLogger().debug( "executing status command..." ); if ( getLogger().isDebugEnabled() ) getLogger().debug( "basedir: " + fileSet.getBasedir() ); for ( String filename : l ) ScmFile f = new ScmFile( filename, ScmFileStatus.MODIFIED ); result.add( f ); return new StatusScmResult( "ccm dir", result );
/** {@inheritDoc} */ protected StatusScmResult executeCvsCommand( Commandline cl ) throws ScmException { CvsStatusConsumer consumer = new CvsStatusConsumer( getLogger(), cl.getWorkingDirectory() ); CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer(); int exitCode; try { exitCode = CommandLineUtils.executeCommandLine( cl, consumer, stderr ); } catch ( CommandLineException ex ) { throw new ScmException( "Error while executing command.", ex ); } if ( exitCode != 0 ) { return new StatusScmResult( cl.toString(), "The cvs command failed.", stderr.getOutput(), false ); } return new StatusScmResult( cl.toString(), consumer.getChangedFiles() ); } }
/** {@inheritDoc} */ protected StatusScmResult executeStatusCommand( ScmProviderRepository repo, ScmFileSet files ) throws ScmException { PerforceScmProviderRepository prepo = (PerforceScmProviderRepository) repo; actualLocation = PerforceScmProvider.getRepoPath( getLogger(), prepo, files.getBasedir() ); PerforceStatusConsumer consumer = new PerforceStatusConsumer(); Commandline command = readOpened( prepo, files, consumer ); if ( consumer.isSuccess() ) { List<ScmFile> scmfiles = createResults( actualLocation, consumer ); return new StatusScmResult( command.toString(), scmfiles ); } return new StatusScmResult( command.toString(), "Unable to get status", consumer .getOutput(), consumer.isSuccess() ); }
CvsStatusConsumer consumer = new CvsStatusConsumer( getLogger(), cl.getWorkingDirectory() ); boolean isSuccess = CvsConnection.processCommand( cl.getArguments(), cl.getWorkingDirectory().getAbsolutePath(), logListener, getLogger() ); return new StatusScmResult( cl.toString(), "The cvs command failed.", logListener.getStderr().toString(), false ); return new StatusScmResult( cl.toString(), "The cvs command failed.", logListener.getStderr().toString(), false ); return new StatusScmResult( cl.toString(), consumer.getChangedFiles() );