Merge pull request #395 from ryantm/leaf

add label for exactly 1 rebuild
This commit is contained in:
Graham Christensen 2020-04-01 20:44:25 -04:00 committed by GitHub
commit 9548a495d5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -121,6 +121,7 @@ impl Default for RebuildTagger {
RebuildTagger {
possible: vec![
String::from("10.rebuild-darwin: 0"),
String::from("10.rebuild-darwin: 1"),
String::from("10.rebuild-darwin: 1-10"),
String::from("10.rebuild-darwin: 11-100"),
String::from("10.rebuild-darwin: 101-500"),
@ -130,6 +131,7 @@ impl Default for RebuildTagger {
String::from("10.rebuild-darwin: 2501-5000"),
String::from("10.rebuild-darwin: 5001+"),
String::from("10.rebuild-linux: 0"),
String::from("10.rebuild-linux: 1"),
String::from("10.rebuild-linux: 1-10"),
String::from("10.rebuild-linux: 11-100"),
String::from("10.rebuild-linux: 101-500"),
@ -223,8 +225,10 @@ impl RebuildTagger {
&["101-500"]
} else if count > 10 {
&["11-100"]
} else if count > 0 {
} else if count > 1 {
&["1-10"]
} else if count > 0 {
&["1", "1-10"]
} else {
&["0"]
}
@ -381,6 +385,7 @@ mod tests {
assert_eq!(
tagger.tags_to_remove(),
vec![
"10.rebuild-darwin: 1",
"10.rebuild-darwin: 1-10",
"10.rebuild-darwin: 11-100",
"10.rebuild-darwin: 101-500",
@ -389,6 +394,7 @@ mod tests {
"10.rebuild-darwin: 1001-2500",
"10.rebuild-darwin: 2501-5000",
"10.rebuild-darwin: 5001+",
"10.rebuild-linux: 1",
"10.rebuild-linux: 1-10",
"10.rebuild-linux: 11-100",
"10.rebuild-linux: 101-500",
@ -405,11 +411,16 @@ mod tests {
assert_eq!(
tagger.tags_to_add(),
vec!["10.rebuild-darwin: 0", "10.rebuild-linux: 1-10",]
vec![
"10.rebuild-darwin: 0",
"10.rebuild-linux: 1",
"10.rebuild-linux: 1-10",
]
);
assert_eq!(
tagger.tags_to_remove(),
vec![
"10.rebuild-darwin: 1",
"10.rebuild-darwin: 1-10",
"10.rebuild-darwin: 11-100",
"10.rebuild-darwin: 101-500",
@ -433,7 +444,12 @@ mod tests {
tagger.parse_attrs(PackageArchSrc::linux(1).and_darwin(1).into());
assert_eq!(
tagger.tags_to_add(),
vec!["10.rebuild-darwin: 1-10", "10.rebuild-linux: 1-10",]
vec![
"10.rebuild-darwin: 1",
"10.rebuild-darwin: 1-10",
"10.rebuild-linux: 1",
"10.rebuild-linux: 1-10",
]
);
assert_eq!(
tagger.tags_to_remove(),
@ -467,6 +483,7 @@ mod tests {
tagger.tags_to_remove(),
vec![
"10.rebuild-darwin: 0",
"10.rebuild-darwin: 1",
"10.rebuild-darwin: 11-100",
"10.rebuild-darwin: 101-500",
"10.rebuild-darwin: 501+",
@ -475,6 +492,7 @@ mod tests {
"10.rebuild-darwin: 2501-5000",
"10.rebuild-darwin: 5001+",
"10.rebuild-linux: 0",
"10.rebuild-linux: 1",
"10.rebuild-linux: 11-100",
"10.rebuild-linux: 101-500",
"10.rebuild-linux: 501+",
@ -495,6 +513,7 @@ mod tests {
tagger.tags_to_remove(),
vec![
"10.rebuild-darwin: 0",
"10.rebuild-darwin: 1",
"10.rebuild-darwin: 1-10",
"10.rebuild-darwin: 101-500",
"10.rebuild-darwin: 501+",
@ -503,6 +522,7 @@ mod tests {
"10.rebuild-darwin: 2501-5000",
"10.rebuild-darwin: 5001+",
"10.rebuild-linux: 0",
"10.rebuild-linux: 1",
"10.rebuild-linux: 1-10",
"10.rebuild-linux: 101-500",
"10.rebuild-linux: 501+",
@ -523,6 +543,7 @@ mod tests {
tagger.tags_to_remove(),
vec![
"10.rebuild-darwin: 0",
"10.rebuild-darwin: 1",
"10.rebuild-darwin: 1-10",
"10.rebuild-darwin: 101-500",
"10.rebuild-darwin: 501+",
@ -531,6 +552,7 @@ mod tests {
"10.rebuild-darwin: 2501-5000",
"10.rebuild-darwin: 5001+",
"10.rebuild-linux: 0",
"10.rebuild-linux: 1",
"10.rebuild-linux: 1-10",
"10.rebuild-linux: 101-500",
"10.rebuild-linux: 501+",
@ -551,6 +573,7 @@ mod tests {
tagger.tags_to_remove(),
vec![
"10.rebuild-darwin: 0",
"10.rebuild-darwin: 1",
"10.rebuild-darwin: 1-10",
"10.rebuild-darwin: 11-100",
"10.rebuild-darwin: 501+",
@ -559,6 +582,7 @@ mod tests {
"10.rebuild-darwin: 2501-5000",
"10.rebuild-darwin: 5001+",
"10.rebuild-linux: 0",
"10.rebuild-linux: 1",
"10.rebuild-linux: 1-10",
"10.rebuild-linux: 11-100",
"10.rebuild-linux: 501+",
@ -579,6 +603,7 @@ mod tests {
tagger.tags_to_remove(),
vec![
"10.rebuild-darwin: 0",
"10.rebuild-darwin: 1",
"10.rebuild-darwin: 1-10",
"10.rebuild-darwin: 11-100",
"10.rebuild-darwin: 501+",
@ -587,6 +612,7 @@ mod tests {
"10.rebuild-darwin: 2501-5000",
"10.rebuild-darwin: 5001+",
"10.rebuild-linux: 0",
"10.rebuild-linux: 1",
"10.rebuild-linux: 1-10",
"10.rebuild-linux: 11-100",
"10.rebuild-linux: 501+",
@ -612,6 +638,7 @@ mod tests {
tagger.tags_to_remove(),
vec![
"10.rebuild-darwin: 0",
"10.rebuild-darwin: 1",
"10.rebuild-darwin: 1-10",
"10.rebuild-darwin: 11-100",
"10.rebuild-darwin: 101-500",
@ -619,6 +646,7 @@ mod tests {
"10.rebuild-darwin: 2501-5000",
"10.rebuild-darwin: 5001+",
"10.rebuild-linux: 0",
"10.rebuild-linux: 1",
"10.rebuild-linux: 1-10",
"10.rebuild-linux: 11-100",
"10.rebuild-linux: 101-500",
@ -643,6 +671,7 @@ mod tests {
tagger.tags_to_remove(),
vec![
"10.rebuild-darwin: 0",
"10.rebuild-darwin: 1",
"10.rebuild-darwin: 1-10",
"10.rebuild-darwin: 11-100",
"10.rebuild-darwin: 101-500",
@ -650,6 +679,7 @@ mod tests {
"10.rebuild-darwin: 2501-5000",
"10.rebuild-darwin: 5001+",
"10.rebuild-linux: 0",
"10.rebuild-linux: 1",
"10.rebuild-linux: 1-10",
"10.rebuild-linux: 11-100",
"10.rebuild-linux: 101-500",
@ -674,6 +704,7 @@ mod tests {
tagger.tags_to_remove(),
vec![
"10.rebuild-darwin: 0",
"10.rebuild-darwin: 1",
"10.rebuild-darwin: 1-10",
"10.rebuild-darwin: 11-100",
"10.rebuild-darwin: 101-500",
@ -681,6 +712,7 @@ mod tests {
"10.rebuild-darwin: 2501-5000",
"10.rebuild-darwin: 5001+",
"10.rebuild-linux: 0",
"10.rebuild-linux: 1",
"10.rebuild-linux: 1-10",
"10.rebuild-linux: 11-100",
"10.rebuild-linux: 101-500",
@ -705,6 +737,7 @@ mod tests {
tagger.tags_to_remove(),
vec![
"10.rebuild-darwin: 0",
"10.rebuild-darwin: 1",
"10.rebuild-darwin: 1-10",
"10.rebuild-darwin: 11-100",
"10.rebuild-darwin: 101-500",
@ -712,6 +745,7 @@ mod tests {
"10.rebuild-darwin: 2501-5000",
"10.rebuild-darwin: 5001+",
"10.rebuild-linux: 0",
"10.rebuild-linux: 1",
"10.rebuild-linux: 1-10",
"10.rebuild-linux: 11-100",
"10.rebuild-linux: 101-500",
@ -736,6 +770,7 @@ mod tests {
tagger.tags_to_remove(),
vec![
"10.rebuild-darwin: 0",
"10.rebuild-darwin: 1",
"10.rebuild-darwin: 1-10",
"10.rebuild-darwin: 11-100",
"10.rebuild-darwin: 101-500",
@ -743,6 +778,7 @@ mod tests {
"10.rebuild-darwin: 1001-2500",
"10.rebuild-darwin: 5001+",
"10.rebuild-linux: 0",
"10.rebuild-linux: 1",
"10.rebuild-linux: 1-10",
"10.rebuild-linux: 11-100",
"10.rebuild-linux: 101-500",
@ -767,6 +803,7 @@ mod tests {
tagger.tags_to_remove(),
vec![
"10.rebuild-darwin: 0",
"10.rebuild-darwin: 1",
"10.rebuild-darwin: 1-10",
"10.rebuild-darwin: 11-100",
"10.rebuild-darwin: 101-500",
@ -774,6 +811,7 @@ mod tests {
"10.rebuild-darwin: 1001-2500",
"10.rebuild-darwin: 5001+",
"10.rebuild-linux: 0",
"10.rebuild-linux: 1",
"10.rebuild-linux: 1-10",
"10.rebuild-linux: 11-100",
"10.rebuild-linux: 101-500",
@ -798,6 +836,7 @@ mod tests {
tagger.tags_to_remove(),
vec![
"10.rebuild-darwin: 0",
"10.rebuild-darwin: 1",
"10.rebuild-darwin: 1-10",
"10.rebuild-darwin: 11-100",
"10.rebuild-darwin: 101-500",
@ -805,6 +844,7 @@ mod tests {
"10.rebuild-darwin: 1001-2500",
"10.rebuild-darwin: 2501-5000",
"10.rebuild-linux: 0",
"10.rebuild-linux: 1",
"10.rebuild-linux: 1-10",
"10.rebuild-linux: 11-100",
"10.rebuild-linux: 101-500",