aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/repository/vcs/hg_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/hg_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/hg_driver.rs')
-rw-r--r--crates/shirabe/src/repository/vcs/hg_driver.rs18
1 files changed, 12 insertions, 6 deletions
diff --git a/crates/shirabe/src/repository/vcs/hg_driver.rs b/crates/shirabe/src/repository/vcs/hg_driver.rs
index c35a574..f637437 100644
--- a/crates/shirabe/src/repository/vcs/hg_driver.rs
+++ b/crates/shirabe/src/repository/vcs/hg_driver.rs
@@ -10,10 +10,10 @@ use crate::repository::vcs::VcsDriverBase;
use crate::util::Filesystem;
use crate::util::Hg as HgUtils;
use crate::util::Url;
-use chrono::{DateTime, Utc};
+use chrono::{DateTime, FixedOffset, Utc};
use indexmap::IndexMap;
use shirabe_external_packages::composer::pcre::{CaptureKey, Preg};
-use shirabe_php_shim::{PhpMixed, RuntimeException, dirname, is_dir, is_writable};
+use shirabe_php_shim::{DATE_RFC3339, PhpMixed, RuntimeException, dirname, is_dir, is_writable};
#[derive(Debug)]
pub struct HgDriver {
@@ -197,7 +197,10 @@ impl HgDriver {
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>>> {
if identifier.starts_with('-') {
return Err(RuntimeException {
message: format!(
@@ -225,8 +228,8 @@ impl HgDriver {
Some(self.repo_dir.clone()),
);
- let date = DateTime::parse_from_rfc3339(output.trim()).map(|d| d.with_timezone(&Utc))?;
- Ok(Some(date))
+ let date: DateTime<Utc> = shirabe_php_shim::date_create(output.trim())?;
+ Ok(Some(date.fixed_offset()))
}
pub fn get_tags(&mut self) -> anyhow::Result<IndexMap<String, String>> {
@@ -410,7 +413,10 @@ impl crate::repository::vcs::VcsDriverInterface for HgDriver {
HgDriver::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>>> {
HgDriver::get_change_date(self, identifier)
}