/** * Copyright (c) 2010 Perforce Software. All rights reserved. */ package com.perforce.maven.scm.provider.p4.command.blame; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.maven.scm.command.blame.BlameLine; import com.perforce.maven.scm.provider.p4.command.P4Result; import com.perforce.p4java.core.file.IFileAnnotation; import com.perforce.p4java.core.file.IFileRevisionData; import com.perforce.p4java.core.file.IFileSpec; /** * This class handles the result from the Perforce annotate command. */ public class P4BlameResult extends P4Result { /** The lines. */ private List<BlameLine> blameLines = new ArrayList<BlameLine>(); /** The dates. */ private Map<String, Date> dates = new HashMap<String, Date>(); /** The authors. */ private Map<String, String> authors = new HashMap<String, String>(); /** * @see com.perforce.maven.scm.provider.p4.command.P4Result#processMessage (java.lang.String) */ @Override public String processMessage( String message ) { return null; } /** * Extracts file annotation info as BlameLine objects. * * @param fileAnnotations the file annotations */ public void processBlameLines( List<IFileAnnotation> fileAnnotations ) { if ( fileAnnotations != null ) { for ( IFileAnnotation fileAnnotation : fileAnnotations ) { if ( fileAnnotation != null ) { blameLines.add( new BlameLine( null, String.valueOf( fileAnnotation.getUpper() ), null ) ); } } } } /** * Extracts dates and authors from revision history map. * * @param revisionMap the revision map */ public void processRevisionHistory( Map<IFileSpec, List<IFileRevisionData>> revisionMap ) { if ( revisionMap != null ) { for ( Map.Entry<IFileSpec, List<IFileRevisionData>> entry : revisionMap.entrySet() ) { List<IFileRevisionData> revisions = entry.getValue(); for ( IFileRevisionData revision : revisions ) { dates.put( String.valueOf( revision.getRevision() ), revision.getDate() ); authors.put( String.valueOf( revision.getRevision() ), revision.getUserName() ); } } } } /** * Gets the blame lines. * * @return the blame lines */ public List<BlameLine> getBlameLines() { return blameLines; } /** * Gets the author. * * @param revision the revision * @return the author */ public String getAuthor( String revision ) { return authors.get( revision ); } /** * Gets the date. * * @param revision the revision * @return the date */ public Date getDate( String revision ) { return dates.get( revision ); } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 9533 | dantran | source format | ||
#1 | 9519 | dantran | folder rename to match with its artifactId | ||
//guest/dantran/p4maven/com.perforce.maven/src/main/java/com/perforce/maven/scm/provider/p4/command/blame/P4BlameResult.java | |||||
#1 | 9167 | dantran |
Populate //guest/dantran/p4maven/... from //guest/perforce_software/p4maven/main/.... |
||
//guest/perforce_software/p4maven/main/com.perforce.maven/src/main/java/com/perforce/maven/scm/provider/p4/command/blame/P4BlameResult.java | |||||
#1 | 8496 | Matt Attaway | Move P4Ant and P4Maven into their proper homes | ||
//public/perforce/p4maven/main/com.perforce.maven/src/main/java/com/perforce/maven/scm/provider/p4/command/blame/P4BlameResult.java | |||||
#1 | 8270 | Matt Attaway | Initial add of P4Maven source code |