about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2021-06-06 13:06:07 +0000
committerAlyssa Ross <hi@alyssa.is>2021-06-06 13:40:16 +0000
commit4aafaea2f511279a6cf3a8582e2c5e61be369815 (patch)
tree274ab3fd2cc9728a139a9c899afdc55e196820d1
parent11a727337c03284b231b7a637d1aec4dbef02733 (diff)
downloadpr-tracker-4aafaea2f511279a6cf3a8582e2c5e61be369815.tar
pr-tracker-4aafaea2f511279a6cf3a8582e2c5e61be369815.tar.gz
pr-tracker-4aafaea2f511279a6cf3a8582e2c5e61be369815.tar.bz2
pr-tracker-4aafaea2f511279a6cf3a8582e2c5e61be369815.tar.lz
pr-tracker-4aafaea2f511279a6cf3a8582e2c5e61be369815.tar.xz
pr-tracker-4aafaea2f511279a6cf3a8582e2c5e61be369815.tar.zst
pr-tracker-4aafaea2f511279a6cf3a8582e2c5e61be369815.zip
branches: update for staging-next-21.05
21.05 is the first release to use a staging-next-* branch.
-rw-r--r--src/branches.rs55
1 files 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<BTreeMap<&str, Vec<&str>>> = Lazy::new(|| {
@@ -55,8 +57,49 @@ pub fn next_branches(branch: &str) -> Vec<Cow<str>> {
         .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"]);
+    }
 }