diff --git a/src/main/java/hudson/scm/SubversionSCM.java b/src/main/java/hudson/scm/SubversionSCM.java index db3a7ace..eca41c43 100755 --- a/src/main/java/hudson/scm/SubversionSCM.java +++ b/src/main/java/hudson/scm/SubversionSCM.java @@ -2543,15 +2543,17 @@ public FormValidation doCheckExcludedCommitMessages(@QueryParameter String value * Validates the remote server supports custom revision properties */ @RequirePOST - public FormValidation doCheckRevisionPropertiesSupported(@AncestorInPath Item context, + public FormValidation doCheckExcludedRevprop(@AncestorInPath Item context, @QueryParameter String value, - @QueryParameter String credentialsId, - @QueryParameter String excludedRevprop) throws IOException, ServletException { - String v = Util.fixNull(value).trim(); + @QueryParameter String remoteLocation, + @QueryParameter String remoteCredentialsId + ) throws IOException, ServletException { + + String v = Util.fixNull(remoteLocation).trim(); if (v.length() == 0) return FormValidation.ok(); - String revprop = Util.fixNull(excludedRevprop).trim(); + String revprop = Util.fixNull(value).trim(); if (revprop.length() == 0) return FormValidation.ok(); @@ -2561,7 +2563,7 @@ public FormValidation doCheckRevisionPropertiesSupported(@AncestorInPath Item co try { SVNURL repoURL = SVNURL.parseURIDecoded(new EnvVars(EnvVars.masterEnvVars).expand(v)); - StandardCredentials credentials = lookupCredentials(context, credentialsId, repoURL); + StandardCredentials credentials = lookupCredentials(context, remoteCredentialsId, repoURL); SVNNodeKind node = null; try { node = checkRepositoryPath(context,repoURL, credentials); @@ -3200,10 +3202,10 @@ public ListBoxModel fillCredentialsIdItems(@CheckForNull Item context, String re */ @RequirePOST public FormValidation doCheckRemote(/* TODO unused, delete */StaplerRequest req, @AncestorInPath Item context, - @QueryParameter String remote) { + @QueryParameter String value) { // repository URL is required - String url = Util.fixEmptyAndTrim(remote); + String url = Util.fixEmptyAndTrim(value); if (url == null) { return FormValidation.error(Messages.SubversionSCM_doCheckRemote_required()); } diff --git a/src/main/resources/hudson/scm/SubversionSCM/ModuleLocation/config.jelly b/src/main/resources/hudson/scm/SubversionSCM/ModuleLocation/config.jelly index 9f197aa3..018087bf 100644 --- a/src/main/resources/hudson/scm/SubversionSCM/ModuleLocation/config.jelly +++ b/src/main/resources/hudson/scm/SubversionSCM/ModuleLocation/config.jelly @@ -24,22 +24,14 @@ THE SOFTWARE. + - + + diff --git a/src/main/resources/hudson/scm/SubversionSCM/config.jelly b/src/main/resources/hudson/scm/SubversionSCM/config.jelly index 0f8fbf6d..33d433c4 100644 --- a/src/main/resources/hudson/scm/SubversionSCM/config.jelly +++ b/src/main/resources/hudson/scm/SubversionSCM/config.jelly @@ -56,8 +56,16 @@ THE SOFTWARE. + + + + + + + + - + diff --git a/src/main/resources/hudson/scm/SubversionSCM/excludedRevprop-validation.js b/src/main/resources/hudson/scm/SubversionSCM/excludedRevprop-validation.js new file mode 100644 index 00000000..6142ae12 --- /dev/null +++ b/src/main/resources/hudson/scm/SubversionSCM/excludedRevprop-validation.js @@ -0,0 +1,31 @@ +Behaviour.specify("input[name='_.remote']", 'SubversionSCM.RemoteLocation', 0, function(element) { + element.addEventListener('blur', updateHiddenFields); +}); + +Behaviour.specify("select[name='_.credentialsId'][filldependson='remote']", 'SubversionSCM.CredentialsId', 0, function(element) { + element.addEventListener('change', updateHiddenFields); +}); + +function updateHiddenFields() { + + var remoteLocationElement = document.querySelector("input[name='_.remote']"); + var credentialsIdElement = document.querySelector("select[name='_.credentialsId'][filldependson='remote']"); + var selectedOption = credentialsIdElement.options[credentialsIdElement.selectedIndex].value; + + + var remoteHidden = document.querySelector(".svn-remote-location-hidden"); + var credentialsHidden = document.querySelector(".svn-credentials-id-hidden"); + + if (remoteHidden) { + remoteHidden.value = remoteLocationElement.value; + } + + if (credentialsHidden) { + credentialsHidden.value = selectedOption; + } + + var revPropField = document.querySelector("input[name='_.excludedRevprop']"); + if (revPropField) { + revPropField.dispatchEvent(new Event('change')); + } +}