From 4aafaea2f511279a6cf3a8582e2c5e61be369815 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 6 Jun 2021 13:06:07 +0000 Subject: branches: update for staging-next-21.05 21.05 is the first release to use a staging-next-* branch. --- src/branches.rs | 55 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 6 deletions(-) diff --git a/src/branches.rs b/src/branches.rs index 8afc726..3ca3d0d 100644 --- a/src/branches.rs +++ b/src/branches.rs @@ -7,15 +7,17 @@ use std::collections::BTreeMap; use once_cell::sync::Lazy; 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-next\z", "master"), + (r"\Astaging-next-([\d.]+)\z", "release-$1"), (r"\Amaster\z", "nixpkgs-unstable"), (r"\Amaster\z", "nixos-unstable-small"), (r"\Anixos-(.*)-small\z", "nixos-$1"), (r"\Arelease-([\d.]+)\z", "nixpkgs-$1-darwin"), (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>> = Lazy::new(|| { @@ -55,8 +57,49 @@ pub fn next_branches(branch: &str) -> Vec> { .collect() } -#[test] -fn test_next_branches() { - let res = next_branches("release-20.09"); - assert_eq!(res, vec!["nixpkgs-20.09-darwin", "nixos-20.09-small"]) +#[cfg(test)] +mod tests { + use super::*; + + #[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"]); + } } -- cgit 1.4.1