liboxen/model/
base_head.rs

1use serde::{Deserialize, Serialize};
2
3/// For creating a remote repo we need the repo name
4/// and we need the root commit so that we do not generate a new one on creation on the server
5#[derive(Deserialize, Serialize, Debug, Clone)]
6pub struct BaseHead {
7    pub base: String,
8    pub head: String,
9}
10
11impl BaseHead {
12    pub fn new(base: String, head: String) -> BaseHead {
13        BaseHead { base, head }
14    }
15}
16
17impl std::fmt::Display for BaseHead {
18    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19        write!(f, "{}..{}", self.base, self.head)
20    }
21}
22
23impl std::error::Error for BaseHead {}