branches: update for staging-next-21.05

21.05 is the first release to use a staging-next-* branch.
This commit is contained in:
Alyssa Ross 2021-06-06 13:06:07 +00:00
parent 11a727337c
commit 4aafaea2f5
No known key found for this signature in database
GPG key ID: F9DBED4859B271C0

View file

@ -7,15 +7,17 @@ use std::collections::BTreeMap;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use regex::{Regex, RegexSet}; use regex::{Regex, RegexSet};
const NEXT_BRANCH_TABLE: [(&str, &str); 8] = [ const NEXT_BRANCH_TABLE: [(&str, &str); 10] = [
(r"\Astaging\z", "staging-next"), (r"\Astaging\z", "staging-next"),
(r"\Astaging-next\z", "master"), (r"\Astaging-next\z", "master"),
(r"\Astaging-next-([\d.]+)\z", "release-$1"),
(r"\Amaster\z", "nixpkgs-unstable"), (r"\Amaster\z", "nixpkgs-unstable"),
(r"\Amaster\z", "nixos-unstable-small"), (r"\Amaster\z", "nixos-unstable-small"),
(r"\Anixos-(.*)-small\z", "nixos-$1"), (r"\Anixos-(.*)-small\z", "nixos-$1"),
(r"\Arelease-([\d.]+)\z", "nixpkgs-$1-darwin"), (r"\Arelease-([\d.]+)\z", "nixpkgs-$1-darwin"),
(r"\Arelease-([\d.]+)\z", "nixos-$1-small"), (r"\Arelease-([\d.]+)\z", "nixos-$1-small"),
(r"\Astaging-([\d.]*)\z", "release-$1"), (r"\Astaging-((1.|20)\.\d{2})\z", "release-$1"),
(r"\Astaging-((2[1-9]|[3-90].)\.\d{2})\z", "staging-next-$1"),
]; ];
static BRANCH_NEXTS: Lazy<BTreeMap<&str, Vec<&str>>> = Lazy::new(|| { static BRANCH_NEXTS: Lazy<BTreeMap<&str, Vec<&str>>> = Lazy::new(|| {
@ -55,8 +57,49 @@ pub fn next_branches(branch: &str) -> Vec<Cow<str>> {
.collect() .collect()
} }
#[test] #[cfg(test)]
fn test_next_branches() { mod tests {
let res = next_branches("release-20.09"); use super::*;
assert_eq!(res, vec!["nixpkgs-20.09-darwin", "nixos-20.09-small"])
#[test]
fn staging_18_03() {
let res = next_branches("staging-18.03");
assert_eq!(res, vec!["release-18.03"]);
}
#[test]
fn staging_20_09() {
let res = next_branches("staging-20.09");
assert_eq!(res, vec!["release-20.09"]);
}
#[test]
fn staging_21_05() {
let res = next_branches("staging-21.05");
assert_eq!(res, vec!["staging-next-21.05"]);
}
#[test]
fn staging_30_05() {
let res = next_branches("staging-30.05");
assert_eq!(res, vec!["staging-next-30.05"]);
}
#[test]
fn staging_00_11() {
let res = next_branches("staging-00.11");
assert_eq!(res, vec!["staging-next-00.11"]);
}
#[test]
fn staging_next_21_05() {
let res = next_branches("staging-next-21.05");
assert_eq!(res, vec!["release-21.05"]);
}
#[test]
fn release_20_09() {
let res = next_branches("release-20.09");
assert_eq!(res, vec!["nixpkgs-20.09-darwin", "nixos-20.09-small"]);
}
} }