Skip to content

Commit

Permalink
Merge pull request #27
Browse files Browse the repository at this point in the history
  • Loading branch information
rsandell committed Sep 25, 2015
2 parents 9d846a9 + 3246261 commit 435bdc2
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 4 deletions.
2 changes: 1 addition & 1 deletion checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Checkstyle configuration that checks coding conventions.
<module name="UnusedImports"/>
<module name="MethodLength"/>
<module name="ParameterNumber">
<property name="max" value="15"/>
<property name="max" value="16"/>
</module>
<module name="LineLength">
<property name="tabWidth" value="4"/>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.554.3</version><!-- which version of Hudson is this plugin built against? -->
<version>1.580.1</version><!-- which version of Hudson is this plugin built against? -->
</parent>

<groupId>org.jenkins-ci.plugins</groupId>
Expand Down
22 changes: 22 additions & 0 deletions src/main/java/hudson/plugins/repo/RepoScm.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ public class RepoScm extends SCM implements Serializable {
private boolean forceSync;
private final boolean trace;
private final boolean showAllChanges;
private boolean noTags;

/**
* Returns the manifest repository URL.
Expand Down Expand Up @@ -254,6 +255,11 @@ public boolean isForceSync() {
*/
@Exported
public boolean isTrace() { return trace; }
/**
* Returns the value of noTags.
*/
@Exported
public boolean isNoTags() { return noTags; }

/**
* The constructor takes in user parameters and sets them. Each job using
Expand Down Expand Up @@ -348,6 +354,18 @@ public void setForceSync(final boolean forceSync) {
this.forceSync = forceSync;
}

/**
* Set noTags.
*
* @param noTags
* If this value is true, add the "--no-tags" option when
* executing "repo sync".
*/
@DataBoundSetter
public final void setNoTags(final boolean noTags) {
this.noTags = noTags;
}

@Override
public SCMRevisionState calcRevisionsFromBuild(
final AbstractBuild<?, ?> build, final Launcher launcher,
Expand Down Expand Up @@ -488,6 +506,10 @@ private int doSync(final Launcher launcher, final FilePath workspace,
if (jobs > 0) {
commands.add("--jobs=" + jobs);
}
if (isNoTags()) {
commands.add("--no-tags");
}

int returnCode =
launcher.launch().stdout(logger).pwd(workspace)
.cmds(commands).envs(env).join();
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/hudson/plugins/repo/TagAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
*/
package hudson.plugins.repo;

import hudson.model.AbstractBuild;
import hudson.model.Run;
import hudson.scm.AbstractScmTagAction;

import org.kohsuke.stapler.export.ExportedBean;
Expand All @@ -42,7 +42,7 @@ public class TagAction extends AbstractScmTagAction {
* @param build
* Build which we are interested in tagging
*/
TagAction(final AbstractBuild<?, ?> build) {
TagAction(final Run<?, ?> build) {
super(build);
}

Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@
<f:checkbox name="repo.forceSync" checked="${scm.forceSync}" />
</f:entry>

<f:entry title="No tags" help="/plugin/repo/help-noTags.html">
<f:checkbox name="repo.noTags" checked="${scm.noTags}" />
</f:entry>

<f:entry title="Trace" help="/plugin/repo/help-trace.html">
<f:checkbox name="repo.trace" checked="${scm.trace}" />
</f:entry>
Expand Down
6 changes: 6 additions & 0 deletions src/main/webapp/help-noTags.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div>
<p>
Don't fetch tags.
This is passed to repo as <code>repo sync <i>--no-tags</i></code>.
</p>
</div>

0 comments on commit 435bdc2

Please # to comment.