From c93225c42bd7d95ea36b5cb4aaa052677c864fe3 Mon Sep 17 00:00:00 2001 From: Vasili Galka Date: Wed, 26 Aug 2015 11:35:58 +0300 Subject: [PATCH 1/4] Option to choose if depth is sticky User can choose the desired behavior now (like --depth and --set-depth flags in svn) --- src/main/java/hudson/scm/SubversionSCM.java | 40 ++++++++++++++----- .../hudson/scm/subversion/UpdateUpdater.java | 4 +- .../SubversionSCM/ModuleLocation/config.jelly | 3 ++ 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/src/main/java/hudson/scm/SubversionSCM.java b/src/main/java/hudson/scm/SubversionSCM.java index c01c72297..206cd0e72 100755 --- a/src/main/java/hudson/scm/SubversionSCM.java +++ b/src/main/java/hudson/scm/SubversionSCM.java @@ -2669,6 +2669,13 @@ public static final class ModuleLocation extends AbstractDescribableImpl build) { */ public ModuleLocation getExpandedLocation(EnvVars env) { return new ModuleLocation(env.expand(remote), credentialsId, env.expand(getLocalDir()), getDepthOption(), - isIgnoreExternalsOption()); + isDepthSticky(), isIgnoreExternalsOption()); } @Override @@ -2955,7 +2972,7 @@ public static List parse(String[] remoteLocations, String[] cred modules.add(new ModuleLocation(remoteLoc, credentialIds != null && credentialIds.length > i ? credentialIds[i] : null, Util.nullify(localLocations[i]), - depthOptions != null ? depthOptions[i] : null, + depthOptions != null ? depthOptions[i] : null, true, isIgnoreExternals != null && isIgnoreExternals[i])); } } @@ -2990,7 +3007,8 @@ public ModuleLocation getExpandedLocation(Job project) { } } - return new ModuleLocation(returnURL, credentialsId, getLocalDir(), getDepthOption(), isIgnoreExternalsOption()); + return new ModuleLocation(returnURL, credentialsId, getLocalDir(), getDepthOption(), + isDepthSticky(), isIgnoreExternalsOption()); } @Extension diff --git a/src/main/java/hudson/scm/subversion/UpdateUpdater.java b/src/main/java/hudson/scm/subversion/UpdateUpdater.java index 0685e6ce9..c4f891b0b 100755 --- a/src/main/java/hudson/scm/subversion/UpdateUpdater.java +++ b/src/main/java/hudson/scm/subversion/UpdateUpdater.java @@ -155,11 +155,11 @@ public List perform() throws IOException, InterruptedException { switch (svnCommand) { case UPDATE: listener.getLogger().println("Updating " + location.remote + " at revision " + revisionName); - svnuc.doUpdate(local.getCanonicalFile(), r, svnDepth, true, true); + svnuc.doUpdate(local.getCanonicalFile(), r, svnDepth, true, location.isDepthSticky()); break; case SWITCH: listener.getLogger().println("Switching to " + location.remote + " at revision " + revisionName); - svnuc.doSwitch(local.getCanonicalFile(), location.getSVNURL(), r, r, svnDepth, true, true, true); + svnuc.doSwitch(local.getCanonicalFile(), location.getSVNURL(), r, r, svnDepth, true, location.isDepthSticky(), true); break; case CHECKOUT: // This case is handled by the (svnCommand == SvnCommandToUse.CHECKOUT) above. diff --git a/src/main/resources/hudson/scm/SubversionSCM/ModuleLocation/config.jelly b/src/main/resources/hudson/scm/SubversionSCM/ModuleLocation/config.jelly index 8a32abcf1..48be45241 100644 --- a/src/main/resources/hudson/scm/SubversionSCM/ModuleLocation/config.jelly +++ b/src/main/resources/hudson/scm/SubversionSCM/ModuleLocation/config.jelly @@ -51,6 +51,9 @@ THE SOFTWARE. as-it-is + + + From 93934da91b025e074e8cd89aca51565526a7be93 Mon Sep 17 00:00:00 2001 From: Vasili Galka Date: Wed, 9 Sep 2015 14:08:42 +0300 Subject: [PATCH 2/4] Keep old constructor as deprecated for binary backward compatibility. --- src/main/java/hudson/scm/SubversionSCM.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/hudson/scm/SubversionSCM.java b/src/main/java/hudson/scm/SubversionSCM.java index 206cd0e72..c2d1e7558 100755 --- a/src/main/java/hudson/scm/SubversionSCM.java +++ b/src/main/java/hudson/scm/SubversionSCM.java @@ -2711,6 +2711,11 @@ public ModuleLocation(String remote, String local, String depthOption, boolean i this(remote,null,local,depthOption,true,ignoreExternalsOption); } + @Deprecated + public ModuleLocation(String remote, String credentialsId, String local, String depthOption, boolean ignoreExternalsOption) { + this(remote,credentialsId,local,depthOption,true,ignoreExternalsOption); + } + @DataBoundConstructor public ModuleLocation(String remote, String credentialsId, String local, String depthOption, boolean stickyDepth, boolean ignoreExternalsOption) { this.remote = Util.removeTrailingSlash(Util.fixNull(remote).trim()); From 8ab778cf683e4061b4eaae5ff8d8b3031ca27d8d Mon Sep 17 00:00:00 2001 From: Vasili Galka Date: Wed, 9 Sep 2015 15:20:34 +0300 Subject: [PATCH 3/4] Add help file for the new stickyDepth option. --- .../scm/SubversionSCM/ModuleLocation/help-stickyDepth.html | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 src/main/resources/hudson/scm/SubversionSCM/ModuleLocation/help-stickyDepth.html diff --git a/src/main/resources/hudson/scm/SubversionSCM/ModuleLocation/help-stickyDepth.html b/src/main/resources/hudson/scm/SubversionSCM/ModuleLocation/help-stickyDepth.html new file mode 100644 index 000000000..e50d3a9f4 --- /dev/null +++ b/src/main/resources/hudson/scm/SubversionSCM/ModuleLocation/help-stickyDepth.html @@ -0,0 +1,5 @@ +
+ Choose if --set-depth (sticky) or --depth (non-sticky) option should be used for switch and update commands. Default value is sticky. + More information can be found + here. +
From ffcdc6e21ec4ac03701c36f7eb81dc1375912b76 Mon Sep 17 00:00:00 2001 From: Vasili Galka Date: Tue, 6 Oct 2015 19:27:05 +0300 Subject: [PATCH 4/4] Minor fix to documentation. Use instead of . --- .../scm/SubversionSCM/ModuleLocation/help-stickyDepth.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/hudson/scm/SubversionSCM/ModuleLocation/help-stickyDepth.html b/src/main/resources/hudson/scm/SubversionSCM/ModuleLocation/help-stickyDepth.html index e50d3a9f4..f382f783d 100644 --- a/src/main/resources/hudson/scm/SubversionSCM/ModuleLocation/help-stickyDepth.html +++ b/src/main/resources/hudson/scm/SubversionSCM/ModuleLocation/help-stickyDepth.html @@ -1,5 +1,5 @@
- Choose if --set-depth (sticky) or --depth (non-sticky) option should be used for switch and update commands. Default value is sticky. + Choose if --set-depth (sticky) or --depth (non-sticky) option should be used for switch and update commands. Default value is sticky. More information can be found here.