Search in sources :

Example 31 with ChangeLogSet

use of org.apache.maven.scm.command.changelog.ChangeLogSet in project maven-plugins by apache.

the class ChangeLog method loadChangedSets.

/**
 * parses a previously generated changelog xml document and return its changed sets
 *
 * @param stream the changelog xml document
 * @return changelog sets parsed from the xml document
 * @throws ParserConfigurationException when instantiation of the SAX parser failed
 * @throws SAXException                 when an error occurred while parsing the xml document
 * @throws IOException                  when an error occurred while accessing the xml document
 */
public static List<ChangeLogSet> loadChangedSets(InputStream stream) throws ParserConfigurationException, SAXException, IOException {
    SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
    List<ChangeLogSet> changeLogSets = new ArrayList<ChangeLogSet>();
    parser.parse(stream, new ChangeLogHandler(changeLogSets));
    return changeLogSets;
}
Also used : ChangeLogSet(org.apache.maven.scm.command.changelog.ChangeLogSet) ArrayList(java.util.ArrayList) SAXParser(javax.xml.parsers.SAXParser)

Example 32 with ChangeLogSet

use of org.apache.maven.scm.command.changelog.ChangeLogSet 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 33 with ChangeLogSet

use of org.apache.maven.scm.command.changelog.ChangeLogSet in project maven-plugins by apache.

the class DeveloperActivityReport method doGenerateReport.

/**
 * {@inheritDoc}
 */
protected void doGenerateReport(List<ChangeLogSet> changeLogSets, ResourceBundle bundle, Sink sink) {
    sink.head();
    sink.title();
    sink.text(bundle.getString("report.dev-activity.header"));
    sink.title_();
    sink.head_();
    sink.body();
    sink.section1();
    sink.sectionTitle1();
    sink.text(bundle.getString("report.dev-activity.mainTitle"));
    sink.sectionTitle1_();
    if (developers.isEmpty()) {
        sink.paragraph();
        sink.text(bundle.getString("report.dev-activity.noDevelopers"));
        sink.paragraph_();
    } else {
        for (ChangeLogSet set : changeLogSets) {
            doChangedSets(set, bundle, sink);
        }
    }
    sink.section1_();
    sink.body_();
    sink.flush();
    sink.close();
}
Also used : ChangeLogSet(org.apache.maven.scm.command.changelog.ChangeLogSet)

Example 34 with ChangeLogSet

use of org.apache.maven.scm.command.changelog.ChangeLogSet 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

ChangeLogSet (org.apache.maven.scm.command.changelog.ChangeLogSet)34 ChangeLogScmResult (org.apache.maven.scm.command.changelog.ChangeLogScmResult)22 ChangeSet (org.apache.maven.scm.ChangeSet)16 ScmException (org.apache.maven.scm.ScmException)14 ArrayList (java.util.ArrayList)13 Date (java.util.Date)9 ChangeFile (org.apache.maven.scm.ChangeFile)7 CommandLineUtils (org.codehaus.plexus.util.cli.CommandLineUtils)7 Commandline (org.codehaus.plexus.util.cli.Commandline)6 File (java.io.File)4 IOException (java.io.IOException)4 SimpleDateFormat (java.text.SimpleDateFormat)4 ScmVersion (org.apache.maven.scm.ScmVersion)4 CommandLineException (org.codehaus.plexus.util.cli.CommandLineException)4 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)3 ScmBranch (org.apache.maven.scm.ScmBranch)3 ScmResult (org.apache.maven.scm.ScmResult)3 ScmRevision (org.apache.maven.scm.ScmRevision)3 FileDifference (org.apache.maven.scm.provider.accurev.FileDifference)3 BufferedReader (java.io.BufferedReader)2