From fde2fd8b077bc5d50d793b4c25afb786c649ddd3 Mon Sep 17 00:00:00 2001 From: Freddie Ridell Date: Mon, 23 Feb 2026 19:23:15 +0000 Subject: [PATCH] Add VCS.None variant, new Ordering options, and run ID tracking --- crates/pollard-cli/src/io.rs | 3 +-- crates/pollard-core/src/config.rs | 4 ++++ crates/pollard-session/src/lib.rs | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/crates/pollard-cli/src/io.rs b/crates/pollard-cli/src/io.rs index 69a775f4..c674e6a1 100644 --- a/crates/pollard-cli/src/io.rs +++ b/crates/pollard-cli/src/io.rs @@ -1,7 +1,7 @@ use serde::Serialize; use std::path::PathBuf; -pub use pollard_core::io::{DiffStyle, Render, Style, color, hashed_path}; +pub use pollard_core::io::{DiffStyle, Render, color, hashed_path}; pub use pollard_session::{Report, Session}; #[derive(Debug, Clone, Serialize)] @@ -62,7 +62,6 @@ impl Action { } } - impl Render for Action { fn render_json(&self) -> String { serde_json::to_string(self).expect("failed to serialize") diff --git a/crates/pollard-core/src/config.rs b/crates/pollard-core/src/config.rs index 8aa73d55..ab78c3bb 100644 --- a/crates/pollard-core/src/config.rs +++ b/crates/pollard-core/src/config.rs @@ -14,6 +14,7 @@ pub enum LanguageId { #[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, clap::ValueEnum)] #[serde(rename_all = "lowercase")] pub enum Vcs { + None, Git, Jj, Mercurial, @@ -24,4 +25,7 @@ pub enum Vcs { pub enum Ordering { Random, Alphabetical, + MissedFirst, + CaughtFirst, + NewestFirst, } diff --git a/crates/pollard-session/src/lib.rs b/crates/pollard-session/src/lib.rs index 34b6124f..f2772cbf 100644 --- a/crates/pollard-session/src/lib.rs +++ b/crates/pollard-session/src/lib.rs @@ -8,6 +8,18 @@ use pollard_session_derive::Settings; use serde::Serialize; use std::path::{Path, PathBuf}; +fn default_run_id() -> String { + let seed = format!( + "{}:{}", + std::process::id(), + std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .expect("time went backwards") + .as_nanos(), + ); + pollard_core::Hash::of(&seed).to_string() +} + fn absolutize(path: &Path) -> PathBuf { if path.is_absolute() { path.to_path_buf() @@ -72,6 +84,8 @@ pub struct Session { pub diff: DiffStyle, #[setting(env = "NO_COLOR")] pub no_color: bool, + #[setting(cli_only, default = "default_run_id()")] + pub run_id: String, #[setting(cli_only)] pub exec: bool, #[setting(skip)] -- knotmirror 0.0.1