diff --git a/Cargo.lock b/Cargo.lock index be55409c..f6b6dc2e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -317,7 +317,6 @@ dependencies = [ name = "gitolith-cli" version = "0.1.0" dependencies = [ - "chrono", "gitolith-core", "log", "pretty_env_logger", diff --git a/gitolith-cli/Cargo.toml b/gitolith-cli/Cargo.toml index 8f866d10..fcec6c8a 100644 --- a/gitolith-cli/Cargo.toml +++ b/gitolith-cli/Cargo.toml @@ -16,7 +16,6 @@ edition = "2018" gitolith-core = { path = "../gitolith-core" } pretty_env_logger = "0.4.0" log = "0.4.14" -chrono = "0.4.19" [dependencies.structopt] version = "0.3" diff --git a/gitolith-cli/src/main.rs b/gitolith-cli/src/main.rs index e8c7230d..77ff7191 100644 --- a/gitolith-cli/src/main.rs +++ b/gitolith-cli/src/main.rs @@ -1,11 +1,6 @@ mod args; use args::Opt; -use chrono::{ - DateTime, - NaiveDateTime, - Utc, -}; use gitolith_core::changelog::Changelog; use gitolith_core::commit::Commit; use gitolith_core::config::Config; @@ -50,14 +45,8 @@ fn main() -> Result<()> { if let Some(tag) = tags.get(&commit_id) { release_root.releases[release_index].version = Some(tag.to_string()); release_root.releases[release_index].commit_id = Some(commit_id); - release_root.releases[release_index].date = Some( - DateTime::::from_utc( - NaiveDateTime::from_timestamp(git_commit.time().seconds(), 0), - Utc, - ) - .format(&config.changelog.date_format) - .to_string(), - ); + release_root.releases[release_index].timestamp = + git_commit.time().seconds(); release_index += 1; } } diff --git a/gitolith-core/src/config.rs b/gitolith-core/src/config.rs index ba4d7a4e..ca5e868f 100644 --- a/gitolith-core/src/config.rs +++ b/gitolith-core/src/config.rs @@ -29,7 +29,6 @@ pub struct ChangelogConfig { pub group_parsers: Vec, pub filter_group: bool, pub tag_pattern: String, - pub date_format: String, } /// Parser for grouping commits. diff --git a/gitolith-core/src/release.rs b/gitolith-core/src/release.rs index 68b14948..b24991a9 100644 --- a/gitolith-core/src/release.rs +++ b/gitolith-core/src/release.rs @@ -29,5 +29,5 @@ pub struct Release<'a> { pub commits: Vec>, #[serde(rename = "commit_id")] pub commit_id: Option, - pub date: Option, + pub timestamp: i64, } diff --git a/gitolith.toml b/gitolith.toml index b74c7ed8..d278e7dc 100644 --- a/gitolith.toml +++ b/gitolith.toml @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 # template for the changelog body # https://tera.netlify.app/docs/#introduction body = """ -## {% if version %}[{{ version }}] - {{ date }}{% else %}[unreleased]{% endif %} +## {% if version %}[{{ version }}] - {{ timestamp | date(format="%Y-%m-%d") }}{% else %}[unreleased]{% endif %} {% for group, commits in commits | group_by(attribute="group") %} ### {{ group | capitalize}} {% for commit in commits %} @@ -34,6 +34,3 @@ filter_group = false # glob pattern for matching tags tag_pattern = "v[0-9]*" - -# https://docs.rs/chrono/latest/chrono/format/strftime/index.html -date_format = "%Y-%m-%d"