use of org.apache.maven.scm.ChangeFile in project maven-plugins by apache.
the class ChangeLogHandler method startElement.
/**
* {@inheritDoc}
*/
public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
bufData = "";
if ("file".equals(qName)) {
bufFile = new ChangeFile("");
} else if ("changelog-entry".equals(qName)) {
bufEntry = new ChangeSet();
} else if ("date".equals(qName)) {
currentPattern = attributes.getValue("pattern");
if (currentPattern == null) {
currentPattern = "yyyy-MM-dd";
}
} else if ("time".equals(qName)) {
currentPattern = attributes.getValue("pattern");
if (currentPattern == null) {
currentPattern = "HH:mm:ss";
}
} else if ("changeset".equals(qName)) {
bufEntries = new LinkedList<ChangeSet>();
currentPattern = attributes.getValue("datePattern");
if (currentPattern == null) {
currentPattern = "yyyy-MM-dd";
}
SimpleDateFormat formatter = new SimpleDateFormat(currentPattern);
String start = attributes.getValue("start");
String end = attributes.getValue("end");
Date startDate = null;
Date endDate = null;
if (start != null) {
try {
startDate = formatter.parse(start);
} catch (ParseException e) {
throw new SAXException("Can't parse start date '" + start + "'.", e);
}
}
if (end != null) {
try {
endDate = formatter.parse(end);
} catch (ParseException e) {
throw new SAXException("Can't parse end date '" + end + "'.", e);
}
}
bufSet = new ChangeLogSet(bufEntries, startDate, endDate);
String startVersion = attributes.getValue("startVersion");
if (startVersion != null) {
bufSet.setStartVersion(new ScmTag(startVersion));
}
String endVersion = attributes.getValue("endVersion");
if (endVersion != null) {
bufSet.setEndVersion(new ScmTag(endVersion));
}
}
}
use of org.apache.maven.scm.ChangeFile in project maven-plugins by apache.
the class ChangeLogReport method filter.
private void filter(List<ChangeSet> sets, List<Pattern> includes, List<Pattern> excludes) {
Iterator<ChangeSet> it = sets.iterator();
while (it.hasNext()) {
ChangeSet changeSet = it.next();
List<ChangeFile> files = changeSet.getFiles();
Iterator<ChangeFile> iterator = files.iterator();
while (iterator.hasNext()) {
ChangeFile changeFile = iterator.next();
String name = changeFile.getName();
if (!isIncluded(includes, name) || isExcluded(excludes, name)) {
iterator.remove();
}
}
if (files.isEmpty()) {
it.remove();
}
}
}
use of org.apache.maven.scm.ChangeFile in project maven-plugins by apache.
the class DeveloperActivityReport method countDevFiles.
/**
* counts the number of files changed by each developer
*
* @param entries the change log entries used to search and count file changes
*/
private void countDevFiles(Collection<ChangeSet> entries) {
for (ChangeSet entry : entries) {
String developer = entry.getAuthor();
Map<String, ChangeFile> filesMap = files.get(developer);
if (filesMap == null) {
filesMap = new HashMap<String, ChangeFile>();
files.put(developer, filesMap);
}
for (ChangeFile file : entry.getFiles()) {
filesMap.put(file.getName(), file);
}
}
}
use of org.apache.maven.scm.ChangeFile in project maven-plugins by apache.
the class FileActivityReport method doRows.
/**
* generates the row details for the file activity report
*
* @param set the changelog set to generate a report with
* @param sink the report formatting tool
*/
private void doRows(ChangeLogSet set, Sink sink) {
List<List<ChangeFile>> list = getOrderedFileList(set.getChangeSets());
initReportUrls();
for (List<ChangeFile> revision : list) {
ChangeFile file = revision.get(0);
sink.tableRow();
sink.tableCell();
try {
generateLinks(getConnection(), file.getName(), sink);
} catch (Exception e) {
if (getLog().isDebugEnabled()) {
getLog().error(e.getMessage(), e);
} else {
getLog().error(e.getMessage());
}
sink.text(file.getName());
}
sink.tableCell_();
sink.tableCell();
sink.text("" + revision.size());
sink.tableCell_();
sink.tableRow_();
}
}
use of org.apache.maven.scm.ChangeFile in project maven-plugins by apache.
the class FileActivityComparatorTest method testCompareByRevision.
public void testCompareByRevision() {
List<ChangeFile> list1 = new ArrayList<ChangeFile>();
list1.add(new ChangeFile("changefile-1", "123"));
list1.add(new ChangeFile("changefile-1", "234"));
List<ChangeFile> list2 = new ArrayList<ChangeFile>();
list2.add(new ChangeFile("changefile-2", "246"));
list2.add(new ChangeFile("changefile-2", "468"));
assertTrue("Test compare by revision, less than", comparator.compare(list1, list2) < 0);
list1 = new ArrayList<ChangeFile>();
list1.add(new ChangeFile("changefile-1", "246"));
list1.add(new ChangeFile("changefile-1", "468"));
list2 = new ArrayList<ChangeFile>();
list2.add(new ChangeFile("changefile-2", "123"));
list2.add(new ChangeFile("changefile-2", "234"));
assertTrue("Test compare by revision, greater than", comparator.compare(list1, list2) > 0);
}
Aggregations