add custom date for syncing file

Signed-off-by: Pakin <pakin.t@forth.co.th>
This commit is contained in:
Pakin 2025-09-19 10:25:16 +07:00
parent daeb5a9277
commit f9be519e03

View file

@ -192,6 +192,7 @@ impl FirmwareFilterOptions {
pub struct XBuilder {
saved_firmwares: Vec<LastBuildFirmware>,
base: Option<LastBuildFirmware>,
date_sync: Option<DateTime<Utc>>,
}
impl XBuilder {
@ -201,6 +202,7 @@ impl XBuilder {
Self {
saved_firmwares,
base: None,
date_sync: None,
}
}
@ -283,6 +285,11 @@ impl XBuilder {
self.base = Some(base);
}
/// Ignoring base firmware build date and use expected date instead
pub fn set_date_for_sync_file(&mut self, date: DateTime<Utc>) {
self.date_sync = Some(date);
}
/// get file from commit(s) that should be added to newer firmware file
pub fn sync_file_list(&mut self) -> Vec<String> {
let mut result = Vec::new();
@ -295,7 +302,10 @@ impl XBuilder {
let git_res = git2::Repository::open(taobin_repo);
let last_build_from_base = self.base.as_ref().unwrap().date.timestamp();
let mut last_build_from_base = self.base.as_ref().unwrap().date.timestamp();
if self.date_sync.is_some() {
last_build_from_base = self.date_sync.unwrap().timestamp();
}
match git_res {
Ok(repo) => {