forked from Praqma/pretested-integration-plugin
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JENKINS-28590 Re-use author on commit and refactor:
The integration commit will have the author of the last commit on the development branch being integrated. In both accumulated and squash strategy the author of the last commit is collected and used with the '--author' switch during commit of the integration commit. The implementation includes large refactoring to improve logging, console output FIXME - Maven pom file, updated java ncss tool from version 2.0 to 2.1 as it failed to parse java 7 multi catch constructs Logging changes in general: - user information that is written to job console is now also logged - LOG_PREFIX which equals '[PREINT]' is added to all changed logging lines for consistency Accumulated and squash strategy implementations: - changed, restructured the work flow reporting to the job console - made output to job console almost identical between the two strategies - added more progress and logging during the work flow - separated merge and commit in two phases, each handling exceptions and git command exit codes individually - splitting merge and commit needed to allow to use the option --author to set the author of the commit Finding the author: - implemented as a call back method, to support remoting - copy and re-use from a like method GitBridge - the post-build step pushing integration branch and deleting development branch: - added better error reporting, showing output message and exception if failing Test MultipleScm_threeRepos_IT: - improved the wait for activity function to only return if result is valid, not only when there is a temporary one and the job is still building
- Loading branch information
Bue Petersen
committed
Jun 29, 2015
1 parent
539efc7
commit 79f125e
Showing
13 changed files
with
647 additions
and
86 deletions.
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
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
37 changes: 37 additions & 0 deletions
37
...ain/java/org/jenkinsci/plugins/pretestedintegration/scm/git/FindCommitAuthorCallback.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,37 @@ | ||
/* | ||
* To change this license header, choose License Headers in Project Properties. | ||
* To change this template file, choose Tools | Templates | ||
* and open the template in the editor. | ||
*/ | ||
package org.jenkinsci.plugins.pretestedintegration.scm.git; | ||
|
||
import hudson.model.TaskListener; | ||
import hudson.remoting.VirtualChannel; | ||
import java.io.IOException; | ||
import java.util.logging.Logger; | ||
import org.eclipse.jgit.lib.ObjectId; | ||
import org.eclipse.jgit.lib.Repository; | ||
import org.eclipse.jgit.revwalk.RevCommit; | ||
import org.eclipse.jgit.revwalk.RevWalk; | ||
|
||
public class FindCommitAuthorCallback extends RepositoryListenerAwareCallback<String> { | ||
|
||
private static final Logger logger = Logger.getLogger(FindCommitAuthorCallback.class.getName());// Generated code DONT TOUCH! Bookmark: 3ca61d8e671737b5ead8aaccd31875c4 | ||
|
||
public final ObjectId id; | ||
|
||
public FindCommitAuthorCallback(TaskListener listener, final ObjectId id) { | ||
super(listener); | ||
this.id = id; | ||
} | ||
|
||
@Override | ||
public String invoke(Repository repo, VirtualChannel channel) throws IOException, InterruptedException { | ||
logger.entering("FindCommitAuthorCallback", "invoke", new Object[]{channel, repo});// Generated code DONT TOUCH! Bookmark: 3e9f1bb124a68aa51ae943d0e765a528 | ||
RevWalk walk = new RevWalk(repo); | ||
RevCommit commit = walk.parseCommit(id); | ||
walk.dispose(); | ||
logger.exiting("FindCommitAuthorCallback", "end");// Generated code DONT TOUCH! Bookmark: 2412143d613a394b72a1b1da928ce975 | ||
return commit.getAuthorIdent().toExternalString(); | ||
} | ||
} |
Oops, something went wrong.