Refine search
/** * Most of the relevant info is on the revision line matching the * 'pattern' string. * * @param line A line of text from the perforce log output */ private void processGetRevision( String line ) { Matcher matcher = REVISION_PATTERN.matcher( line ); if ( !matcher.find() ) { return; } currentChange = new ChangeSet(); currentRevision = matcher.group( 1 ); currentChange.setAuthor( matcher.group( 2 ) ); currentChange.setDate( matcher.group( 3 ), userDatePattern ); status = GET_COMMENT_BEGIN; }
/** * Process the current input line in the GET_COMMENT state. This * state gathers all of the comments that are part of a log entry. * * @param line a line of text from the perforce log output */ private void processGetComment( String line ) { if ( line.equals( COMMENT_DELIMITER ) ) { addEntry( currentChange, new ChangeFile( currentFile, currentChange.getRevision() ) ); status = GET_REVISION; } else { currentChange.setComment( currentChange.getComment() + line + "\n" ); } } }
/** * Add a change log entry to the list (if it's not already there) * with the given file. * * @param entry a {@link ChangeSet} to be added to the list if another * with the same key doesn't exist already. If the entry's author * is null, the entry wont be added * @param file a {@link ChangeFile} to be added to the entry */ private void addEntry( ChangeSet entry, ChangeFile file ) { // do not add if entry is not populated if ( entry.getAuthor() == null ) { return; } // do not add if entry is out of date range if ( startDate != null && entry.getDate().before( startDate ) ) { return; } if ( endDate != null && entry.getDate().after( endDate ) ) { return; } entry.addFile( file ); entries.add( entry ); }
/** * @param date Date the changes were committed * @param comment comment provided at commit time * @param author User who made changes * @param files The ChangeFile list */ public ChangeSet( Date date, String comment, String author, List<ChangeFile> files ) { setDate( date ); setAuthor( author ); setComment( comment ); this.files = files; }
private boolean areEqual( ChangeSet set1, ChangeSet set2 ) { if ( set1.getAuthor().equals( set2.getAuthor() ) && set1.getComment().equals( set2.getComment() ) && set1.getDate().equals( set2.getDate() ) ) { return true; } return false; }
/** * Process the current input line in the Get Comment state. * * @param line a line of text from the VSS log output */ private void processGetComment( String line ) { String[] commentLine = line.split( ":" ); if ( commentLine.length == 2 ) { currentChangeSet.setComment( commentLine[1] ); } //Comment suite on a new line else { String comment = currentChangeSet.getComment(); comment = comment + " " + line; currentChangeSet.setComment( comment ); } }
/** * Process the current input line in the STATUS_RAW_AUTHOR state. This * state gathers all the author information of a log entry. * * @param line a line of text from the git log output */ private void processGetRawAuthor( String line ) { Matcher matcher = RAW_AUTHOR_PATTERN.matcher( line ); if ( !matcher.matches() ) { return; } String author = matcher.group( 1 ); currentChange.setAuthor( author ); String datestring = matcher.group( 2 ); String tz = matcher.group( 3 ); // with --format=raw option (which gets us to this methods), date is always in seconds since beginning of time // even explicit --date=iso is ignored, so we ignore both userDateFormat and GIT_TIMESTAMP_PATTERN here Calendar c = Calendar.getInstance( TimeZone.getTimeZone( tz ) ); c.setTimeInMillis( Long.parseLong( datestring ) * 1000 ); currentChange.setDate( c.getTime() ); status = STATUS_RAW_COMMITTER; }
/** * Process the current input line in the GET_HEADER state. The * author, date, and the revision of the entry are gathered. Note, * Git does not have per-file revisions, instead, the entire * branch is given a single revision number, which is also used for * the revision number of each file. * * @param line A line of text from the git log output */ private void processGetHeader( String line ) { Matcher matcher = HEADER_PATTERN.matcher( line ); if ( !matcher.matches() ) { return; } currentRevision = matcher.group( 1 ); currentChange = new ChangeSet(); currentChange.setRevision( currentRevision ); status = STATUS_GET_AUTHOR; }
private void processChangesLine( String line ) { // Process the changes line, eg: // ---c- (1170) \GPDB\GPDBEAR\pom.xml // ---c- (1171) \GPDB\GPDBResources\pom.xml // ---c- (1167) \GPDB\GPDBWeb\pom.xml // ---c- (1165) \GPDB\pom.xml Matcher matcher = CHANGES_PATTERN.matcher( line ); if ( matcher.find() ) { ChangeSet currentChangeSet = entries.get( currentChangeSetIndex ); String changeFlags = matcher.group( 1 ); // Not used. String fileAlias = matcher.group( 2 ); String file = matcher.group( 3 ); if ( getLogger().isDebugEnabled() ) { getLogger().debug( " Parsing Changes Line : " + line ); getLogger().debug( " changeFlags : " + changeFlags + " Translated to : " + parseFileChangeState( changeFlags ) ); getLogger().debug( " filetAlias : " + fileAlias ); getLogger().debug( " file : " + file ); } ChangeFile changeFile = new ChangeFile( file ); ScmFileStatus status = parseFileChangeState( changeFlags ); changeFile.setAction( status ); currentChangeSet.getFiles().add( changeFile ); } }
/** * Process one line of output from the execution of the "scm xxxx" command. * * @param line The line of output from the external command that has been pumped to us. * @see org.codehaus.plexus.util.cli.StreamConsumer#consumeLine(java.lang.String) */ public void consumeLine( String line ) { super.consumeLine( line ); Matcher matcher = CHANGESET_PATTERN.matcher( line ); if ( matcher.find() ) { String changesetAlias = matcher.group( 1 ); ChangeSet changeSet = new ChangeSet(); changeSet.setRevision( changesetAlias ); entries.add( changeSet ); } } }
private Date getLatestUpdateDate( ChangeLogScmResult changeLogScmResult ) { ChangeLogSet changeLogSet = changeLogScmResult.getChangeLog(); if ( changeLogSet != null ) { List<ChangeSet> changes = changeLogSet.getChangeSets(); if ( changes != null && !changes.isEmpty() ) { long date = 0; for ( ChangeSet change : changes ) { if ( date < change.getDate().getTime() ) { date = change.getDate().getTime(); } } if ( date != 0 ) { return new Date( date ); } } } return null; }
int firstLogSize = firstResult.getChangeLog().getChangeSets().size(); assertTrue( "Unexpected initial log size", firstLogSize >= 1 ); Date timeBeforeSecond = new Date(); //Current time assertEquals( firstLogSize + 1, secondResult.getChangeLog().getChangeSets().size() ); Date currentTime = new Date(); ChangeLogScmResult thirdResult = provider .changeLog( getScmRepository(), fileSet, timeBeforeSecond, currentTime, 0, new ScmBranch( "" ) ); assertEquals( 1, thirdResult.getChangeLog().getChangeSets().size() ); ChangeSet changeset = thirdResult.getChangeLog().getChangeSets().get( 0 ); assertTrue( changeset.getDate().after( timeBeforeSecond ) ); assertEquals( COMMIT_MSG, changeset.getComment() );
startDate = startDate == null ? new Date( 0 ) : startDate; //From 1. Jan 1970 endDate = endDate == null ? new Date() : endDate; //Upto now if ( change.getFiles().size() > 0 ) if ( !change.getDate().before( startDate ) && !change.getDate().after( endDate ) ) ChangeLogSet changeLogSet = new ChangeLogSet( inRangeAndValid, startDate, endDate ); return new ChangeLogScmResult( changeLogSet, result );
result.setChanges( changeLogResult.getChangeLog().getChangeSets() ); for ( ScmFile scmFile : files ) changeFiles.add( new ChangeFile( scmFile.getPath() ) ); ChangeSet dummyChangeSet = new ChangeSet( new Date(), comment, author, changeFiles );
change.setAuthor( scmChangeSet.getAuthor() ); change.setComment( scmChangeSet.getComment() ); if ( scmChangeSet.getDate() != null ) change.setDate( scmChangeSet.getDate().getTime() ); if ( scmChangeSet.getFiles() != null ) for ( Iterator i = scmChangeSet.getFiles().iterator(); i.hasNext(); ) file.setName( f.getName() ); file.setRevision( f.getRevision() );
for ( ChangeSet change : changeLogSet.getChangeSets() ) if ( startDate != null && change.getDate() != null ) if ( startDate.after( change.getDate() ) ) if ( change.containsFilename( currentFile.getPath() ) )
ChangeSet changeSet = new ChangeSet(); changeSet.setAuthor( changelist.getUsername() ); changeSet.setComment( changelist.getDescription().trim() );// p4 adds extra /n and fails TCK changeSet.setDate( changelist.getDate() ); changeSet.setRevision( String.valueOf( changelistSummary.getId() ) ); if ( files != null ) new ChangeFile( file.getDepotPath().getPathString(), String.valueOf( file.getEndRevision() ) ); changeSet.addFile( changeFile ); ChangeLogSet cls = new ChangeLogSet( changeSets, null, null ); cls.setStartVersion( startVersion ); cls.setEndVersion( endVersion ); return new ChangeLogScmResult( command, cls );
currentChange = new ChangeSet(); currentChange.setFiles( new ArrayList<ChangeFile>( 0 ) ); logEntries.add( currentChange ); currentChange.setRevision( currentRevision ); currentChange.setAuthor( tmpLine ); currentChange.setDate( date ); ChangeFile changeFile = new ChangeFile( file, currentRevision ); currentChange.addFile( changeFile ); currentChange.setComment( "" ); StringBuilder comment = new StringBuilder( currentChange.getComment() ); comment.append( line ); comment.append( '\n' ); currentChange.setComment( comment.toString() );
/** * Process the current input line in the Get Comment state. * * @param line a line of text from the cvs log output */ private void processGetComment( String line ) { if ( line.startsWith( START_REVISION ) ) { // add entry, and set state to get revision addEntry( getCurrentChange(), getCurrentFile() ); // new change log entry setCurrentChange( new ChangeSet() ); // same file name, but different rev setCurrentFile( new ChangeFile( getCurrentFile().getName() ) ); setStatus( GET_REVISION ); } else if ( line.startsWith( END_FILE ) ) { addEntry( getCurrentChange(), getCurrentFile() ); setStatus( GET_FILE ); } else { // keep gathering comments getCurrentChange().setComment( getCurrentChange().getComment() + line + "\n" ); } }