Skip to content
Permalink
Browse files

[FIXED JENKINS-10678] Added some missing help files+ fixed a potentia…

…l bug on Windows + some tabs converted to spaces
  • Loading branch information...
rseguy
rseguy committed Aug 30, 2011
1 parent 27b5e1d commit 16c6e05ff1a45d84370fa970cc447dda4a581d02
@@ -2,7 +2,7 @@
* The MIT License
*
* Copyright (c) 2010-2011, Manufacture Francaise des Pneumatiques Michelin,
* Romain Seguy
* Romain Seguy, Jeff Blaisdell
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -70,8 +70,7 @@
*/
public class ListSubversionTagsParameterDefinition extends ParameterDefinition implements Comparable<ListSubversionTagsParameterDefinition> {

private static final long serialVersionUID = 5458217954492915951L;
/**
/**
* The Subversion repository which contains the tags to be listed.
*/
private final String tagsDir;
@@ -135,10 +134,10 @@ public ParameterValue createValue(StaplerRequest req, JSONObject formData) {
@Override
public ParameterValue getDefaultParameterValue() {
if (StringUtils.isEmpty(this.defaultValue)) {
return null;
return null;
}
return new ListSubversionTagsParameterValue(getName(), getTagsDir(), this.defaultValue);
}
return new ListSubversionTagsParameterValue(getName(), getTagsDir(), this.defaultValue);
}

@Override
public DescriptorImpl getDescriptor() {
@@ -189,21 +188,16 @@ public DescriptorImpl getDescriptor() {
SVNLogClient logClient = new SVNLogClient(authManager, null);

if (isSVNRepositoryProjectRoot(repo)) {
dirs = this.getSVNRootRepoDirectories(logClient, repoURL);
} else {
logClient.doList(repoURL, SVNRevision.HEAD, SVNRevision.HEAD, false, false, dirEntryHandler);
dirs = dirEntryHandler.getDirs(isReverseByDate(), isReverseByName());
}
dirs = this.getSVNRootRepoDirectories(logClient, repoURL);
} else {
logClient.doList(repoURL, SVNRevision.HEAD, SVNRevision.HEAD, false, false, dirEntryHandler);
dirs = dirEntryHandler.getDirs(isReverseByDate(), isReverseByName());
}
}
catch(SVNException e) {
// logs are not translated (IMO, this is a bad idea to translate logs)
LOGGER.log(Level.SEVERE, "An SVN exception occurred while listing the directory entries at " + getTagsDir(), e);
return new ArrayList() {/**
*
*/
private static final long serialVersionUID = -2461060214177503398L;

{
return new ArrayList() {{
add("&lt;" + ResourceBundleHolder.get(ListSubversionTagsParameterDefinition.class).format("SVNException") + "&gt;");
}};
}
@@ -214,12 +208,7 @@ public DescriptorImpl getDescriptor() {
}
else {
LOGGER.log(Level.INFO, "No directory entries were found for the following SVN repository: {0}", getTagsDir());
return new ArrayList() {/**
*
*/
private static final long serialVersionUID = -2725829892794981542L;

{
return new ArrayList() {{
add("&lt;" + ResourceBundleHolder.get(ListSubversionTagsParameterDefinition.class).format("NoDirectoryEntriesFound") + "&gt;");
}};
}
@@ -261,53 +250,49 @@ public String getMaxTags() {
* Checks to see if given repository contains a trunk, branches, and tags
* directories.
*
* @param repo
* Repository to check.
* @param repo Repository to check.
* @return True if trunk, branches, and tags exist.
*/
private boolean isSVNRepositoryProjectRoot(SVNRepository repo) {
try {
SVNDirEntry trunkEntry = repo.info("./" + SVN_TRUNK, SVNRevision.HEAD.getNumber());
SVNDirEntry branchesEntry = repo.info("./" + SVN_BRANCHES, SVNRevision.HEAD.getNumber());
SVNDirEntry tagsEntry = repo.info("./" + SVN_TAGS, SVNRevision.HEAD.getNumber());

if ((trunkEntry != null) && (branchesEntry != null) && (tagsEntry != null)) {
return true;
}

} catch (SVNException e) {
return false;
}
return false;
SVNDirEntry trunkEntry = repo.info(SVN_TRUNK, SVNRevision.HEAD.getNumber());
SVNDirEntry branchesEntry = repo.info(SVN_BRANCHES, SVNRevision.HEAD.getNumber());
SVNDirEntry tagsEntry = repo.info(SVN_TAGS, SVNRevision.HEAD.getNumber());

if ((trunkEntry != null) && (branchesEntry != null) && (tagsEntry != null)) {
return true;
}
} catch (SVNException e) {
return false;
}
return false;
}

/**
* Appends the target directory to all entries in a list. I.E. 1.2 -->
* branches/1.2
*
* @param targetDir
* The target directory to append.
* @param dirs
* List of directory entries
* @param targetDir The target directory to append.
* @param dirs List of directory entries
*/
private void appendTargetDir(String targetDir, List<String> dirs) {
if ((targetDir != null) && (dirs != null) && (dirs.size() > 0)) {
for (int i = 0; i < dirs.size(); i++) {
dirs.set(i, targetDir + System.getProperty("file.separator") + dirs.get(i));
}
}
for (int i = 0; i < dirs.size(); i++) {
dirs.set(i, targetDir + '/' + dirs.get(i));
}
}
}
private boolean isInt(String value) {
boolean isInteger = false;
try {
try {
Integer.parseInt(value);
isInteger = true;
} catch (NumberFormatException e) {
isInteger = false;
}
return isInteger;
}
isInteger = true;
} catch (NumberFormatException e) {
isInteger = false;
}
return isInteger;
}

/**
* Returns a list of contents from the trunk, branches, and tags
@@ -319,52 +304,51 @@ private boolean isInt(String value) {
* @throws SVNException
*/
private List<String> getSVNRootRepoDirectories(SVNLogClient logClient, SVNURL repoURL) throws SVNException {

// Get the branches repository contents
List<String> dirs = null;
SVNURL branchesRepo = repoURL.appendPath(SVN_BRANCHES, true);
SimpleSVNDirEntryHandler branchesEntryHandler = new SimpleSVNDirEntryHandler(null);
logClient.doList(branchesRepo, SVNRevision.HEAD, SVNRevision.HEAD, false, false, branchesEntryHandler);
List<String> branches = branchesEntryHandler.getDirs(isReverseByDate(), isReverseByName());
branches.remove(SVN_BRANCHES);
appendTargetDir(SVN_BRANCHES, branches);

// Get the tags repository contents
SVNURL tagsRepo = repoURL.appendPath(SVN_TAGS, true);
SimpleSVNDirEntryHandler tagsEntryHandler = new SimpleSVNDirEntryHandler(null);
logClient.doList(tagsRepo, SVNRevision.HEAD, SVNRevision.HEAD, false, false, tagsEntryHandler);
List<String> tags = tagsEntryHandler.getDirs(isReverseByDate(), isReverseByName());
tags.remove(SVN_TAGS);
appendTargetDir(SVN_TAGS, tags);

// Merge trunk with the contents of branches and tags.
dirs = new ArrayList<String>();
dirs.add(SVN_TRUNK);
if (branches != null) {
dirs.addAll(branches);
}

if (tags != null) {
dirs.addAll(tags);
}

// Filter out any unwanted repository locations.
if (StringUtils.isNotBlank(tagsFilter)) {
Pattern filterPattern = Pattern.compile(tagsFilter);

if ((dirs != null) && (dirs.size() > 0) && (filterPattern != null)) {
List<String> temp = new ArrayList<String>();
for (String dir : dirs) {
if (filterPattern.matcher(dir).matches()) {
temp.add(dir);
}
}
dirs = temp;
}
List<String> dirs = null;
SVNURL branchesRepo = repoURL.appendPath(SVN_BRANCHES, true);
SimpleSVNDirEntryHandler branchesEntryHandler = new SimpleSVNDirEntryHandler(null);
logClient.doList(branchesRepo, SVNRevision.HEAD, SVNRevision.HEAD, false, false, branchesEntryHandler);
List<String> branches = branchesEntryHandler.getDirs(isReverseByDate(), isReverseByName());
branches.remove(SVN_BRANCHES);
appendTargetDir(SVN_BRANCHES, branches);

// Get the tags repository contents
SVNURL tagsRepo = repoURL.appendPath(SVN_TAGS, true);
SimpleSVNDirEntryHandler tagsEntryHandler = new SimpleSVNDirEntryHandler(null);
logClient.doList(tagsRepo, SVNRevision.HEAD, SVNRevision.HEAD, false, false, tagsEntryHandler);
List<String> tags = tagsEntryHandler.getDirs(isReverseByDate(), isReverseByName());
tags.remove(SVN_TAGS);
appendTargetDir(SVN_TAGS, tags);

// Merge trunk with the contents of branches and tags.
dirs = new ArrayList<String>();
dirs.add(SVN_TRUNK);

if (branches != null) {
dirs.addAll(branches);
}

if (tags != null) {
dirs.addAll(tags);
}

// Filter out any unwanted repository locations.
if (StringUtils.isNotBlank(tagsFilter)) {
Pattern filterPattern = Pattern.compile(tagsFilter);

if ((dirs != null) && (dirs.size() > 0) && (filterPattern != null)) {
List<String> temp = new ArrayList<String>();
for (String dir : dirs) {
if (filterPattern.matcher(dir).matches()) {
temp.add(dir);
}
}
dirs = temp;
}
}

return dirs;
return dirs;
}

/**
@@ -433,4 +417,4 @@ public String getDisplayName() {

private final static Logger LOGGER = Logger.getLogger(ListSubversionTagsParameterDefinition.class.getName());

}
}
@@ -1,7 +1,8 @@
/*
* The MIT License
*
* Copyright (c) 2010, Manufacture Francaise des Pneumatiques Michelin, Romain Seguy
* Copyright (c) 2010-2011, Manufacture Francaise des Pneumatiques Michelin,
* Romain Seguy
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -39,8 +40,7 @@
*/
public class ListSubversionTagsParameterValue extends ParameterValue {

private static final long serialVersionUID = 9192758635921187885L;
@Exported(visibility=3) private String tagsDir; // this att comes from ListSubversionTagsParameterDefinition
@Exported(visibility=3) private String tagsDir; // this att comes from ListSubversionTagsParameterDefinition
@Exported(visibility=3) private String tag;

@DataBoundConstructor
@@ -2,7 +2,7 @@
- The MIT License
-
- Copyright (c) 2010-2011, Manufacture Francaise des Pneumatiques Michelin,
- Romain Seguy
- Romain Seguy, Jeff Blaisdell
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
@@ -32,12 +32,12 @@
<f:textbox name="parameter.tagsDir" value="${instance.tagsDir}" />
</f:entry>
<f:entry title="${%Tags filter}" field="tagsFilter">
<f:textbox field="tagsFilter"/>
<f:textbox field="parameter.tagsFilter" />
</f:entry>
<f:entry title="${%Default Value}" field="defaultValue">
<f:entry title="${%Default value}" field="defaultValue">
<f:textbox field="parameter.defaultValue" value="${instance.defaultValue}" />
</f:entry>
<f:entry title="${%Maximum Tags to Display}" field="maxTags">
<f:entry title="${%Maximum tags to display}" field="maxTags">
<f:textbox field="parameter.maxTags" value="${instance.maxTags}" />
</f:entry>
<f:entry field="reverseByDate">
@@ -0,0 +1,28 @@
<!--
- The MIT License
-
- Copyright (c) 2011, Jeff Blaisdell
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-->

<div>
For features such as SVN polling a default value is required. If job will only
be started manually, this field is not necessary.
</div>
@@ -0,0 +1,28 @@
<!--
- The MIT License
-
- Copyright (c) 2011, Jeff Blaisdell
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
-
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
-->

<div>
The maximum number of tags to display in the dropdown. Any non-number value
will default to all.
</div>
@@ -1,8 +1,8 @@
<!--
- The MIT License
-
- Copyright (c) 2010, Manufacture Francaise des Pneumatiques Michelin, Romain Seguy
- Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe
- Copyright (c) 2010-2011, Manufacture Francaise des Pneumatiques Michelin, Romain Seguy
- Copyright (c) 2004-2011, Sun Microsystems, Inc., Kohsuke Kawaguchi, Seiji Sogabe
-
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
@@ -26,6 +26,11 @@
<div>
Specify the Subversion repository URL which contains the tags to be listed
when triggering a new build.<br/>
You can also specify the root of a Subversion repository: If this root contains
the <code>trunk</code>, <code>branches</code> and <code>tags</code> folders,
then the dropdown will display <code>trunk</code>, all the branches and all the
tags. If the root does not contain these three folders, then all its subfolders
are listed in the dropdown.<br/>
When you enter the URL, Jenkins automatically checks if it can connect to it.
If access requires authentication, you'll be prompted for the necessary
credential. If you already have a working credential but would like to change

0 comments on commit 16c6e05

Please sign in to comment.
You can’t perform that action at this time.