#115 - Train checkout now correctly identifies when to checkout master branch.
We now try to find a GA release tag for each module on train checkout. If that's not found, we check out the master branch instead of the maintenance branch. Removed unnecessary invocation of git pull as the checkout before has already pulled the respective branch.
This commit is contained in:
@@ -48,6 +48,7 @@ import org.springframework.data.release.io.Workspace;
|
||||
import org.springframework.data.release.issues.IssueTracker;
|
||||
import org.springframework.data.release.issues.Ticket;
|
||||
import org.springframework.data.release.model.ArtifactVersion;
|
||||
import org.springframework.data.release.model.Iteration;
|
||||
import org.springframework.data.release.model.ModuleIteration;
|
||||
import org.springframework.data.release.model.Project;
|
||||
import org.springframework.data.release.model.Train;
|
||||
@@ -121,16 +122,15 @@ public class GitOperations {
|
||||
|
||||
doWithGit(project, git -> {
|
||||
|
||||
Branch branch = Branch.from(module);
|
||||
ModuleIteration gaIteration = train.getModuleIteration(project, Iteration.GA);
|
||||
Optional<Tag> gaTag = findTagFor(project, ArtifactVersion.of(gaIteration));
|
||||
|
||||
if (!branchExists(project, branch) && !branchExists(project, Branch.from("origin/" + branch.toString()))) {
|
||||
|
||||
logger.warn(project, "Branch %s does not exist. Using %s.", branch, Branch.MASTER);
|
||||
|
||||
masterSwitch.set(true);
|
||||
branch = Branch.MASTER;
|
||||
if (!gaTag.isPresent()) {
|
||||
logger.log(project, "Checking out master branch as no GA release tag could be found!");
|
||||
}
|
||||
|
||||
Branch branch = gaTag.isPresent() ? Branch.from(module) : Branch.MASTER;
|
||||
|
||||
CheckoutCommand command = git.checkout().setName(branch.toString());
|
||||
|
||||
if (!branchExists(project, branch)) {
|
||||
@@ -285,9 +285,6 @@ public class GitOperations {
|
||||
logger.log(project, "git fetch --tags");
|
||||
git.fetch().setTagOpt(TagOpt.FETCH_TAGS).call();
|
||||
|
||||
logger.log(project, "git pull");
|
||||
git.pull().call();
|
||||
|
||||
} else {
|
||||
clone(project);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2014-2018 the original author or authors.
|
||||
* Copyright 2014-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,7 +18,6 @@ package org.springframework.data.release.model;
|
||||
import static org.springframework.data.release.model.Iteration.*;
|
||||
import static org.springframework.data.release.model.Projects.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@@ -56,19 +55,11 @@ public class ReleaseTrains {
|
||||
|
||||
LOVELACE = KAY.next("Lovelace", Transition.MINOR, new Module(JDBC, "1.0"), new Module(SOLR, "4.0"));
|
||||
|
||||
MOORE = LOVELACE.next("Moore", Transition.MINOR).withIterations(new Iterations(M1, M2, M3, RC1, RC2));
|
||||
MOORE = LOVELACE.next("Moore", Transition.MINOR).withIterations(new Iterations(M1, M2, M3, RC1, RC2, GA));
|
||||
|
||||
// Trains
|
||||
|
||||
TRAINS = Arrays.asList(CODD, DIJKSTRA, EVANS, FOWLER, GOSLING, HOPPER, INGALLS, KAY, LOVELACE, MOORE);
|
||||
|
||||
// Train names
|
||||
|
||||
List<String> names = new ArrayList<>(TRAINS.size());
|
||||
|
||||
for (Train train : TRAINS) {
|
||||
names.add(train.getName());
|
||||
}
|
||||
}
|
||||
|
||||
private static Train codd() {
|
||||
@@ -107,23 +98,17 @@ public class ReleaseTrains {
|
||||
|
||||
public static Train getTrainByName(String name) {
|
||||
|
||||
for (Train train : TRAINS) {
|
||||
if (train.getName().equalsIgnoreCase(name)) {
|
||||
return train;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return TRAINS.stream() //
|
||||
.filter(it -> it.getName().equalsIgnoreCase(name)) //
|
||||
.findFirst() //
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
public static Project getProjectByName(String name) {
|
||||
|
||||
for (Project project : PROJECTS) {
|
||||
if (project.getName().equalsIgnoreCase(name)) {
|
||||
return project;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
return PROJECTS.stream() //
|
||||
.filter(it -> it.getName().equalsIgnoreCase(name)) //
|
||||
.findFirst() //
|
||||
.orElse(null);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user