ConsistencyChecker: Factor out a method to check merged status

Change-Id: I073b7d06cb39239c13d02f7ce7c4b6e6a0722a87
This commit is contained in:
Dave Borowitz 2015-05-05 14:36:01 -07:00
parent a7cbb8ea5b
commit 96e0d569ae

View File

@ -311,10 +311,16 @@ public class ConsistencyChecker {
+ " is merged");
return;
}
checkMergedBitMatchesStatus(currPs, currPsCommit, merged);
}
private void checkMergedBitMatchesStatus(PatchSet ps, RevCommit commit,
boolean merged) {
String refName = change.getDest().get();
if (merged && change.getStatus() != Change.Status.MERGED) {
ProblemInfo p = problem(String.format(
"Patch set %d (%s) is merged into destination ref %s (%s), but change"
+ " status is %s", currPs.getId().get(), currPsCommit.name(),
+ " status is %s", ps.getId().get(), commit.name(),
refName, tip.name(), change.getStatus()));
if (fix != null) {
fixMerged(p);
@ -322,7 +328,7 @@ public class ConsistencyChecker {
} else if (!merged && change.getStatus() == Change.Status.MERGED) {
problem(String.format("Patch set %d (%s) is not merged into"
+ " destination ref %s (%s), but change status is %s",
currPs.getId().get(), currPsCommit.name(), refName, tip.name(),
currPs.getId().get(), commit.name(), refName, tip.name(),
change.getStatus()));
}
}