Skip to content
Permalink
Browse files

[FIXED JENKINS-9914] Using proper databinding scheme and adding help …

…for these fields.
  • Loading branch information...
kohsuke committed Aug 19, 2011
1 parent 5d6aa56 commit e4dcecefca2cc5ba248c20d72bbbd362aaf258dc
@@ -10,7 +10,7 @@

/**
* A specification of branches to build. Rather like a refspec.
*
*
* eg:
* master
* origin/master
@@ -201,8 +201,7 @@ public Boolean invoke(File workspace,

PreBuildMergeOptions mergeOptions = gitSCM.getMergeOptions();

if (mergeOptions.doMerge() && buildResult.isBetterOrEqualTo(
Result.SUCCESS)) {
if (mergeOptions.doMerge() && buildResult.isBetterOrEqualTo(Result.SUCCESS)) {
RemoteConfig remote = mergeOptions.getMergeRemote();
listener.getLogger().println("Pushing result " + buildnumber + " to " + mergeOptions.getMergeTarget() + " branch of " + remote.getName() + " repository");

@@ -175,7 +175,7 @@ public GitSCM(
String scmName,
List<UserRemoteConfig> userRemoteConfigs,
List<BranchSpec> branches,
UserMergeOptions doMerge,
UserMergeOptions userMergeOptions,
Boolean doGenerateSubmoduleConfigurations,
Collection<SubmoduleConfig> submoduleCfg,
boolean clean,
@@ -208,7 +208,7 @@ public GitSCM(
this.localBranch = Util.fixEmptyAndTrim(localBranch);

this.userRemoteConfigs = userRemoteConfigs;
this.userMergeOptions = doMerge;
this.userMergeOptions = userMergeOptions;
updateFromUserData();

// TODO: getBrowserFromRequest
@@ -1603,6 +1603,10 @@ public PreBuildMergeOptions getMergeOptions() {
return mergeOptions;
}

public UserMergeOptions getUserMergeOptions() {
return userMergeOptions;
}

/**
* Look back as far as needed to find a valid BuildData. BuildData
* may not be recorded if an exception occurs in the plugin logic.
@@ -1,9 +1,15 @@
package hudson.plugins.git;

import java.io.Serializable;

import hudson.Extension;
import hudson.model.AbstractDescribableImpl;
import hudson.model.Descriptor;
import hudson.util.FormValidation;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;

public class UserMergeOptions implements Serializable {
public class UserMergeOptions extends AbstractDescribableImpl<UserMergeOptions> implements Serializable {

private String mergeRemote;
private String mergeTarget;
@@ -21,4 +27,12 @@ public String getMergeRemote() {
public String getMergeTarget() {
return mergeTarget;
}

@Extension
public static class DescriptorImpl extends Descriptor<UserMergeOptions> {
@Override
public String getDisplayName() {
return "";
}
}
}
@@ -115,31 +115,16 @@
</f:entry>
-->

<f:entry title="Merge options" help="/plugin/git/merge.html">

<table width="100%">
<f:optionalBlock field="doMerge"
title="${%Merge before build}"
checked="${scm.mergeOptions.doMerge()}">
<f:entry title="Name of repository: (default first specified, e.g. origin)" field="mergeRemote">
<f:textbox id="git.mergeRemote" value="${scm.mergeOptions.getMergeRemote().getName()}"/>
<!-- TODO add the check url. Note that we cannot rely on the repo.name tag to be at the root of the form -->
<!-- checkUrl="'${rootURL}/scm/GitSCM/gitRemoteNameCheck?isMerge=true&amp;value='+escape(this.value)
+encodeAllInputs('&amp;', this.form, 'repo.name')
+encodeAllInputs('&amp;', this.form, 'repo.url')"/ -->
</f:entry>
<f:entry title="Branch to merge to: (e.g. master)" field="mergeTarget">
<f:textbox id="git.mergeTarget" value="${scm.mergeOptions.getMergeTarget()}" clazz="required"/>
</f:entry>
</f:optionalBlock>
</table>

</f:entry>

<f:entry title="Prune remote branches before build" field="pruneBranches" help="/plugin/git/prune.html">
<f:checkbox />
</f:entry>
<f:entry title="Merge options">
<table width="100%">
<f:optionalProperty title="${%Merge before build}" field="userMergeOptions" />
</table>
</f:entry>

<f:entry title="Prune remote branches before build" field="pruneBranches" help="/plugin/git/prune.html">
<f:checkbox/>
</f:entry>

<f:entry title="Skip internal tag" field="skipTag" help="/plugin/git/help-skipTag.html">
<f:checkbox />
@@ -0,0 +1,12 @@
<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="Name of repository" field="mergeRemote">
<f:textbox id="git.mergeRemote" />
<!-- TODO add the check url. Note that we cannot rely on the repo.name tag to be at the root of the form -->
<!-- checkUrl="'${rootURL}/scm/GitSCM/gitRemoteNameCheck?isMerge=true&amp;value='+escape(this.value)
+encodeAllInputs('&amp;', this.form, 'repo.name')
+encodeAllInputs('&amp;', this.form, 'repo.url')"/ -->
</f:entry>
<f:entry title="${%Branch to merge to}" field="mergeTarget">
<f:textbox id="git.mergeTarget" clazz="required"/>
</f:entry>
</j:jelly>
@@ -0,0 +1,4 @@
<div>
Name of the repository, such as <tt>origin</tt>, that contains the branch you specify below. If left blank,
it'll default to the name of the first repository configured above.
</div>
@@ -0,0 +1,3 @@
<div>
The name of the branch within the named repository to merge to, such as <tt>master</tt>.
</div>
@@ -1,3 +1,4 @@
<div>
Specify the branch name if you'd like to track a specific branch in a repository. If left blank, all branches will be examined for changes and built.
Specify the branches if you'd like to track a specific branch in a repository. If left blank, all branches will be examined for changes and built.
The syntax is <tt>REPOSITORYNAME/</tt>
</div>

0 comments on commit e4dcece

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