diff --git a/src/main/java/hudson/scm/SubversionSCM.java b/src/main/java/hudson/scm/SubversionSCM.java index 4c7e8ec20..0a6e237bd 100755 --- a/src/main/java/hudson/scm/SubversionSCM.java +++ b/src/main/java/hudson/scm/SubversionSCM.java @@ -677,6 +677,7 @@ public void buildEnvVars(AbstractBuild build, Map env) { try { Map revisions = parseSvnRevisionFile(build); Set knownURLs = revisions.keySet(); + Long revHighest = new Long(0); if(svnLocations.length==1) { // for backwards compatibility if there's only a single modulelocation, we also set // SVN_REVISION and SVN_URL without '_n' @@ -685,6 +686,7 @@ public void buildEnvVars(AbstractBuild build, Map env) { if(rev!=null) { env.put("SVN_REVISION",rev.toString()); env.put("SVN_URL",url); + revHighest = rev; } else if (!knownURLs.isEmpty()) { LOGGER.log(WARNING, "no revision found corresponding to {0}; known: {1}", new Object[] {url, knownURLs}); } @@ -696,10 +698,14 @@ public void buildEnvVars(AbstractBuild build, Map env) { if(rev!=null) { env.put("SVN_REVISION_"+(i+1),rev.toString()); env.put("SVN_URL_"+(i+1),url); + if (rev > revHighest) { + revHighest = rev; + } } else if (!knownURLs.isEmpty()) { LOGGER.log(WARNING, "no revision found corresponding to {0}; known: {1}", new Object[] {url, knownURLs}); } } + env.put("SVN_REVISION_HIGHEST", revHighest.toString()); } catch (IOException e) { LOGGER.log(WARNING, "error building environment variables", e);