Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #29 #32

Merged
merged 1 commit into from
Feb 3, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,15 @@ public void integrate(AbstractBuild<?, ?> build, Launcher launcher, BuildListene
logMessage = String.format(PretestedIntegrationBuildWrapper.LOG_PREFIX + "Commit of accumulated merge done");
LOGGER.info(logMessage);
listener.getLogger().println(logMessage);
} catch (IOException | GitException | InterruptedException ex) {
// If ".git/MERGE_MSG" wasn't found the most likely culrprit is that the merge was an empty
// one (No changes) for some reason the merge() command does not complain or throw exception when that happens
if(ex.getMessage().contains("Cannot commit") || ex.getMessage().contains("MERGE_MSG (No such file or directory)")) {
logMessage = String.format("%sUnable to commit changes. Most likely you are trying to integrate a change that was already integrated. Message was:%n%s", PretestedIntegrationBuildWrapper.LOG_PREFIX, ex.getMessage());
} else {
logMessage = String.format(PretestedIntegrationBuildWrapper.LOG_PREFIX + "Exception while committing. Logging exception msg: %s", ex.getMessage());
}
} catch (FileNotFoundException | GitException ex) {
//See Github issue #29 (https://github.com/Praqma/pretested-integration-plugin/issues/29)
logMessage = String.format("%sUnable to commit changes. Most likely you are trying to integrate a change that was already integrated. Message was:%n%s", PretestedIntegrationBuildWrapper.LOG_PREFIX, ex.getMessage());
LOGGER.log(Level.SEVERE, logMessage, ex);
listener.getLogger().println(logMessage);
ex.printStackTrace(listener.getLogger());
throw new IntegrationFailedException(ex);
} catch ( IOException | InterruptedException ex) {
logMessage = String.format(PretestedIntegrationBuildWrapper.LOG_PREFIX + "Exception while committing. Logging exception msg: %s", ex.getMessage());
LOGGER.log(Level.SEVERE, logMessage, ex);
listener.getLogger().println(logMessage);
ex.printStackTrace(listener.getLogger());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ public void integrate(AbstractBuild<?, ?> build, Launcher launcher, BuildListene
LOGGER.log(Level.INFO, logMessage);
listener.getLogger().println(logMessage);
commitAuthor = client.withRepository(new FindCommitAuthorCallback(listener, builtBranch.getSHA1()));
logMessage = String.format(PretestedIntegrationBuildWrapper.LOG_PREFIX + "Done colecting last commit author: %s", commitAuthor);
logMessage = String.format(PretestedIntegrationBuildWrapper.LOG_PREFIX + "Done collecting last commit author: %s", commitAuthor);
LOGGER.log(Level.INFO, logMessage);
listener.getLogger().println(logMessage);

Expand Down Expand Up @@ -127,14 +127,14 @@ public void integrate(AbstractBuild<?, ?> build, Launcher launcher, BuildListene
logMessage = String.format(PretestedIntegrationBuildWrapper.LOG_PREFIX + "Commit of squashed merge done");
LOGGER.info(logMessage);
listener.getLogger().println(logMessage);
} catch (IOException | GitException | InterruptedException ex) {
// If ".git/MERGE_MSG" wasn't found the most likely culrprit is that the merge was an empty
// one (No changes) for some reason the merge() command does not complain or throw exception when that happens
if(ex.getMessage().contains("Cannot commit") || ex.getMessage().contains("MERGE_MSG (No such file or directory)")) {
logMessage = String.format("%sUnable to commit changes. Most likely you are trying to integrate a change that was already integrated. Message was:%n%s", PretestedIntegrationBuildWrapper.LOG_PREFIX, ex.getMessage());
} else {
logMessage = String.format(PretestedIntegrationBuildWrapper.LOG_PREFIX + "Exception while committing. Logging exception msg: %s", ex.getMessage());
}
} catch (FileNotFoundException | GitException ex) {
//See Github issue #29 (https://github.com/Praqma/pretested-integration-plugin/issues/29)
logMessage = String.format("%sUnable to commit changes. Most likely you are trying to integrate a change that was already integrated. Message was:%n%s", PretestedIntegrationBuildWrapper.LOG_PREFIX, ex.getMessage());
LOGGER.log(Level.SEVERE, logMessage, ex);
listener.getLogger().println(logMessage);
throw new IntegrationFailedException(ex);
} catch (IOException | InterruptedException ex) {
logMessage = String.format(PretestedIntegrationBuildWrapper.LOG_PREFIX + "Exception while committing. Logging exception msg: %s", ex.getMessage());
LOGGER.log(Level.SEVERE, logMessage, ex);
listener.getLogger().println(logMessage);
throw new IntegrationFailedException(ex);
Expand Down