Java源码示例:jetbrains.buildServer.vcs.SVcsModification
示例1
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));
}
}
示例2
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;
}
示例3
public List<SVcsModification> getChanges(SelectPrevBuildPolicy arg0,
boolean arg1) {
// TODO Auto-generated method stub
return null;
}
示例4
public List<SVcsModification> getContainingChanges() {
// TODO Auto-generated method stub
return null;
}
示例5
@NotNull
@Override
public List<SVcsModification> getContainingChanges() {
return null;
}
示例6
@NotNull
@Override
public List<SVcsModification> getChanges(SelectPrevBuildPolicy selectPrevBuildPolicy, boolean b) {
return null;
}