Search in sources :

Example 6 with ChangeSet

use of org.apache.maven.scm.ChangeSet in project maven-plugins by apache.

the class DeveloperActivityReport method countDevCommits.

/**
     * counts the number of commits of each developer
     *
     * @param entries the change log entries used to search and count developer commits
     */
private void countDevCommits(Collection<ChangeSet> entries) {
    for (ChangeSet entry : entries) {
        String developer = entry.getAuthor();
        List<ChangeSet> list = commits.get(developer);
        if (list == null) {
            list = new LinkedList<ChangeSet>();
            commits.put(developer, list);
        }
        list.add(entry);
    }
}
Also used : ChangeSet(org.apache.maven.scm.ChangeSet)

Example 7 with ChangeSet

use of org.apache.maven.scm.ChangeSet in project maven-plugins by apache.

the class ChangeLogReport method doChangedSetTable.

/**
     * generates the report table showing the SCM log entries
     *
     * @param entries a list of change log entries to generate the report from
     * @param bundle  the resource bundle to retrieve report phrases from
     * @param sink    the report formatting tool
     */
private void doChangedSetTable(Collection<ChangeSet> entries, ResourceBundle bundle, Sink sink) {
    sink.table();
    sink.tableRow();
    sink.tableHeaderCell();
    sink.text(bundle.getString("report.changelog.timestamp"));
    sink.tableHeaderCell_();
    sink.tableHeaderCell();
    sink.text(bundle.getString("report.changelog.author"));
    sink.tableHeaderCell_();
    sink.tableHeaderCell();
    sink.text(bundle.getString("report.changelog.details"));
    sink.tableHeaderCell_();
    sink.tableRow_();
    initReportUrls();
    List<ChangeSet> sortedEntries = new ArrayList<ChangeSet>(entries);
    Collections.sort(sortedEntries, new Comparator<ChangeSet>() {

        public int compare(ChangeSet changeSet0, ChangeSet changeSet1) {
            return changeSet1.getDate().compareTo(changeSet0.getDate());
        }
    });
    for (ChangeSet entry : sortedEntries) {
        doChangedSetDetail(entry, sink);
    }
    sink.table_();
}
Also used : ArrayList(java.util.ArrayList) ChangeSet(org.apache.maven.scm.ChangeSet)

Example 8 with ChangeSet

use of org.apache.maven.scm.ChangeSet in project maven-plugins by apache.

the class ChangeLogReport method filter.

/**
     * filters out unwanted files from the changesets
     */
private void filter(List<ChangeLogSet> changeSets) {
    List<Pattern> include = compilePatterns(includes);
    List<Pattern> exclude = compilePatterns(excludes);
    if (includes == null && excludes == null) {
        return;
    }
    for (ChangeLogSet changeLogSet : changeSets) {
        List<ChangeSet> set = changeLogSet.getChangeSets();
        filter(set, include, exclude);
    }
}
Also used : Pattern(java.util.regex.Pattern) ChangeLogSet(org.apache.maven.scm.command.changelog.ChangeLogSet) ChangeSet(org.apache.maven.scm.ChangeSet)

Example 9 with ChangeSet

use of org.apache.maven.scm.ChangeSet in project maven-plugins by apache.

the class ChangeLogTest method testReadFile.

public void testReadFile() throws Exception {
    List<ChangeLogSet> changedLogs = readChangeLogXml("min-changelog.xml");
    assertNotNull("Test changedSets were parsed", changedLogs);
    assertEquals("Test number of changelog entries", 2, changedLogs.size());
    ChangeLogSet changelogSets = changedLogs.get(0);
    assertEquals("Test number of revisions on changelog 1", 2, changelogSets.getChangeSets().size());
    ChangeSet changeSet = changelogSets.getChangeSets().get(0);
    assertEquals("Test changelog 1 set 1 date/time", "1977-08-06 05:30:00", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(changeSet.getDate()));
    assertEquals("Test changelog 1 set 1 author", "Edwin Punzalan", changeSet.getAuthor());
    assertEquals("Test changelog 1 set 1 msg", "First commit msg", changeSet.getComment());
    assertEquals("Test changelog 1 set 1 files", 1, changeSet.getFiles().size());
    ChangeFile changeFile = changeSet.getFiles().get(0);
    assertEquals("Test changelog 1 set 1 file 1 filename", "/path/to/file.extension", changeFile.getName());
    assertEquals("Test changelog 1 set 1 file 1 revision", "1", changeFile.getRevision());
    changeSet = changelogSets.getChangeSets().get(1);
    assertEquals("Test changelog 1 set 2 date/time", "2005-02-24 21:30:00", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(changeSet.getDate()));
    assertEquals("Test changelog 1 set 2 author", "Edwin Punzalan", changeSet.getAuthor());
    assertEquals("Test changelog 1 set 2 msg", "Second commit msg", changeSet.getComment());
    assertEquals("Test changelog 1 set 2 files", 2, changeSet.getFiles().size());
    changeFile = changeSet.getFiles().get(0);
    assertEquals("Test changelog 1 set 2 file 1 filename", "/path/to/file.extension", changeFile.getName());
    assertEquals("Test changelog 1 set 2 file 1 revision", "2", changeFile.getRevision());
    changeFile = changeSet.getFiles().get(1);
    assertEquals("Test changelog 1 set 2 file 2 filename", "/path/to/file2.extension", changeFile.getName());
    assertEquals("Test changelog 1 set 2 file 2 revision", "2", changeFile.getRevision());
    changelogSets = changedLogs.get(1);
    assertEquals("Test number of revisions on changelog 2", 2, changelogSets.getChangeSets().size());
    changeSet = changelogSets.getChangeSets().get(0);
    assertEquals("Test changelog 2 set 1 date/time", "2005-02-25 22:45:00", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(changeSet.getDate()));
    assertEquals("Test changelog 2 set 1 author", "Keogh Edrich Punzalan", changeSet.getAuthor());
    assertEquals("Test changelog 2 set 1 msg", "Third commit msg", changeSet.getComment());
    assertEquals("Test changelog 2 set 1 files", 1, changeSet.getFiles().size());
    changeFile = changeSet.getFiles().get(0);
    assertEquals("Test changelog 2 set 1 file 1 filename", "/path/to/file.extension", changeFile.getName());
    assertEquals("Test changelog 2 set 1 file 1 revision", "3", changeFile.getRevision());
    changeSet = changelogSets.getChangeSets().get(1);
    assertEquals("Test changelog 2 set 2 date/time", "2100-02-25 05:30:00", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(changeSet.getDate()));
    assertEquals("Test changelog 2 set 2 author", "Keogh Edrich Punzalan", changeSet.getAuthor());
    assertEquals("Test changelog 2 set 2 msg", "Last commit msg", changeSet.getComment());
    assertEquals("Test changelog 2 set 2 files", 2, changeSet.getFiles().size());
    changeFile = changeSet.getFiles().get(0);
    assertEquals("Test changelog 2 set 2 file 1 filename", "/path/to/file.extension", changeFile.getName());
    assertEquals("Test changelog 2 set 2 file 1 revision", "4", changeFile.getRevision());
    changeFile = changeSet.getFiles().get(1);
    assertEquals("Test changelog 2 set 2 file 2 filename", "/path/to/file2.extension", changeFile.getName());
    assertEquals("Test changelog 2 set 2 file 2 revision", "4", changeFile.getRevision());
}
Also used : ChangeLogSet(org.apache.maven.scm.command.changelog.ChangeLogSet) ChangeFile(org.apache.maven.scm.ChangeFile) ChangeSet(org.apache.maven.scm.ChangeSet) SimpleDateFormat(java.text.SimpleDateFormat)

Aggregations

ChangeSet (org.apache.maven.scm.ChangeSet)9 ChangeFile (org.apache.maven.scm.ChangeFile)6 ChangeLogSet (org.apache.maven.scm.command.changelog.ChangeLogSet)3 SimpleDateFormat (java.text.SimpleDateFormat)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 ParseException (java.text.ParseException)1 Date (java.util.Date)1 Pattern (java.util.regex.Pattern)1 ScmTag (org.apache.maven.scm.ScmTag)1 SAXException (org.xml.sax.SAXException)1