about summary refs log tree commit diff
path: root/src/tree.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/tree.rs')
-rw-r--r--src/tree.rs18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/tree.rs b/src/tree.rs
index f569dba..91dc05d 100644
--- a/src/tree.rs
+++ b/src/tree.rs
@@ -1,11 +1,13 @@
 // SPDX-License-Identifier: AGPL-3.0-or-later WITH GPL-3.0-linking-exception
 // SPDX-FileCopyrightText: 2021 Alyssa Ross <hi@alyssa.is>
+// SPDX-FileCopyrightText: 2022 Arnout Engelen <arnout@bzzt.net>
 
 use std::collections::BTreeSet;
 use std::ffi::{OsStr, OsString};
 
 use askama::Template;
 
+use crate::branches::branch_hydra_link;
 use crate::branches::next_branches;
 use crate::github;
 use crate::nixpkgs::Nixpkgs;
@@ -15,6 +17,7 @@ use crate::nixpkgs::Nixpkgs;
 pub struct Tree {
     branch_name: String,
     accepted: Option<bool>,
+    hydra_link: Option<String>,
     children: Vec<Tree>,
 }
 
@@ -27,9 +30,12 @@ impl Tree {
             .map(|b| Self::generate(b.to_string(), found_branches))
             .collect();
 
+        let link = branch_hydra_link(&branch);
+
         Tree {
             accepted: None,
             branch_name: branch,
+            hydra_link: link,
             children: nexts,
         }
     }
@@ -46,7 +52,11 @@ impl Tree {
         }
     }
 
-    pub async fn make(base_branch: String, merge_status: &github::PullRequestStatus, nixpkgs: &Nixpkgs<'_>) -> Tree {
+    pub async fn make(
+        base_branch: String,
+        merge_status: &github::PullRequestStatus,
+        nixpkgs: &Nixpkgs<'_>,
+    ) -> Tree {
         let mut missing_means_absent = true;
         let mut branches = BTreeSet::new();
 
@@ -59,9 +69,9 @@ impl Tree {
             if let Some(merge_commit) = merge_commit_oid {
                 let mut containing_commits = BTreeSet::new();
 
-                if let Err(e) =
-                    nixpkgs.branches_containing_commit(&merge_commit, &mut containing_commits)
-                        .await
+                if let Err(e) = nixpkgs
+                    .branches_containing_commit(merge_commit, &mut containing_commits)
+                    .await
                 {
                     eprintln!("pr-tracker: branches_containing_commit: {}", e);
                     missing_means_absent = false;