L + Ratio
parent: tbd commit: 1f5f028
1 | use FromStr; |
2 | |
3 | use ; |
4 | |
5 | use ; |
6 | |
7 | |
8 | |
9 | pub owner: User, |
10 | pub name: String, |
11 | /// Instance the repository is on |
12 | pub instance: Instance, |
13 | |
14 | |
15 | |
16 | |
17 | format! |
18 | "{}/{}@{}" |
19 | self.owner.to_string, |
20 | self.name, |
21 | self.instance.to_string |
22 | ) |
23 | |
24 | |
25 | |
26 | |
27 | type Err = ; |
28 | |
29 | |
30 | let mut by_ampersand = s.split; |
31 | let mut path_split = by_ampersand.next .unwrap .split; |
32 | |
33 | let instance = from_str .unwrap; |
34 | let owner = from_str .unwrap; |
35 | let name = path_split.next .unwrap .to_string; |
36 | |
37 | Ok |
38 | instance, |
39 | owner, |
40 | name, |
41 | |
42 | |
43 | |
44 | |
45 | /// Visibility of the repository to the general eye |
46 | |
47 | |
48 | |
49 | Public, |
50 | Unlisted, |
51 | Private, |
52 | |
53 | |
54 | |
55 | |
56 | /// Name of the repository |
57 | /// |
58 | /// This is different than the [`Repository`] name, |
59 | /// which may be a path. |
60 | pub name: String, |
61 | /// Owner of the Repository |
62 | pub owner: User, |
63 | /// Repository description |
64 | pub description: , |
65 | /// Repository visibility |
66 | pub visibility: RepositoryVisibility, |
67 | /// Default branch of the repository |
68 | pub default_branch: String, |
69 | /// Last commit made to the repository |
70 | pub latest_commit: , |
71 | /// Revision of the displayed tree |
72 | pub tree_rev: , |
73 | /// Repository tree |
74 | pub tree: , |
75 | |
76 | |
77 | |
78 | |
79 | Tree, |
80 | Blob, |
81 | |
82 | |
83 | /// Stored info for our tree entries |
84 | |
85 | |
86 | /// Name of the tree/blob |
87 | pub name: String, |
88 | /// Type of the tree entry |
89 | pub object_type: RepositoryObjectType, |
90 | /// Git supplies us with the mode at all times, and people like it displayed. |
91 | pub mode: i32, |
92 | /// File size |
93 | pub size: , |
94 | /// Last commit made to the tree/blob |
95 | pub last_commit: , |
96 | |
97 | |
98 | |
99 | // I love you Emilia <3 |
100 | |
101 | Self |
102 | name: name.to_string, |
103 | object_type, |
104 | mode, |
105 | size: None, |
106 | last_commit: None, |
107 | |
108 | |
109 | |
110 | |
111 | |
112 | |
113 | pub tree_entry: RepositoryTreeEntry, |
114 | pub commit: Commit, |
115 | |
116 | |
117 | /// Info about a git commit |
118 | |
119 | |
120 | /// Unique commit ID |
121 | pub oid: String, |
122 | /// Full commit message |
123 | pub message: , |
124 | /// Who created the commit |
125 | pub author: CommitSignature, |
126 | /// Who committed the commit |
127 | pub committer: CommitSignature, |
128 | /// Time when the commit happened |
129 | pub time: NaiveDateTime, |
130 | |
131 | |
132 | /// Gets all info from [`git2::Commit`] for easy use |
133 | |
134 | |
135 | Self |
136 | oid: commit.id .to_string, |
137 | message: commit.message .map, |
138 | author: commit.author .into, |
139 | committer: commit.committer .into, |
140 | time: from_timestamp_opt .unwrap, |
141 | |
142 | |
143 | |
144 | |
145 | /// Git commit signature |
146 | |
147 | |
148 | pub name: , |
149 | pub email: , |
150 | pub time: NaiveDateTime, |
151 | |
152 | |
153 | /// Converts the signature from git2 into something usable without explicit lifetimes. |
154 | |
155 | |
156 | Self |
157 | name: signature.name .map, |
158 | email: signature.email .map, |
159 | time: from_timestamp_opt .unwrap, |
160 | |
161 | |
162 | |
163 |