aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/vcs/fossil_driver.rs
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-09 00:00:12 +0900
committernsfisis <nsfisis@gmail.com>2026-06-09 00:00:49 +0900
commit1c0eb589741de4aa52ef941ff9315b34dbe48aa0 (patch)
tree8d821cf3a7fb3f8c753dec7861ad9597f6948493 /crates/shirabe/src/repository/vcs/fossil_driver.rs
parente5b789616ec4c1cbd152c5ccbefe2d27ced4a18f (diff)
downloadphp-shirabe-1c0eb589741de4aa52ef941ff9315b34dbe48aa0.tar.gz
php-shirabe-1c0eb589741de4aa52ef941ff9315b34dbe48aa0.tar.zst
php-shirabe-1c0eb589741de4aa52ef941ff9315b34dbe48aa0.zip
feat(datetime): resolve datetime TODOs
Introduce shim functions and constants, replacing the ad-hoc chrono format strings and parse helpers used as phase-b placeholders. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/repository/vcs/fossil_driver.rs')
-rw-r--r--crates/shirabe/src/repository/vcs/fossil_driver.rs20
1 files changed, 14 insertions, 6 deletions
diff --git a/crates/shirabe/src/repository/vcs/fossil_driver.rs b/crates/shirabe/src/repository/vcs/fossil_driver.rs
index 0ee20da..15328c0 100644
--- a/crates/shirabe/src/repository/vcs/fossil_driver.rs
+++ b/crates/shirabe/src/repository/vcs/fossil_driver.rs
@@ -1,10 +1,12 @@
//! ref: composer/src/Composer/Repository/Vcs/FossilDriver.php
use crate::io::io_interface;
-use chrono::{DateTime, Utc};
+use chrono::{DateTime, FixedOffset, Utc};
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::Preg;
-use shirabe_php_shim::{PhpMixed, RuntimeException, dirname, is_dir, is_file, is_writable};
+use shirabe_php_shim::{
+ DATE_RFC3339, PhpMixed, RuntimeException, dirname, is_dir, is_file, is_writable,
+};
use crate::cache::Cache;
use crate::config::Config;
@@ -256,7 +258,10 @@ impl FossilDriver {
Ok(Some(content))
}
- pub fn get_change_date(&self, _identifier: &str) -> anyhow::Result<Option<DateTime<Utc>>> {
+ pub fn get_change_date(
+ &self,
+ _identifier: &str,
+ ) -> anyhow::Result<Option<DateTime<FixedOffset>>> {
let mut output = String::new();
self.inner.process.borrow_mut().execute_args(
&["fossil", "finfo", "-b", "-n", "1", "composer.json"]
@@ -268,8 +273,8 @@ impl FossilDriver {
let parts: Vec<&str> = output.trim().splitn(3, ' ').collect();
let date = parts.get(1).copied().unwrap_or("");
- let date = DateTime::parse_from_rfc3339(date).map(|d| d.with_timezone(&Utc))?;
- Ok(Some(date))
+ let date: DateTime<Utc> = shirabe_php_shim::date_create(date)?;
+ Ok(Some(date.fixed_offset()))
}
pub fn get_tags(&mut self) -> anyhow::Result<IndexMap<String, String>> {
@@ -383,7 +388,10 @@ impl crate::repository::vcs::VcsDriverInterface for FossilDriver {
FossilDriver::get_file_content(self, file, identifier)
}
- fn get_change_date(&mut self, identifier: &str) -> anyhow::Result<Option<DateTime<Utc>>> {
+ fn get_change_date(
+ &mut self,
+ identifier: &str,
+ ) -> anyhow::Result<Option<DateTime<FixedOffset>>> {
FossilDriver::get_change_date(self, identifier)
}