Skip to content
Permalink
Browse files
[FIXED JENKINS-10628]SCM build trigger not working correctly with var…
…iables in SVN URL.
  • Loading branch information
sogabe committed Oct 22, 2011
1 parent 522894a commit a9229e4c041149518d2e310337b7035ae3aba086
Showing with 18 additions and 6 deletions.
  1. +15 −3 src/main/java/hudson/scm/SubversionChangeLogBuilder.java
  2. +3 −3 src/main/java/hudson/scm/SubversionSCM.java
@@ -23,6 +23,7 @@
*/
package hudson.scm;

import hudson.EnvVars;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.BuildListener;
@@ -73,16 +74,27 @@
private final BuildListener listener;
private final SubversionSCM scm;
private final AbstractBuild<?,?> build;
private final EnvVars env;

/**
* @deprecated 1.34
*/
public SubversionChangeLogBuilder(AbstractBuild<?,?> build, BuildListener listener, SubversionSCM scm) throws IOException {
this(build, null,listener, scm);
}

/**
* @since 1.34
*/
public SubversionChangeLogBuilder(AbstractBuild<?,?> build, EnvVars env, BuildListener listener, SubversionSCM scm) throws IOException {
previousRevisions = SubversionSCM.parseRevisionFile(build.getPreviousBuild());
thisRevisions = SubversionSCM.parseRevisionFile(build);
this.listener = listener;
this.scm = scm;
this.build = build;

this.env = env;
}

public boolean run(Collection<SubversionSCM.External> externals, Result changeLog) throws IOException, InterruptedException {
boolean changelogFileCreated = false;

@@ -96,7 +108,7 @@ public boolean run(Collection<SubversionSCM.External> externals, Result changeLo
th.setDocumentLocator(DUMMY_LOCATOR);
logHandler.startDocument();

for (ModuleLocation l : scm.getLocations(build)) {
for (ModuleLocation l : scm.getLocations(env, build)) {
changelogFileCreated |= buildModule(l.getURL(), svnlc, logHandler);
}
for(SubversionSCM.External ext : externals) {
@@ -540,7 +540,7 @@ public void buildEnvVars(AbstractBuild<?, ?> build, Map<String, String> env) {
/**
* Called after checkout/update has finished to compute the changelog.
*/
private boolean calcChangeLog(AbstractBuild<?,?> build, File changelogFile, BuildListener listener, List<External> externals) throws IOException, InterruptedException {
private boolean calcChangeLog(AbstractBuild<?,?> build, File changelogFile, BuildListener listener, List<External> externals, EnvVars env) throws IOException, InterruptedException {
if(build.getPreviousBuild()==null) {
// nothing to compare against
return createEmptyChangeLog(changelogFile, listener, "log");
@@ -552,7 +552,7 @@ private boolean calcChangeLog(AbstractBuild<?,?> build, File changelogFile, Buil
OutputStream os = new BufferedOutputStream(new FileOutputStream(changelogFile));
boolean created;
try {
created = new SubversionChangeLogBuilder(build, listener, this).run(externals, new StreamResult(os));
created = new SubversionChangeLogBuilder(build, env, listener, this).run(externals, new StreamResult(os));
} finally {
os.close();
}
@@ -699,7 +699,7 @@ public boolean checkout(AbstractBuild build, Launcher launcher, FilePath workspa
// write out the externals info
new XmlFile(External.XSTREAM,getExternalsFile(build.getProject())).write(externals);

return calcChangeLog(build, changelogFile, listener, externals);
return calcChangeLog(build, changelogFile, listener, externals, env);
}

/**

0 comments on commit a9229e4

Please sign in to comment.