7
7
// option. This file may not be copied, modified, or distributed
8
8
// except according to those terms.
9
9
10
- use std:: collections:: { BTreeMap , BTreeSet , HashMap , HashSet } ;
10
+ use std:: collections:: { BTreeSet , HashMap , HashSet } ;
11
11
use std:: env;
12
12
use std:: fs;
13
13
use std:: path:: { Path , PathBuf } ;
@@ -171,7 +171,7 @@ pub struct InputData {
171
171
/// Not all commits are in this map.
172
172
pub interpolated : HashMap < String , Vec < Interpolation > > ,
173
173
174
- pub artifact_data : BTreeMap < String , ArtifactData > ,
174
+ pub artifact_data : HashMap < String , ArtifactData > ,
175
175
176
176
pub commits : Vec < Commit > ,
177
177
@@ -192,8 +192,9 @@ impl InputData {
192
192
pub fn from_fs ( repo_loc : & str ) -> anyhow:: Result < InputData > {
193
193
let repo_loc = PathBuf :: from ( repo_loc) ;
194
194
let mut skipped = 0 ;
195
- let mut artifact_data = BTreeMap :: new ( ) ;
196
- let mut data = HashMap :: new ( ) ;
195
+ let mut artifact_data = HashMap :: new ( ) ;
196
+ let mut data = Vec :: new ( ) ;
197
+ let mut commits = HashSet :: new ( ) ;
197
198
198
199
if !repo_loc. exists ( ) {
199
200
// If the repository doesn't yet exist, simplify clone it to the given location.
@@ -275,7 +276,9 @@ impl InputData {
275
276
continue ;
276
277
}
277
278
278
- data. insert ( contents. commit . clone ( ) , contents) ;
279
+ if commits. insert ( contents. commit . clone ( ) ) {
280
+ data. push ( contents) ;
281
+ }
279
282
}
280
283
}
281
284
@@ -292,15 +295,15 @@ impl InputData {
292
295
}
293
296
} ;
294
297
295
- InputData :: new ( data. into_iter ( ) . collect ( ) , artifact_data, config)
298
+ data. sort_unstable_by_key ( |d| d. commit . clone ( ) ) ;
299
+ InputData :: new ( data, artifact_data, config)
296
300
}
297
301
298
302
pub fn new (
299
- data : BTreeMap < Commit , CommitData > ,
300
- artifact_data : BTreeMap < String , ArtifactData > ,
303
+ data : Vec < CommitData > ,
304
+ artifact_data : HashMap < String , ArtifactData > ,
301
305
config : Config ,
302
306
) -> anyhow:: Result < InputData > {
303
- let data = data. into_iter ( ) . map ( |( _, v) | v) . collect :: < Vec < _ > > ( ) ;
304
307
let mut last_date = None ;
305
308
let mut stats_list = BTreeSet :: new ( ) ;
306
309
0 commit comments