public void removeEntriesWithPathForAuthor(String path, String author) { if (logEntries == null || logEntries.isEmpty()) { return; } int count = logEntries.size(); int i = 0; while (i < count) { LogEntry logEntry = logEntries.get(i); if (!logEntry.getAuthor().equals(author)) { i++; continue; } logEntry.removeEntriesWithPath(path); if (logEntry.isEmpty()) { logEntries.remove(logEntry); count--; continue; } i++; } isOrdered = false; }
public void removeLogEntriesWithRevisionLowerThan(int revision) { List<LogEntry> logEntries = getOrderedLogEntries(); if (logEntries.isEmpty()) { return; } int count = this.logEntries.size(); int i = 0; while (i < count) { LogEntry entry = this.logEntries.get(i); if (entry.getRevision() < revision) { this.logEntries.remove(entry); count--; continue; } i++; } isOrdered = false; }
public void removeEntriesWithPath(String path) { if (logEntries == null || logEntries.isEmpty()) { return; } int count = logEntries.size(); int i = 0; while (i < count) { LogEntry logEntry = logEntries.get(i); logEntry.removeEntriesWithPath(path); if (logEntry.isEmpty()) { logEntries.remove(logEntry); count--; continue; } i++; } isOrdered = false; }
private void writeChanges(PrintWriter out) { List<String> authors = getAuthors(); for (String author : authors) { List<LogEntry> logEntries = getOrderedAuthorLogEntries(author); if (logEntries == null || logEntries.isEmpty()) { continue; } out.println( MessageFormat.format( AUTHOR_START_NODE, new String[] { author, Integer.toString(getAuthorLogEntriesCount(author)), Integer.toString(logEntries.size()) })); for (LogEntry logEntry : logEntries) { writeLogEntry(out, logEntry); } out.println(AUTHOR_END_NODE); } }
/** * Main entry point for this task. It creates transformation specified by classname attribute, * passes all parameters and executes it. * * @throws BuildException if an error occured */ @Override public void execute() throws BuildException { if (getClassname() == null) { throw new BuildException("Classname of transformation is not set."); } if (getSrcFile() != null && getSrcDir() != null) { throw new BuildException("Both srcFile and srcDir were set."); } if (getDestFile() != null && getDestDir() != null) { throw new BuildException("Both destFile and destDir were set."); } if (!resources.isEmpty() && (getSrcFile() != null || getSrcDir() != null)) { throw new BuildException("Resources can't be combined with srcFile or srcDir."); } initClassloader(); try { TransformationLoader loader = new TransformationLoader(Thread.currentThread().getContextClassLoader()); Transformation transObj = null; try { transObj = loader.getInstance(getClassname()); } catch (InstantiationException ex) { throw new BuildException("Transformation couldn't be instanciated", ex); } catch (IllegalAccessException ex) { throw new BuildException("Transformation couldn't be accessed", ex); } if (transObj == null) { throw new BuildException("Transformation " + getClassname() + " couldn't be loaded"); } List<MappedFile> files = getMappedFiles(); if (files.isEmpty()) { log( "No files specified, " + transObj.getClass().getSimpleName() + " skipped", Project.MSG_INFO); return; } for (MappedFile mf : files) { log("Mapped file " + mf.getFrom() + " to " + mf.getTo(), Project.MSG_VERBOSE); } transObj.setParam("baseDir", getProject().getBaseDir().getPath()); transObj.setMappedFiles(files); transObj.setParams(parameters); for (String key : parameters.keySet()) log( "Parsed parameter " + key + " = " + parameters.get(key) + " (" + parameters.get(key).getClass().getName() + ")", Project.MSG_VERBOSE); try { log( "Executing transformation " + transObj.getClass().getSimpleName() + " on " + mappedFiles.size() + " files"); transObj.execute(); } catch (TransformationException ex) { log("Transformation has failed", ex, Project.MSG_ERR); if (isFailonerror()) { throw new BuildException("Transformation has failed.", ex); } } } finally { restoreClassloader(); } }