Skip to content

Commit

Permalink
Reformat Code
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfs committed Aug 21, 2011
1 parent 1e115da commit 058ab9c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
/**
* Action to calculate all changes for a build
* It uses ChangesAggregators to to so.
*
* @author wolfs
*/
public class AllChangesAction implements Action {
Expand All @@ -47,6 +48,7 @@ public class AllChangesAction implements Action {
AllChangesAction(AbstractProject<?, ?> project) {
this.project = project;
}

public String getIconFileName() {
return "notepad.png";
}
Expand All @@ -61,16 +63,17 @@ public String getUrlName() {

/**
* Returns all changes which contribute to a build.
*
* @param build
* @return
*/
public static Multimap<ChangeLogSet.Entry, AbstractBuild> getAllChanges(AbstractBuild build) {
Set<AbstractBuild> builds = getContributingBuilds(build);
Multimap<String,ChangeLogSet.Entry> changes = ArrayListMultimap.create();
Multimap<String, ChangeLogSet.Entry> changes = ArrayListMultimap.create();
for (AbstractBuild changedBuild : builds) {
ChangeLogSet<ChangeLogSet.Entry> changeSet = changedBuild.getChangeSet();
for (ChangeLogSet.Entry entry : changeSet) {
changes.put(entry.getCommitId()+entry.getMsgAnnotated()+entry.getTimestamp(), entry);
changes.put(entry.getCommitId() + entry.getMsgAnnotated() + entry.getTimestamp(), entry);
}
}
Multimap<ChangeLogSet.Entry, AbstractBuild> change2Build = HashMultimap.create();
Expand All @@ -85,6 +88,7 @@ public static Multimap<ChangeLogSet.Entry, AbstractBuild> getAllChanges(Abstract

/**
* Uses all ChangesAggregators to calculate the contributing builds
*
* @return all changes which contribute to the given build
*/
public static Set<AbstractBuild> getContributingBuilds(AbstractBuild build) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class DependencyChangesAggregator extends ChangesAggregator {
@Override
public List<AbstractBuild> aggregateBuildsWithChanges(AbstractBuild build) {
ImmutableList.Builder<AbstractBuild> builder = ImmutableList.<AbstractBuild>builder();
Map<AbstractProject,AbstractBuild.DependencyChange> depChanges = build.getDependencyChanges((AbstractBuild) build.getPreviousBuild());
Map<AbstractProject, AbstractBuild.DependencyChange> depChanges = build.getDependencyChanges((AbstractBuild) build.getPreviousBuild());
for (AbstractBuild.DependencyChange depChange : depChanges.values()) {
builder.addAll(depChange.getBuilds());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ public class SubProjectChangesAggregator extends ChangesAggregator {
@Override
public List<AbstractBuild> aggregateBuildsWithChanges(AbstractBuild build) {
AbstractProject project = build.getProject();
List<AbstractProject<?,?>> subProjects = new ArrayList<AbstractProject<?, ?>>();
if(project instanceof FreeStyleProject) {
List<AbstractProject<?, ?>> subProjects = new ArrayList<AbstractProject<?, ?>>();
if (project instanceof FreeStyleProject) {
FreeStyleProject proj = (FreeStyleProject) project;
List<Builder> builders = proj.getBuilders();
for (Builder builder : builders) {
if (builder instanceof TriggerBuilder) {
TriggerBuilder tBuilder = (TriggerBuilder) builder;
for (BlockableBuildTriggerConfig config : tBuilder.getConfigs()) {
for (AbstractProject<?,?> abstractProject : config.getProjectList()) {
for (AbstractProject<?, ?> abstractProject : config.getProjectList()) {
if (config.getBlock() != null) {
subProjects.add( abstractProject);
subProjects.add(abstractProject);
}
}
}
Expand All @@ -64,7 +64,7 @@ public List<AbstractBuild> aggregateBuildsWithChanges(AbstractBuild build) {
}
ArrayList<AbstractBuild> builds = new ArrayList<AbstractBuild>();
for (AbstractProject<?, ?> subProject : subProjects) {
RunList<? extends AbstractBuild<?,?>> subBuildsDuringBuild = subProject.getBuilds().byTimestamp(build.getTimeInMillis(), build.getTimeInMillis() + build.getDuration());
RunList<? extends AbstractBuild<?, ?>> subBuildsDuringBuild = subProject.getBuilds().byTimestamp(build.getTimeInMillis(), build.getTimeInMillis() + build.getDuration());
for (AbstractBuild<?, ?> subBuild : subBuildsDuringBuild) {
List<Cause.UpstreamCause> upstreamCauses = new ArrayList<Cause.UpstreamCause>();
List<Cause> causes = subBuild.getCauses();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ import org.apache.commons.jelly.XMLOutput
import org.dom4j.io.SAXContentHandler
import org.jvnet.localizer.LocaleProvider

f=namespace(lib.FormTagLib)
l=namespace(lib.LayoutTagLib)
t=namespace("/lib/hudson")
st=namespace("jelly:stapler")
f = namespace(lib.FormTagLib)
l = namespace(lib.LayoutTagLib)
t = namespace("/lib/hudson")
st = namespace("jelly:stapler")

private def wrapOutput(Closure viewInstructions) {
def sc = new SAXContentHandler()
Expand All @@ -54,14 +54,14 @@ l.layout(title: _("All Changes")) {
def to = request.getParameter('to')

h1(_("All Changes"))
def builds = Functions.filter(my.project.buildsAsMap,from,to).values()
def builds = Functions.filter(my.project.buildsAsMap, from, to).values()
for (build in builds) {
Multimap<ChangeLogSet.Entry, AbstractBuild> changes = my.getAllChanges(build);
if (changes.empty) {
continue
}
h2() {
a(href:"${my.project.absoluteUrl}/${build.number}/changes",
a(href: "${my.project.absoluteUrl}/${build.number}/changes",
"${build.displayName} (${DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM, LocaleProvider.locale).format(build.timestamp.time)})")
}
ol() {
Expand Down

0 comments on commit 058ab9c

Please sign in to comment.