Skip to content

Commit

Permalink
[FIXED JENKINS-12495] In IntegrateAction, use a MutableBoolean instea…
Browse files Browse the repository at this point in the history
…d of throwing an exception when changes are found.
  • Loading branch information
hugueschabot committed Mar 14, 2014
1 parent 11f0e7e commit 630368c
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions src/main/java/jenkins/plugins/svnmerge/FeatureBranchProperty.java
Expand Up @@ -21,6 +21,7 @@
import jenkins.model.Jenkins;
import net.sf.json.JSONObject;

import org.apache.commons.lang.mutable.MutableBoolean;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;
import org.tmatesoft.svn.core.ISVNLogEntryHandler;
Expand Down Expand Up @@ -288,23 +289,23 @@ public void handleEvent(SVNEvent event, double progress) throws SVNException {

// do we have any meaningful changes in this branch worthy of integration?
if (lastIntegrationSourceRevision !=null) {
final SVNException eureka = new SVNException(SVNErrorMessage.UNKNOWN_ERROR_MESSAGE);
try {
cm.getLogClient().doLog(new File[]{mr},mergeRev,SVNRevision.create(lastIntegrationSourceRevision),mergeRev,true,false,-1,new ISVNLogEntryHandler() {
public void handleLogEntry(SVNLogEntry e) throws SVNException {
if (e.getMessage().startsWith(RebaseAction.COMMIT_MESSAGE_PREFIX)
|| e.getMessage().startsWith(IntegrateAction.COMMIT_MESSAGE_PREFIX))
return; // merge commits
throw eureka;
final MutableBoolean changesFound = new MutableBoolean(false);
cm.getLogClient().doLog(new File[]{mr},mergeRev,SVNRevision.create(lastIntegrationSourceRevision),mergeRev,true,false,-1,new ISVNLogEntryHandler() {
public void handleLogEntry(SVNLogEntry e) throws SVNException {
if (!changesFound.booleanValue()) {
String message = e.getMessage();

if (!message.startsWith(RebaseAction.COMMIT_MESSAGE_PREFIX)
&& !message.startsWith(IntegrateAction.COMMIT_MESSAGE_PREFIX)) {
changesFound.setValue(true);
}
}
});
// didn't find anything interesting. all the changes are our merges
logger.println("No changes to be integrated. Skipping integration.");
return new IntegrationResult(0,mergeRev);
} catch (SVNException e) {
if (e!=eureka)
throw e; // some other problems
// found some changes, keep on integrating
}
});
// didn't find anything interesting. all the changes are our merges
if (!changesFound.booleanValue()) {
logger.println("No changes to be integrated. Skipping integration.");
return new IntegrationResult(0,mergeRev);
}
}

Expand Down

0 comments on commit 630368c

Please sign in to comment.