提交 8dbd42ee 编写于 作者: K kohsuke

moved CVS help files to the resources folder to match the modern convention.

This is in preparation of moving CVS to its own plugin.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@21008 71c3de6d-444a-0410-be80-ed276b4c234a
上级 5768da22
......@@ -554,7 +554,7 @@ public abstract class Descriptor<T extends Describable<T>> implements Saveable {
private InputStream getHelpStream(Class c, String suffix) {
Locale locale = Stapler.getCurrentRequest().getLocale();
String base = c.getName().replace('.', '/') + "/help"+suffix;
String base = c.getName().replace('.', '/').replace('$','/') + "/help"+suffix;
ClassLoader cl = c.getClassLoader();
if(cl==null) return null;
......
......@@ -3102,27 +3102,6 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
return System.getProperty("os.name").startsWith("mac");
}
/**
* Returns all {@code CVSROOT} strings used in the current Hudson installation.
*
* <p>
* Ideally this shouldn't be defined in here
* but EL doesn't provide a convenient way of invoking a static function,
* so I'm putting it here for now.
*/
public Set<String> getAllCvsRoots() {
Set<String> r = new TreeSet<String>();
for( AbstractProject p : getAllItems(AbstractProject.class) ) {
SCM scm = p.getScm();
if (scm instanceof CVSSCM) {
CVSSCM cvsscm = (CVSSCM) scm;
r.add(cvsscm.getCvsRoot());
}
}
return r;
}
/**
* Rebuilds the dependency map.
*/
......
......@@ -32,6 +32,7 @@ import hudson.Util;
import hudson.Extension;
import static hudson.Util.fixEmpty;
import static hudson.Util.fixNull;
import static hudson.Util.fixEmptyAndTrim;
import hudson.model.AbstractBuild;
import hudson.model.AbstractProject;
import hudson.model.BuildListener;
......@@ -40,6 +41,8 @@ import hudson.model.ModelObject;
import hudson.model.Run;
import hudson.model.TaskListener;
import hudson.model.TaskThread;
import hudson.model.Describable;
import hudson.model.Descriptor;
import hudson.org.apache.tools.ant.taskdefs.cvslib.ChangeLogTask;
import hudson.remoting.Future;
import hudson.remoting.RemoteOutputStream;
......@@ -148,12 +151,12 @@ public class CVSSCM extends SCM implements Serializable {
private String excludedRegions;
@DataBoundConstructor
public CVSSCM(String cvsRoot, String module,String branch,String cvsRsh,boolean canUseUpdate, boolean legacy, boolean isTag, String excludedRegions) {
public CVSSCM(String cvsRoot, String allModules,String branch,String cvsRsh,boolean canUseUpdate, boolean legacy, boolean isTag, String excludedRegions) {
if(fixNull(branch).equals("HEAD"))
branch = null;
this.cvsroot = fixNull(cvsRoot).trim();
this.module = module.trim();
this.module = allModules.trim();
this.branch = nullify(branch);
this.cvsRsh = nullify(cvsRsh);
this.canUseUpdate = canUseUpdate;
......@@ -1113,8 +1116,8 @@ public class CVSSCM extends SCM implements Serializable {
}
public boolean configure( StaplerRequest req, JSONObject o ) {
cvsPassFile = fixEmpty(req.getParameter("cvs_cvspass").trim());
cvsExe = fixEmpty(req.getParameter("cvs_exe").trim());
cvsPassFile = fixEmptyAndTrim(req.getParameter("cvspassFile"));
cvsExe = fixEmptyAndTrim(o.getString("cvsExe"));
noCompression = req.getParameter("cvs_noCompression")!=null;
save();
......@@ -1126,11 +1129,27 @@ public class CVSSCM extends SCM implements Serializable {
return x.getCvsRoot().equals(y.getCvsRoot());
}
/**
* Returns all {@code CVSROOT} strings used in the current Hudson installation.
*/
public Set<String> getAllCvsRoots() {
Set<String> r = new TreeSet<String>();
for( AbstractProject p : Hudson.getInstance().getAllItems(AbstractProject.class) ) {
SCM scm = p.getScm();
if (scm instanceof CVSSCM) {
CVSSCM cvsscm = (CVSSCM) scm;
r.add(cvsscm.getCvsRoot());
}
}
return r;
}
//
// web methods
//
public FormValidation doCvsPassCheck(@QueryParameter String value) {
public FormValidation doCheckCvspassFile(@QueryParameter String value) {
// this method can be used to check if a file exists anywhere in the file system,
// so it should be protected.
if(!Hudson.getInstance().hasPermission(Hudson.ADMINISTER))
......@@ -1155,7 +1174,7 @@ public class CVSSCM extends SCM implements Serializable {
/**
* Checks if cvs executable exists.
*/
public FormValidation doCvsExeCheck(@QueryParameter String value) {
public FormValidation doCheckCvsExe(@QueryParameter String value) {
return FormValidation.validateExecutable(value);
}
......@@ -1307,7 +1326,7 @@ public class CVSSCM extends SCM implements Serializable {
/**
* Action for a build that performs the tagging.
*/
public final class TagAction extends AbstractScmTagAction {
public final class TagAction extends AbstractScmTagAction implements Describable<TagAction> {
/**
* If non-null, that means the build is already tagged.
......@@ -1489,7 +1508,7 @@ public class CVSSCM extends SCM implements Serializable {
boolean isDir = path.isDirectory();
ArgumentListBuilder cmd = new ArgumentListBuilder();
cmd.add(getDescriptor().getCvsExeOrDefault(),"tag");
cmd.add(CVSSCM.this.getDescriptor().getCvsExeOrDefault(),"tag");
if(isDir) {
cmd.add("-R");
}
......@@ -1532,6 +1551,21 @@ public class CVSSCM extends SCM implements Serializable {
this.tagName = tagName;
this.workerThread = null;
}
public Descriptor<TagAction> getDescriptor() {
return Hudson.getInstance().getDescriptor(getClass());
}
}
@Extension
public static final class TagActionDescriptor extends Descriptor<TagAction> {
public TagActionDescriptor() {
super(TagAction.class);
}
public String getDisplayName() {
return "";
}
}
public static final class TagWorkerThread extends TaskThread {
......
......@@ -35,7 +35,7 @@ THE SOFTWARE.
<f:entry title="CVSROOT">
<f:editableComboBox id="cvsroot" clazz="setting-input"
name="cvsroot"
items="${app.allCvsRoots}" />
items="${it.allCvsRoots}" />
</f:entry>
<f:entry title="Password">
<input type="password" name="password" class="setting-input"/>
......
......@@ -32,6 +32,8 @@ THE SOFTWARE.
<d:taglib uri="local">
<d:tag name="tagForm">
<form action="submit" method="get">
<j:set var="descriptor" value="${it.descriptor}" />
<table>
<f:block>
${%Choose the CVS tag name for this build}:
......@@ -41,7 +43,7 @@ THE SOFTWARE.
<j:set var="upstream" value="${it.build.transitiveUpstreamBuilds}" />
<j:if test="${!empty(upstream)}">
<f:optionalBlock name="upstream" title="Tag all upstream builds at once" help="/help/_cvs/tagAll.html">
<f:optionalBlock name="upstream" title="Tag all upstream builds at once" help="${descriptor.getHelpFile('tagAll')}">
<j:forEach var="up" items="${upstream}">
<f:entry title="${up.key.name} #${up.value}">
<input type="text" name="upstream.${up.key.name}" value="hudson-${up.value}" class="validated"
......
......@@ -23,32 +23,32 @@ THE SOFTWARE.
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:entry title="CVSROOT" help="/help/_cvs/cvsroot.html">
<f:editableComboBox id="cvs_root" clazz="setting-input" field="cvsRoot" items="${app.allCvsRoots}" />
<f:entry title="CVSROOT" field="cvsRoot">
<f:editableComboBox id="cvs_root" clazz="setting-input" items="${descriptor.allCvsRoots}" />
</f:entry>
<f:entry title="${%Modules}" help="/help/_cvs/modules.html">
<f:expandableTextbox name="cvs.module" value="${scm.allModules}"/>
<f:entry title="${%Modules}" field="allModules">
<f:expandableTextbox />
</f:entry>
<f:entry title="${%Branch}" help="/help/_cvs/branch.html">
<f:textbox field="branch" />
<f:entry title="${%Branch}" field="branch">
<f:textbox />
<div style="padding-left: 2em">
<f:checkbox name="cvs.isTag" checked="${scm.isTag()}" />
<label class="attach-previous"> ${%This is a tag, not a branch}</label>
</div>
</f:entry>
<f:advanced>
<f:entry title="CVS_RSH" help="/help/_cvs/cvs-rsh.html">
<f:textbox field="cvsRsh" />
<f:entry title="CVS_RSH" field="cvsRsh">
<f:textbox />
</f:entry>
<f:entry title="${%Legacy mode}" field="legacy" help="/help/_cvs/legacy.html">
<f:entry title="${%Legacy mode}" field="legacy">
<f:checkbox />
${%legacyModeDescription}
</f:entry>
<f:entry title="${%Use update}" field="canUseUpdate" help="/help/_cvs/update.html">
<f:entry title="${%Use update}" field="canUseUpdate">
<f:checkbox default="true" />
</f:entry>
<t:listScmBrowsers name="cvs.browser" />
<f:entry title="${%Excluded Regions}" help="/help/_cvs/excludedRegions.html" field="excludedRegions">
<f:entry title="${%Excluded Regions}" field="excludedRegions">
<f:textarea />
</f:entry>
</f:advanced>
......
......@@ -29,14 +29,11 @@ THE SOFTWARE.
<a href="${rootURL}/scm/CVSSCM/version">${%Check CVS version}</a>
</div>
</f:description>
<f:entry title="${%cvs executable}" help="/help/_cvs/cvsexe.html">
<f:textbox name="cvs_exe" value="${descriptor.cvsExe}"
checkUrl="'${rootURL}/scm/CVSSCM/cvsExeCheck?value='+escape(this.value)" />
<f:entry title="${%cvs executable}" field="cvsExe">
<f:textbox />
</f:entry>
<f:entry title="${%.cvspass file}" help="/help/_cvs/cvspass.html">
<input class="setting-input validated" name="cvs_cvspass"
type="text" value="${descriptor.cvspassFile}"
checkUrl="'${rootURL}/scm/CVSSCM/cvsPassCheck?value='+escape(this.value)" />
<f:entry title="${%.cvspass file}" field="cvspassFile">
<f:textbox />
</f:entry>
<f:advanced>
<f:block>
......
......@@ -54,6 +54,7 @@ THE SOFTWARE.
which is the recommended approach.
</st:attribute>
</st:documentation>
<f:prepareDatabinding />
<j:set var="value" value="${attrs.value?:instance[attrs.field]}" />
<j:choose>
<j:when test="${h.isMultiline(value)}">
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册