Skip to content

Commit

Permalink
Add --trace option
Browse files Browse the repository at this point in the history
  • Loading branch information
scottanderson committed Oct 27, 2014
1 parent 41d6e86 commit 7489080
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 25 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="13"/>
<property name="max" value="14"/>
</module>
<module name="LineLength">
<property name="tabWidth" value="4"/>
Expand Down
26 changes: 19 additions & 7 deletions src/main/java/hudson/plugins/repo/RepoScm.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public class RepoScm extends SCM implements Serializable {
private final boolean currentBranch;
private final boolean resetFirst;
private final boolean quiet;
private final boolean trace;

/**
* Returns the manifest repository URL.
Expand Down Expand Up @@ -272,14 +273,17 @@ public boolean isQuiet() {
* If not null then use this url as repo base,
* instead of the default
* @param currentBranch
* if this value is true,
* add "-c" options when excute "repo sync".
* If this value is true, add the "-c" option when executing
* "repo sync".
* @param resetFirst
* if this value is true, do
* "repo forall -c 'git reset --hard'" first.
* If this value is true, do "repo forall -c 'git reset --hard'"
* before syncing.
* @param quiet
* if this value is true,
* add "-q" options when excute "repo sync".
* If this value is true, add the "-q" option when executing
* "repo sync".
* @param trace
* If this value is true, add the "--trace" option when
* executing "repo init" and "repo sync".
*/
@DataBoundConstructor
public RepoScm(final String manifestRepositoryUrl,
Expand All @@ -290,7 +294,8 @@ public RepoScm(final String manifestRepositoryUrl,
final String repoUrl,
final boolean currentBranch,
final boolean resetFirst,
final boolean quiet) {
final boolean quiet,
final boolean trace) {
this.manifestRepositoryUrl = manifestRepositoryUrl;
this.manifestBranch = Util.fixEmptyAndTrim(manifestBranch);
this.manifestGroup = Util.fixEmptyAndTrim(manifestGroup);
Expand All @@ -303,6 +308,7 @@ public RepoScm(final String manifestRepositoryUrl,
this.currentBranch = currentBranch;
this.resetFirst = resetFirst;
this.quiet = quiet;
this.trace = trace;
this.repoUrl = Util.fixEmptyAndTrim(repoUrl);
}

Expand Down Expand Up @@ -429,6 +435,9 @@ private int doSync(final Launcher launcher, final FilePath workspace,
commands.clear();
}
commands.add(getDescriptor().getExecutable());
if (trace) {
commands.add("--trace");
}
commands.add("sync");
commands.add("-d");
if (isCurrentBranch()) {
Expand Down Expand Up @@ -456,6 +465,9 @@ private boolean checkoutCode(final Launcher launcher,
debug.log(Level.INFO, "Checking out code in: " + workspace.getName());

commands.add(getDescriptor().getExecutable());
if (trace) {
commands.add("--trace");
}
commands.add("init");
commands.add("-u");
commands.add(env.expand(manifestRepositoryUrl));
Expand Down
36 changes: 19 additions & 17 deletions src/main/resources/hudson/plugins/repo/RepoScm/config.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -7,55 +7,57 @@
xmlns:f="/lib/form">

<f:entry title="Manifest Repository Url" help="/plugin/repo/help-manifestRepositoryUrl.html">
<f:textbox name="repo.manifestRepositoryUrl" value="${scm.manifestRepositoryUrl}"/>
<f:textbox name="repo.manifestRepositoryUrl" value="${scm.manifestRepositoryUrl}" />
</f:entry>

<f:advanced>

<f:entry title="Manifest Branch" help="/plugin/repo/help-manifestBranch.html">
<f:textbox name="repo.manifestBranch" value="${scm.manifestBranch}"/>
<f:textbox name="repo.manifestBranch" value="${scm.manifestBranch}" />
</f:entry>

<f:entry title="Manifest File" help="/plugin/repo/help-manifestFile.html">
<f:textbox name="repo.manifestFile" value="${scm.manifestFile}"/>
<f:textbox name="repo.manifestFile" value="${scm.manifestFile}" />
</f:entry>

<f:entry title="Group" help="/plugin/repo/help-manifestGroup.html">
<f:textbox name="repo.manifestGroup" value="${scm.manifestGroup}"/>
<f:textbox name="repo.manifestGroup" value="${scm.manifestGroup}" />
</f:entry>

<f:entry title="Destination Directory" help="/plugin/repo/help-destinationDir.html">
<f:textbox name="repo.destinationDir" value="${scm.destinationDir}"/>
<f:textbox name="repo.destinationDir" value="${scm.destinationDir}" />
</f:entry>

<f:entry title="Repo Url" help="/plugin/repo/help-repoUrl.html">
<f:textbox name="repo.repoUrl" value="${scm.repoUrl}"/>
<f:textbox name="repo.repoUrl" value="${scm.repoUrl}" />
</f:entry>

<f:entry title="Mirror Directory" help="/plugin/repo/help-mirrorDir.html">
<f:textbox name="repo.mirrorDir" value="${scm.mirrorDir}"/>
<f:textbox name="repo.mirrorDir" value="${scm.mirrorDir}" />
</f:entry>

<f:entry title="Jobs" help="/plugin/repo/help-jobs.html">
<f:textbox name="repo.jobs" value="${scm.jobs}" clazz="number"/>
<f:textbox name="repo.jobs" value="${scm.jobs}" clazz="number" />
</f:entry>

<f:entry title="Depth" help="/plugin/repo/help-depth.html">
<f:textbox name="repo.depth" value="${scm.depth}" clazz="number"/>
<f:textbox name="repo.depth" value="${scm.depth}" clazz="number" />
</f:entry>

<f:entry title="Current Branch" help="/plugin/repo/help-currentBranch.html">
<f:checkbox name="repo.currentBranch"
checked="${h.defaultToTrue(scm.currentBranch)}" />
<f:checkbox name="repo.currentBranch" checked="${h.defaultToTrue(scm.currentBranch)}" />
</f:entry>

<f:entry title="Reset first" help="/plugin/repo/help-resetFirst.html">
<f:checkbox name="repo.resetFirst" checked="${scm.resetFirst}" />
</f:entry>
<f:entry title="Reset first" help="/plugin/repo/help-resetFirst.html">
<f:checkbox name="repo.resetFirst"
checked="${h.defaultToFalse(scm.resetFirst)}" />
</f:entry>

<f:entry title="Quiet" help="/plugin/repo/help-quiet.html">
<f:checkbox name="repo.quiet"
checked="${h.defaultToTrue(scm.quiet)}" />
<f:checkbox name="repo.quiet" checked="${h.defaultToTrue(scm.quiet)}" />
</f:entry>

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

<f:entry title="Local Manifest" help="/plugin/repo/help-localManifest.html">
Expand Down
6 changes: 6 additions & 0 deletions src/main/webapp/help-trace.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<div>
<p>
Trace git command execution. This is passed to repo as
<code>repo <i>--trace</i> &lt;subcommand&gt;</code>.
</p>
</div>

0 comments on commit 7489080

Please sign in to comment.