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