summaryrefslogtreecommitdiffstats
path: root/src/db/pkgbases.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/db/pkgbases.rs')
-rw-r--r--src/db/pkgbases.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/db/pkgbases.rs b/src/db/pkgbases.rs
index bf1fa7b..8373024 100644
--- a/src/db/pkgbases.rs
+++ b/src/db/pkgbases.rs
@@ -57,6 +57,17 @@ pub fn get_pkgbase_by_id(db: &Db, id: i64) -> Result<Option<Pkgbase>> {
})
}
+/// The release a pkgbase currently points at, if it points at one. This is a
+/// pointer stored on the pkgbase row, so reading it is a persistence question,
+/// not a review one — the watcher needs it to decide what a change is a change
+/// *from*, and review must not be the only way to ask.
+pub fn accepted_release_for(db: &Db, pb: &Pkgbase) -> Result<Option<ReleaseRow>> {
+ match pb.current_accepted_release_id {
+ Some(id) => release_by_id(db, id),
+ None => Ok(None),
+ }
+}
+
pub fn set_aur_head(writer: &Writer, pkgbase_id: i64, head: &str, mirror: &str) -> Result<()> {
let (h, m) = (head.to_string(), mirror.to_string());