提交 e526809b 编写于 作者: J Jesse Glick

Make sure the RepositoryBrowser is associated with a ChangeLogSet so we do not...

Make sure the RepositoryBrowser is associated with a ChangeLogSet so we do not need to go back through the build and SCM to find it.
上级 5a435918
......@@ -41,7 +41,7 @@ import org.xml.sax.SAXException;
*/
public abstract class ChangeLogParser {
public ChangeLogSet<? extends Entry> parse(Run build, File changelogFile) throws IOException, SAXException {
public ChangeLogSet<? extends Entry> parse(Run build, RepositoryBrowser<?> browser, File changelogFile) throws IOException, SAXException {
if (build instanceof AbstractBuild && Util.isOverridden(ChangeLogParser.class, getClass(), "parse", AbstractBuild.class, File.class)) {
return parse((AbstractBuild) build, changelogFile);
} else {
......@@ -51,6 +51,6 @@ public abstract class ChangeLogParser {
@Deprecated
public ChangeLogSet<? extends Entry> parse(AbstractBuild build, File changelogFile) throws IOException, SAXException {
return parse((Run) build, changelogFile);
return parse((Run) build, build.getProject().getScm().getEffectiveBrowser(), changelogFile);
}
}
......@@ -59,14 +59,16 @@ public abstract class ChangeLogSet<T extends ChangeLogSet.Entry> implements Iter
* Build whose change log this object represents.
*/
private final Run<?,?> build;
private final RepositoryBrowser</* ideally T */?> browser;
protected ChangeLogSet(Run<?, ?> build) {
protected ChangeLogSet(Run<?,?> build, RepositoryBrowser<?> browser) {
this.build = build;
this.browser = browser;
}
@Deprecated
protected ChangeLogSet(AbstractBuild<?, ?> build) {
this((Run) build);
this((Run) build, build.getParent().getScm().getEffectiveBrowser());
}
@AdaptField(name="build", was=AbstractBuild.class)
......@@ -74,6 +76,10 @@ public abstract class ChangeLogSet<T extends ChangeLogSet.Entry> implements Iter
return build;
}
public RepositoryBrowser<?> getBrowser() {
return browser;
}
/**
* Returns true if there's no change.
*/
......
package hudson.scm;
import hudson.model.Run;
import java.io.IOException;
import java.net.URL;
import java.util.Collections;
import java.util.Iterator;
......@@ -12,7 +14,11 @@ import java.util.Iterator;
*/
final class EmptyChangeLogSet extends ChangeLogSet<ChangeLogSet.Entry> {
/*package*/ EmptyChangeLogSet(Run<?, ?> build) {
super(build);
super(build, new RepositoryBrowser<ChangeLogSet.Entry>() {
@Override public URL getChangeSetLink(ChangeLogSet.Entry changeSet) throws IOException {
return null;
}
});
}
@Override
......
......@@ -37,7 +37,7 @@ public class NullChangeLogParser extends ChangeLogParser {
public static final NullChangeLogParser INSTANCE = new NullChangeLogParser();
@Override public ChangeLogSet<? extends ChangeLogSet.Entry> parse(Run build, File changelogFile) throws IOException, SAXException {
@Override public ChangeLogSet<? extends ChangeLogSet.Entry> parse(Run build, RepositoryBrowser<?> browser, File changelogFile) throws IOException, SAXException {
return ChangeLogSet.createEmpty(build);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册