From e4ba0b365986b1da7c04c881b5edf33df3c4f826 Mon Sep 17 00:00:00 2001 From: Christian Wolfgang Date: Wed, 25 Sep 2013 12:59:59 +0200 Subject: [PATCH] [fixed JENKINS-19740] Added postCheckout for SCMs --- core/src/main/java/hudson/model/AbstractBuild.java | 4 ++++ core/src/main/java/hudson/scm/SCM.java | 7 +++++++ 2 files changed, 11 insertions(+) diff --git a/core/src/main/java/hudson/model/AbstractBuild.java b/core/src/main/java/hudson/model/AbstractBuild.java index 522cc47829..256c59b7d7 100644 --- a/core/src/main/java/hudson/model/AbstractBuild.java +++ b/core/src/main/java/hudson/model/AbstractBuild.java @@ -667,6 +667,10 @@ public abstract class AbstractBuild

,R extends Abs } catch (Exception e) { throw new IOException2("Failed to parse changelog",e); } + + // Get a chance to do something after checkout and changelog is done + scm.postCheckout( build, launcher, build.getWorkspace(), listener ); + return; } } catch (AbortException e) { diff --git a/core/src/main/java/hudson/scm/SCM.java b/core/src/main/java/hudson/scm/SCM.java index f6890b6f75..2b243d3ca5 100644 --- a/core/src/main/java/hudson/scm/SCM.java +++ b/core/src/main/java/hudson/scm/SCM.java @@ -420,6 +420,13 @@ public abstract class SCM implements Describable, ExtensionPoint { */ public abstract boolean checkout(AbstractBuild build, Launcher launcher, FilePath workspace, BuildListener listener, File changelogFile) throws IOException, InterruptedException; + /** + * Get a chance to do operations after the workspace i checked out and the changelog is written. + */ + public void postCheckout(AbstractBuild build, Launcher launcher, FilePath workspace, BuildListener listener) throws IOException, InterruptedException { + /* Default implementation is noop */ + } + /** * Adds environmental variables for the builds to the given map. * -- GitLab