Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to disable changelog calculation
In some very very large repositories, the changelog calculation can take quite a bit of time. For users that do not care about seeing the changelog in Jenkins, this allows disabling the calculation, thus speeding up builds. JENKINS-16654
- Loading branch information
Showing
4 changed files
with
79 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/main/resources/hudson/plugins/mercurial/MercurialSCM/help-disableChangeLog.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<div> | ||
When checked, Hudson will not calculate the Mercurial changelog for each build. | ||
Disabling the changelog can decrease the amount of time needed to update a | ||
very large repository. | ||
</div> |
53 changes: 53 additions & 0 deletions
53
src/test/java/hudson/plugins/mercurial/DisableChangeLogTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package hudson.plugins.mercurial; | ||
|
||
import hudson.model.AbstractBuild; | ||
import hudson.model.FreeStyleProject; | ||
import hudson.tools.ToolProperty; | ||
|
||
import java.io.File; | ||
import java.util.Collections; | ||
import static org.junit.Assert.*; | ||
import org.junit.Before; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.TemporaryFolder; | ||
|
||
import org.jvnet.hudson.test.JenkinsRule; | ||
|
||
public class DisableChangeLogTest { | ||
@Rule public JenkinsRule j = new JenkinsRule(); | ||
@Rule public MercurialRule m = new MercurialRule(j); | ||
@Rule public TemporaryFolder tmp = new TemporaryFolder(); | ||
private File repo; | ||
|
||
private static final String DISABLE_CHANGELOG_INSTALLATION = "changelog"; | ||
|
||
@Before public void setUp() throws Exception { | ||
repo = tmp.getRoot(); | ||
j.jenkins | ||
.getDescriptorByType(MercurialInstallation.DescriptorImpl.class) | ||
.setInstallations( | ||
new MercurialInstallation(DISABLE_CHANGELOG_INSTALLATION, "", "hg", | ||
true, false, false, Collections | ||
.<ToolProperty<?>> emptyList())); | ||
} | ||
|
||
protected String hgInstallation() { | ||
return DISABLE_CHANGELOG_INSTALLATION; | ||
} | ||
|
||
@Test public void changelogIsDisabled() throws Exception { | ||
AbstractBuild<?, ?> b; | ||
FreeStyleProject p = j.createFreeStyleProject(); | ||
p.setScm(new MercurialSCM(hgInstallation(), repo.getPath(), | ||
MercurialSCM.RevisionType.BRANCH, null, null, | ||
null, null, false, null, true)); | ||
m.hg(repo, "init"); | ||
m.touchAndCommit(repo, "dir1/f1"); | ||
b = p.scheduleBuild2(0).get(); | ||
assertTrue(b.getChangeSet().isEmptySet()); | ||
m.touchAndCommit(repo, "dir2/f1"); | ||
b = p.scheduleBuild2(0).get(); | ||
assertTrue(b.getChangeSet().isEmptySet()); | ||
} | ||
} |