jetbrains.buildServer.vcs.SVcsModification Java Examples

The following examples show how to use jetbrains.buildServer.vcs.SVcsModification. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PayloadContentCommits.java    From tcSlackBuildNotifier with MIT License 6 votes vote down vote up
public void populateCommits(SRunningBuild sRunningBuild) {
    List<SVcsModification> changes = sRunningBuild.getContainingChanges();
    if (changes == null) {
        return;
    }

    for (SVcsModification change : changes) {
        Collection<SUser> committers = change.getCommitters();
        String slackUserId = null;
        if (!committers.isEmpty()) {
            SUser committer = committers.iterator().next();
            slackUserId = committer.getPropertyValue(SlackNotificator.USERID_KEY);
            Loggers.ACTIVITIES.debug("Resolved committer " + change.getUserName() + " to Slack User " + slackUserId);
        }
        commits.add(new Commit(change.getVersion(), change.getDescription(), change.getUserName(), slackUserId));
    }
}
 
Example #2
Source File: SlackServerAdapter.java    From TCSlackNotifierPlugin with MIT License 4 votes vote down vote up
private JsonObject createCommitAttachment(SRunningBuild build) {
    String ignoreCommitMessage = build.getParametersProvider().get("system.SLACK_IGNORE_COMMIT_MESSAGE");
    if (ignoreCommitMessage != null && ignoreCommitMessage.equalsIgnoreCase("true")) return null;

    List<SVcsModification>  changes =  build.getChanges(SelectPrevBuildPolicy.SINCE_LAST_SUCCESSFULLY_FINISHED_BUILD, true);

    StringBuilder commitMessage = new StringBuilder();

    /*
     * If this field starts to feel too long in slack, we should only use the first item in the array, which would be the latest change
     *
     */
    for ( int i = 0 ; i < changes.size() ; i++ ){
        SVcsModification modification = changes.get(i);
        String desc = modification.getDescription();
        commitMessage.append("‣ ");
        commitMessage.append(desc);

        if( i < changes.size() - 1 ) {
            commitMessage.append("\n");
        }
    }

    if (changes.size() < 1) {
        return null;
    }


    String commitMessageString = commitMessage.toString();
    JsonObject attachment = new JsonObject();
    attachment.addProperty("title", "Commit Messages");
    attachment.addProperty("fallback" , commitMessageString);
    attachment.addProperty("text" , commitMessageString);
    attachment.addProperty("color" , "#2FA8B9");

    Branch branch = build.getBranch();
    if (branch != null) {
        attachment.addProperty("footer" , String.format("Built from %s", branch.getDisplayName()) );

        Date finishDate = build.getFinishDate();
        if (finishDate != null ) {
            long finishTime = finishDate.getTime()/1000;
            attachment.addProperty("ts" , finishTime);
        }
    }

    return attachment;

}
 
Example #3
Source File: MockSRunningBuild.java    From tcSlackBuildNotifier with MIT License 4 votes vote down vote up
public List<SVcsModification> getChanges(SelectPrevBuildPolicy arg0,
		boolean arg1) {
	// TODO Auto-generated method stub
	return null;
}
 
Example #4
Source File: MockSRunningBuild.java    From tcSlackBuildNotifier with MIT License 4 votes vote down vote up
public List<SVcsModification> getContainingChanges() {
	// TODO Auto-generated method stub
	return null;
}
 
Example #5
Source File: ReportsMain.java    From appengine-tck with Apache License 2.0 4 votes vote down vote up
@NotNull
@Override
public List<SVcsModification> getContainingChanges() {
    return null;
}
 
Example #6
Source File: ReportsMain.java    From appengine-tck with Apache License 2.0 4 votes vote down vote up
@NotNull
@Override
public List<SVcsModification> getChanges(SelectPrevBuildPolicy selectPrevBuildPolicy, boolean b) {
    return null;
}