package org.jenkinsci.plugins.p4.changes; import hudson.model.AbstractBuild; import hudson.scm.ChangeLogSet; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.OutputStreamWriter; import java.io.PrintStream; import java.nio.charset.Charset; import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; import org.kohsuke.stapler.framework.io.WriterOutputStream; // P4CBDChangeSet was based on P4ChangeSet, but has been edited to suit the CBD workflow. public class P4CBDChangeSet extends ChangeLogSet<P4ChangeEntry> { private List<P4ChangeEntry> addedChanges; private List<P4ChangeEntry> removedChanges; private List<P4CBDStructureChangeEntry> structureChanges; private String creationDataDesc; private int creationDataPrevBuild; protected P4CBDChangeSet(AbstractBuild<?, ?> build, List<P4ChangeEntry> addedLogs, List<P4ChangeEntry> removedLogs, List<P4CBDStructureChangeEntry> structureChangeLogs) { super(build); this.addedChanges = Collections.unmodifiableList(addedLogs); this.removedChanges = Collections.unmodifiableList(removedLogs); this.structureChanges = Collections.unmodifiableList(structureChangeLogs); this.creationDataDesc = ""; this.creationDataPrevBuild = 0; P4ChangeCreationData changeCreationAction = build.getAction(P4ChangeCreationData.class); if (changeCreationAction != null) { this.creationDataDesc = changeCreationAction.getDescription(); this.creationDataPrevBuild = changeCreationAction.getPreviousBuildNum(); } } // Class must override the "iterator" function // Not quite sure how to implement this with the 3 change lists. // Doesn't appear to have any impact on the way the code is currently operating. public Iterator<P4ChangeEntry> iterator() { return addedChanges.iterator(); } @Override public boolean isEmptySet() { return (addedChanges.isEmpty() && removedChanges.isEmpty() && structureChanges.isEmpty()); } public boolean isEmptyAddedChangesSet() { return addedChanges.isEmpty(); } public boolean isEmptyRemovedChangesSet() { return removedChanges.isEmpty(); } public boolean isEmptyStructureChangesSet() { return structureChanges.isEmpty(); } public boolean hasAddedChanges() { return !isEmptyAddedChangesSet(); } public boolean hasRemovedChanges() { return !isEmptyRemovedChangesSet(); } public boolean hasStructureChanges() { return !isEmptyStructureChangesSet(); } public List<P4ChangeEntry> getAddedChanges() { return addedChanges; } public List<P4ChangeEntry> getRemovedChanges() { return removedChanges; } public List<P4CBDStructureChangeEntry> getStructureChanges() { return structureChanges; } public String getCreationDataDesc() { return creationDataDesc; } public int getCreationDataPrevBuild() { return creationDataPrevBuild; } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 19234 | dawn_foundry |
Changelogs will now be generated even if the "sync" stage fails. Changelog pages will also display details of which build was compared against to create the changelogs. |
||
#1 | 15235 | dawn_foundry |
Adding a new way to parse the CBD change logs from wschanges, so we can display all the details. Also added a function which creates a fake change log. Useful for testing the xml parsing. |