use of org.jenkinsci.plugins.workflow.cps.replay.ReplayCause in project blueocean-plugin by jenkinsci.
the class PipelineRunImpl method getChangeSet.
@Override
@Nonnull
public Container<BlueChangeSetEntry> getChangeSet() {
// If this run is a replay then return the changesets from the original run
ReplayCause replayCause = run.getCause(ReplayCause.class);
if (replayCause != null) {
Run run = this.run.getParent().getBuildByNumber(replayCause.getOriginalNumber());
if (run == null) {
return Containers.empty(getLink());
}
BlueRun blueRun = BlueRunFactory.getRun(run, parent);
if (blueRun == null) {
return Containers.empty(getLink());
}
return blueRun.getChangeSet();
} else {
Map<String, BlueChangeSetEntry> m = new LinkedHashMap<>();
int cnt = 0;
for (ChangeLogSet<? extends Entry> cs : run.getChangeSets()) {
for (ChangeLogSet.Entry e : cs) {
cnt++;
String id = e.getCommitId();
if (id == null)
id = String.valueOf(cnt);
m.put(id, new ChangeSetResource(organization, e, this));
}
}
return Containers.fromResourceMap(getLink(), m);
}
}
Aggregations