private ChangeLogScmResult executeChangeLogCommand( ScmFileSet fileSet, Date startDate, Date endDate, String datePattern, Integer limit ) throws ScmException { SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ); StringBuilder dateInterval = new StringBuilder(); // TRICK: Mercurial 1.9.3 don't accept 1970-01-01 dateInterval.append( dateFormat.format( startDate == null ? new Date( 1000L * 60 * 60 * 24 ) : startDate ) ); // From 2. Jan 1970 dateInterval.append( " to " ); dateInterval.append( dateFormat.format( endDate == null ? new Date() : endDate ) ); // Upto now List<String> cmd = new ArrayList<String>(); cmd.addAll( Arrays.asList( HgCommandConstants.LOG_CMD, HgCommandConstants.TEMPLATE_OPTION, HgCommandConstants.TEMPLATE_FORMAT, HgCommandConstants.NO_MERGES_OPTION, HgCommandConstants.DATE_OPTION, dateInterval.toString() ) ); if ( limit != null && limit > 0 ) { cmd.add( HgCommandConstants.LIMIT_OPTION ); cmd.add( Integer.toString( limit ) ); } HgChangeLogConsumer consumer = new HgChangeLogConsumer( getLogger(), datePattern ); ScmResult result = HgUtils.execute( consumer, getLogger(), fileSet.getBasedir(), cmd.toArray( new String[cmd.size()] ) ); List<ChangeSet> logEntries = consumer.getModifications(); ChangeLogSet changeLogSet = new ChangeLogSet( logEntries, startDate, endDate ); return new ChangeLogScmResult( changeLogSet, result ); }
private ChangeLogScmResult executeChangeLogCommand( ScmFileSet fileSet, Date startDate, Date endDate, String datePattern, Integer limit ) throws ScmException { SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ); StringBuilder dateInterval = new StringBuilder(); // TRICK: Mercurial 1.9.3 don't accept 1970-01-01 dateInterval.append( dateFormat.format( startDate == null ? new Date( 1000L * 60 * 60 * 24 ) : startDate ) ); // From 2. Jan 1970 dateInterval.append( " to " ); dateInterval.append( dateFormat.format( endDate == null ? new Date() : endDate ) ); // Upto now List<String> cmd = new ArrayList<String>(); cmd.addAll( Arrays.asList( HgCommandConstants.LOG_CMD, HgCommandConstants.TEMPLATE_OPTION, HgCommandConstants.TEMPLATE_FORMAT, HgCommandConstants.NO_MERGES_OPTION, HgCommandConstants.DATE_OPTION, dateInterval.toString() ) ); if ( limit != null && limit > 0 ) { cmd.add( HgCommandConstants.LIMIT_OPTION ); cmd.add( Integer.toString( limit ) ); } HgChangeLogConsumer consumer = new HgChangeLogConsumer( getLogger(), datePattern ); ScmResult result = HgUtils.execute( consumer, getLogger(), fileSet.getBasedir(), cmd.toArray( new String[cmd.size()] ) ); List<ChangeSet> logEntries = consumer.getModifications(); ChangeLogSet changeLogSet = new ChangeLogSet( logEntries, startDate, endDate ); return new ChangeLogScmResult( changeLogSet, result ); }
return new ChangeLogScmResult( cl.toString(), "The cvs command failed.", logListener.getStderr().toString(), false ); return new ChangeLogScmResult( cl.toString(), "The cvs command failed.", logListener.getStdout().toString(), false ); changeLogSet.setEndVersion( endVersion ); return new ChangeLogScmResult( cl.toString(), changeLogSet );
protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository r, ScmFileSet f, Date startDate, Date endDate, ScmBranch branch, String datePattern ) throws ScmException { List<ChangeSet> changeLogs = new ArrayList<ChangeSet>(); Iterator<File> iter = f.getFileList().iterator(); if ( !iter.hasNext() ) { List<File> dir = new ArrayList<File>(); // No files to iterate dir.add( f.getBasedir() ); iter = dir.iterator(); } TfsCommand command = null; // tf history takes only one file arg while ( iter.hasNext() ) { TfsChangeLogConsumer out = new TfsChangeLogConsumer( getLogger() ); ErrorStreamConsumer err = new ErrorStreamConsumer(); command = createCommand( r, f, ( (File) iter.next() ) ); int status = command.execute( out, err ); if ( status != 0 || ( !out.hasBeenFed() && err.hasBeenFed() ) ) { return new ChangeLogScmResult( command.getCommandString(), "Error code for TFS changelog command - " + status, err.getOutput(), false ); } changeLogs.addAll( out.getLogs() ); } return new ChangeLogScmResult( command.getCommandString(), new ChangeLogSet( changeLogs, startDate, endDate ) ); }
protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository r, ScmFileSet f, Date startDate, Date endDate, ScmBranch branch, String datePattern ) throws ScmException { List<ChangeSet> changeLogs = new ArrayList<ChangeSet>(); Iterator<File> iter = f.getFileList().iterator(); if ( !iter.hasNext() ) { List<File> dir = new ArrayList<File>(); // No files to iterate dir.add( f.getBasedir() ); iter = dir.iterator(); } TfsCommand command = null; // tf history takes only one file arg while ( iter.hasNext() ) { TfsChangeLogConsumer out = new TfsChangeLogConsumer( getLogger() ); ErrorStreamConsumer err = new ErrorStreamConsumer(); command = createCommand( r, f, ( (File) iter.next() ) ); int status = command.execute( out, err ); if ( status != 0 || ( !out.hasBeenFed() && err.hasBeenFed() ) ) { return new ChangeLogScmResult( command.getCommandString(), "Error code for TFS changelog command - " + status, err.getOutput(), false ); } changeLogs.addAll( out.getLogs() ); } return new ChangeLogScmResult( command.getCommandString(), new ChangeLogSet( changeLogs, startDate, endDate ) ); }
changeLogSet.setStartVersion( startVersion ); changeLogSet.setEndVersion( endVersion ); return new ChangeLogScmResult( changeLogSet, result );
/** * {@inheritDoc} */ protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repo, ScmFileSet fileSet, Date startDate, Date endDate, ScmBranch branch, String datePattern ) throws ScmException { SvnJavaScmProviderRepository javaRepo = (SvnJavaScmProviderRepository) repo; SVNRevision startRevision = ( startDate != null ) ? SVNRevision.create( startDate ) : SVNRevision.UNDEFINED; SVNRevision endRevision = ( endDate != null ) ? SVNRevision.create( endDate ) : SVNRevision.HEAD; try { SVNURL url = javaRepo.getSvnUrl(); if ( branch != null ) { url = SVNURL.parseURIEncoded( SvnTagBranchUtils.resolveBranchUrl( javaRepo, branch ) ); } ChangeLogHandler handler = new ChangeLogHandler( startDate, endDate ); SvnJavaUtil.changelog( javaRepo.getClientManager(), url, startRevision, endRevision, true, // stopOnCopy true, // reportPaths handler ); return new ChangeLogScmResult( SvnJavaScmProvider.COMMAND_LINE, handler.getChangeSets() ); } catch ( SVNException e ) { return new ChangeLogScmResult( SvnJavaScmProvider.COMMAND_LINE, "SVN Changelog failed.", e.getMessage(), false ); } }
return new ChangeLogScmResult( cl.toString(), "The cvs command failed.", stderr.getOutput(), false ); changeLogSet.setEndVersion( endVersion ); return new ChangeLogScmResult( cl.toString(), changeLogSet );
protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repo, ScmFileSet fileSet, Date startDate, Date endDate, ScmBranch branch, String datePattern, ScmVersion startVersion, ScmVersion endVersion, Integer limit, ScmVersion version ) throws ScmException { Commandline cl = createCommandLine( (GitScmProviderRepository) repo, fileSet.getBasedir(), branch, startDate, endDate, startVersion, endVersion, limit, version ); GitChangeLogConsumer consumer = new GitChangeLogConsumer( getLogger(), datePattern ); CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer(); int exitCode; exitCode = GitCommandLineUtils.execute( cl, consumer, stderr, getLogger() ); if ( exitCode != 0 ) { return new ChangeLogScmResult( cl.toString(), "The git-log command failed.", stderr.getOutput(), false ); } ChangeLogSet changeLogSet = new ChangeLogSet( consumer.getModifications(), startDate, endDate ); changeLogSet.setStartVersion( startVersion ); changeLogSet.setEndVersion( endVersion ); return new ChangeLogScmResult( cl.toString(), changeLogSet ); }
protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repo, ScmFileSet fileSet, Date startDate, Date endDate, ScmBranch branch, String datePattern, ScmVersion startVersion, ScmVersion endVersion, Integer limit, ScmVersion version ) throws ScmException { Commandline cl = createCommandLine( (GitScmProviderRepository) repo, fileSet.getBasedir(), branch, startDate, endDate, startVersion, endVersion, limit, version ); GitChangeLogConsumer consumer = new GitChangeLogConsumer( getLogger(), datePattern ); CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer(); int exitCode; exitCode = GitCommandLineUtils.execute( cl, consumer, stderr, getLogger() ); if ( exitCode != 0 ) { return new ChangeLogScmResult( cl.toString(), "The git-log command failed.", stderr.getOutput(), false ); } ChangeLogSet changeLogSet = new ChangeLogSet( consumer.getModifications(), startDate, endDate ); changeLogSet.setStartVersion( startVersion ); changeLogSet.setEndVersion( endVersion ); return new ChangeLogScmResult( cl.toString(), changeLogSet ); }
/** {@inheritDoc} */ protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repository, ScmFileSet fileSet, Date startDate, Date endDate, ScmBranch branch, String datePattern ) throws ScmException { VssScmProviderRepository repo = (VssScmProviderRepository) repository; Commandline cl = buildCmdLine( repo, fileSet, startDate, endDate ); if ( getLogger().isInfoEnabled() ) { getLogger().info( "Executing: " + cl ); getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() ); } VssChangeLogConsumer consumer = new VssChangeLogConsumer( repo, datePattern, getLogger() ); CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer(); int exitCode = VssCommandLineUtils.executeCommandline( cl, consumer, stderr, getLogger() ); if ( exitCode != 0 ) { return new ChangeLogScmResult( cl.toString(), "The vss command failed.", stderr.getOutput(), false ); } return new ChangeLogScmResult( cl.toString(), new ChangeLogSet( consumer.getModifications(), startDate, endDate ) ); }
/** {@inheritDoc} */ protected ChangeLogScmResult executeChangeLogCommand( ScmProviderRepository repository, ScmFileSet fileSet, Date startDate, Date endDate, ScmBranch branch, String datePattern ) throws ScmException { VssScmProviderRepository repo = (VssScmProviderRepository) repository; Commandline cl = buildCmdLine( repo, fileSet, startDate, endDate ); if ( getLogger().isInfoEnabled() ) { getLogger().info( "Executing: " + cl ); getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() ); } VssChangeLogConsumer consumer = new VssChangeLogConsumer( repo, datePattern, getLogger() ); CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer(); int exitCode = VssCommandLineUtils.executeCommandline( cl, consumer, stderr, getLogger() ); if ( exitCode != 0 ) { return new ChangeLogScmResult( cl.toString(), "The vss command failed.", stderr.getOutput(), false ); } return new ChangeLogScmResult( cl.toString(), new ChangeLogSet( consumer.getModifications(), startDate, endDate ) ); }
return new ChangeLogScmResult( cl.toString(), "The 'stcmd' command failed.", stderr.getOutput(), false ); return new ChangeLogScmResult( cl.toString(), new ChangeLogSet( consumer.getModifications(), startDate, endDate ) );
return new ChangeLogScmResult( cl.toString(), "The 'stcmd' command failed.", stderr.getOutput(), false ); return new ChangeLogScmResult( cl.toString(), new ChangeLogSet( consumer.getModifications(), startDate, endDate ) );
/** {@inheritDoc} */ protected ScmResult executeAddCommand( ScmProviderRepository repository, ScmFileSet fileSet, String message, boolean binary ) throws ScmException { VssScmProviderRepository repo = (VssScmProviderRepository) repository; if ( fileSet.getFileList().isEmpty() ) { throw new ScmException( "You must provide at least one file/directory to add" ); } Commandline cl = buildCmdLine( repo, fileSet ); VssAddConsumer consumer = new VssAddConsumer( getLogger() ); CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer(); if ( getLogger().isInfoEnabled() ) { getLogger().info( "Executing: " + cl ); getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() ); } int exitCode = VssCommandLineUtils.executeCommandline( cl, consumer, stderr, getLogger() ); if ( exitCode != 0 ) { return new ChangeLogScmResult( cl.toString(), "The vss command failed.", stderr.getOutput(), false ); } return new AddScmResult( cl.toString(), consumer.getAddedFiles() ); }
/** {@inheritDoc} */ protected ScmResult executeAddCommand( ScmProviderRepository repository, ScmFileSet fileSet, String message, boolean binary ) throws ScmException { VssScmProviderRepository repo = (VssScmProviderRepository) repository; if ( fileSet.getFileList().isEmpty() ) { throw new ScmException( "You must provide at least one file/directory to add" ); } Commandline cl = buildCmdLine( repo, fileSet ); VssAddConsumer consumer = new VssAddConsumer( getLogger() ); CommandLineUtils.StringStreamConsumer stderr = new CommandLineUtils.StringStreamConsumer(); if ( getLogger().isInfoEnabled() ) { getLogger().info( "Executing: " + cl ); getLogger().info( "Working directory: " + cl.getWorkingDirectory().getAbsolutePath() ); } int exitCode = VssCommandLineUtils.executeCommandline( cl, consumer, stderr, getLogger() ); if ( exitCode != 0 ) { return new ChangeLogScmResult( cl.toString(), "The vss command failed.", stderr.getOutput(), false ); } return new AddScmResult( cl.toString(), consumer.getAddedFiles() ); }
return new ChangeLogScmResult( cl.toString(), "The cleartool command failed.", stderr.getOutput(), false ); return new ChangeLogScmResult( cl.toString(), new ChangeLogSet( consumer.getModifications(), startDate, endDate ) );
return new ChangeLogScmResult( cl.toString(), "The svn command failed.", stderr.getOutput(), false ); changeLogSet.setEndVersion( endVersion ); return new ChangeLogScmResult( cl.toString(), changeLogSet );
/** * Create a new ScmProviderStub with bogus (not null) attributes */ public ScmProviderStub() { setScmSpecificFilename( "" ); setAddScmResult( new AddScmResult( "", Collections.<ScmFile>emptyList() ) ); setBranchScmResult( new BranchScmResult( "", Collections.<ScmFile>emptyList() ) ); setChangeLogScmResult( new ChangeLogScmResult( "", "", "", true ) ); setCheckInScmResult( new CheckInScmResult( "", "", "", true ) ); setCheckOutScmResult( new CheckOutScmResult( "", "", "", true ) ); setDiffScmResult( new DiffScmResult( "", "", "", true ) ); setEditScmResult( new EditScmResult( "", "", "", true ) ); setExportScmResult( new ExportScmResult( "", "", "", true ) ); setRemoveScmResult( new RemoveScmResult( "", "", "", true ) ); setStatusScmResult( new StatusScmResult( "", "", "", true ) ); setTagScmResult( new TagScmResult( "", "", "", true ) ); setUnEditScmResult( new UnEditScmResult( "", "", "", true ) ); setUpdateScmResult( new UpdateScmResult( "", "", "", true ) ); setBlameScmResult( new BlameScmResult( "", "", "", true ) ); setMkdirScmResult( new MkdirScmResult( "", "", "", true ) ); }
/** * Create a new ScmProviderStub with bogus (not null) attributes */ public ScmProviderStub() { setScmSpecificFilename( "" ); setAddScmResult( new AddScmResult( "", Collections.<ScmFile>emptyList() ) ); setBranchScmResult( new BranchScmResult( "", Collections.<ScmFile>emptyList() ) ); setChangeLogScmResult( new ChangeLogScmResult( "", "", "", true ) ); setCheckInScmResult( new CheckInScmResult( "", "", "", true ) ); setCheckOutScmResult( new CheckOutScmResult( "", "", "", true ) ); setDiffScmResult( new DiffScmResult( "", "", "", true ) ); setEditScmResult( new EditScmResult( "", "", "", true ) ); setExportScmResult( new ExportScmResult( "", "", "", true ) ); setRemoveScmResult( new RemoveScmResult( "", "", "", true ) ); setStatusScmResult( new StatusScmResult( "", "", "", true ) ); setTagScmResult( new TagScmResult( "", "", "", true ) ); setUnEditScmResult( new UnEditScmResult( "", "", "", true ) ); setUntagScmResult( new UntagScmResult( "", "", "", true ) ); setUpdateScmResult( new UpdateScmResult( "", "", "", true ) ); setBlameScmResult( new BlameScmResult( "", "", "", true ) ); setMkdirScmResult( new MkdirScmResult( "", "", "", true ) ); }