use of com.thoughtworks.go.domain.materials.Modification in project gocd by gocd.
the class ModificationsMother method multipleModificationList.
public static List<Modification> multipleModificationList(RevisionToUse revisionToUse) {
Modification modification1 = new Modification(MOD_USER, MOD_COMMENT, EMAIL_ADDRESS, TWO_DAYS_AGO_CHECKIN, revisionToUse.next());
modification1.createModifiedFile(MOD_FILE_BUILD_XML, "\\build", MOD_MODIFIED_ACTION);
Modification modification2 = new Modification(MOD_USER_COMMITTER, MOD_COMMENT_2, EMAIL_ADDRESS, YESTERDAY_CHECKIN, revisionToUse.next());
modification2.createModifiedFile(MOD_FILE_OLD_BUILD_XML, "\\build", MOD_MODIFIED_ACTION);
Modification modification3 = new Modification(MOD_USER_WITH_HTML_CHAR, MOD_COMMENT_3, EMAIL_ADDRESS, TODAY_CHECKIN, revisionToUse.next());
modification3.createModifiedFile(MOD_FILE_READ_ME, "\\build", MOD_MODIFIED_ACTION);
List<Modification> modifications = new ArrayList<>();
modifications.add(modification3);
modifications.add(modification2);
modifications.add(modification1);
return modifications;
}
use of com.thoughtworks.go.domain.materials.Modification in project gocd by gocd.
the class ModificationsMother method modifyOneFile.
public static MaterialRevisions modifyOneFile(Materials materials, String revision, String comment, String committer) {
MaterialRevisions materialRevisions = new MaterialRevisions();
Materials expandedMaterials = new Materials();
for (Material material : materials) {
expandedMaterials.add(material);
}
for (Material material : expandedMaterials) {
Modification modification;
if (material instanceof DependencyMaterial) {
DependencyMaterial dependencyMaterial = (DependencyMaterial) material;
modification = oneModifiedFile(committer, dependencyMaterial.getPipelineName() + "/1/" + dependencyMaterial.getStageName() + "/" + revision, TWO_DAYS_AGO_CHECKIN, dependencyMaterial.getPipelineName() + "-1.2.3");
} else {
modification = oneModifiedFile(committer, revision, comment, TWO_DAYS_AGO_CHECKIN);
}
materialRevisions.addRevision(new MaterialRevision(material, true, modification));
}
return materialRevisions;
}
use of com.thoughtworks.go.domain.materials.Modification in project gocd by gocd.
the class StageConverter method createBuildCause.
private ArrayList<StageNotificationDTO.MaterialRevisionDTO> createBuildCause(BuildCause buildCause) {
ArrayList<StageNotificationDTO.MaterialRevisionDTO> revisions = new ArrayList<>();
for (MaterialRevision currentRevision : buildCause.getMaterialRevisions()) {
Map<String, Object> attributes = currentRevision.getMaterial().getAttributes(false);
ArrayList<StageNotificationDTO.ModificationDTO> modifications = new ArrayList<>();
for (Modification modification : currentRevision.getModifications()) {
modifications.add(new StageNotificationDTO.ModificationDTO(modification.getRevision(), modification.getModifiedTime(), modification.getAdditionalDataMap()));
}
revisions.add(new StageNotificationDTO.MaterialRevisionDTO(attributes, currentRevision.isChanged(), modifications));
}
return revisions;
}
use of com.thoughtworks.go.domain.materials.Modification in project gocd by gocd.
the class DependencyMaterialRevision method convert.
/**
* @deprecated used only in tests
*/
public MaterialRevision convert(Material material, Date modifiedTime) {
ArrayList<Modification> modifications = new ArrayList<>();
modifications.add(new Modification(modifiedTime, getRevision(), getPipelineLabel(), null));
return new MaterialRevision(material, modifications);
}
use of com.thoughtworks.go.domain.materials.Modification in project gocd by gocd.
the class GitCommand method gitLog.
private List<Modification> gitLog(String... args) {
// Git log will only show changes before the currently checked out revision
InMemoryStreamConsumer outputStreamConsumer = inMemoryConsumer();
try {
if (!isSubmodule) {
fetch(outputStreamConsumer);
}
} catch (Exception e) {
throw new RuntimeException(String.format("Working directory: %s\n%s", workingDir, outputStreamConsumer.getStdError()), e);
}
CommandLine gitCmd = git(environment).withArg("log").withArgs(args).withWorkingDir(workingDir);
ConsoleResult result = runOrBomb(gitCmd);
GitModificationParser parser = new GitModificationParser();
List<Modification> mods = parser.parse(result.output());
for (Modification mod : mods) {
addModifiedFiles(mod);
}
return mods;
}
Aggregations