changeset 52303:b422acba55f1

rust-dirstate: remove star exports This makes the crate's imports confusing and muddies the discovery of the code.
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 04 Nov 2024 11:07:05 +0100
parents db065b33fa56
children 04b9a56c2d25
files rust/hg-core/src/dirstate.rs rust/hg-core/src/dirstate/dirs_multiset.rs rust/hg-core/src/dirstate/dirstate_map.rs rust/hg-core/src/dirstate/on_disk.rs rust/hg-core/src/dirstate/parsers.rs rust/hg-core/src/lib.rs rust/hg-core/src/update.rs rust/hg-cpython/src/dirstate/dirstate_map.rs rust/hg-cpython/src/dirstate/item.rs rust/rhg/src/commands/status.rs
diffstat 10 files changed, 20 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate.rs	Mon Nov 04 11:00:58 2024 +0100
+++ b/rust/hg-core/src/dirstate.rs	Mon Nov 04 11:07:05 2024 +0100
@@ -10,6 +10,7 @@
 use crate::revlog::Node;
 use crate::utils::hg_path::HgPath;
 use bytes_cast::BytesCast;
+use entry::DirstateEntry;
 
 pub mod dirs_multiset;
 pub mod dirstate_map;
@@ -20,8 +21,6 @@
 pub mod path_with_basename;
 pub mod status;
 
-pub use self::entry::*;
-
 #[derive(Debug, PartialEq, Copy, Clone, BytesCast)]
 #[repr(C)]
 pub struct DirstateParents {
--- a/rust/hg-core/src/dirstate/dirs_multiset.rs	Mon Nov 04 11:00:58 2024 +0100
+++ b/rust/hg-core/src/dirstate/dirs_multiset.rs	Mon Nov 04 11:07:05 2024 +0100
@@ -14,10 +14,12 @@
         files,
         hg_path::{HgPath, HgPathBuf, HgPathError},
     },
-    DirstateEntry, DirstateError, DirstateMapError, FastHashMap,
+    DirstateError, DirstateMapError, FastHashMap,
 };
 use std::collections::{hash_map, hash_map::Entry, HashMap, HashSet};
 
+use super::entry::DirstateEntry;
+
 // could be encapsulated if we care API stability more seriously
 pub type DirsMultisetIter<'a> = hash_map::Keys<'a, HgPathBuf, u32>;
 
@@ -211,7 +213,7 @@
 
 #[cfg(test)]
 mod tests {
-    use crate::EntryState;
+    use crate::dirstate::entry::EntryState;
 
     use super::*;
 
--- a/rust/hg-core/src/dirstate/dirstate_map.rs	Mon Nov 04 11:00:58 2024 +0100
+++ b/rust/hg-core/src/dirstate/dirstate_map.rs	Mon Nov 04 11:07:05 2024 +0100
@@ -8,18 +8,17 @@
 use super::on_disk::DirstateV2ParseError;
 use super::owning::OwningDirstateMap;
 use super::path_with_basename::WithBasename;
+use crate::dirstate::entry::{
+    DirstateEntry, DirstateV2Data, ParentFileData, TruncatedTimestamp,
+};
 use crate::dirstate::parsers::pack_entry;
 use crate::dirstate::parsers::packed_entry_size;
 use crate::dirstate::parsers::parse_dirstate_entries;
 use crate::dirstate::CopyMapIter;
-use crate::dirstate::DirstateV2Data;
-use crate::dirstate::ParentFileData;
 use crate::dirstate::StateMapIter;
-use crate::dirstate::TruncatedTimestamp;
 use crate::matchers::Matcher;
 use crate::utils::filter_map_results;
 use crate::utils::hg_path::{HgPath, HgPathBuf};
-use crate::DirstateEntry;
 use crate::DirstateError;
 use crate::DirstateMapError;
 use crate::DirstateParents;
--- a/rust/hg-core/src/dirstate/on_disk.rs	Mon Nov 04 11:00:58 2024 +0100
+++ b/rust/hg-core/src/dirstate/on_disk.rs	Mon Nov 04 11:07:05 2024 +0100
@@ -6,13 +6,14 @@
 use crate::dirstate::dirstate_map::{
     self, DirstateMap, DirstateMapWriteMode, NodeRef,
 };
+use crate::dirstate::entry::{
+    DirstateEntry, DirstateV2Data, TruncatedTimestamp,
+};
 use crate::dirstate::path_with_basename::WithBasename;
-use crate::dirstate::{DirstateV2Data, TruncatedTimestamp};
 use crate::errors::{HgError, IoResultExt};
 use crate::repo::Repo;
 use crate::requirements::DIRSTATE_TRACKED_HINT_V1;
 use crate::utils::hg_path::HgPath;
-use crate::DirstateEntry;
 use crate::DirstateError;
 use crate::DirstateParents;
 use bitflags::bitflags;
--- a/rust/hg-core/src/dirstate/parsers.rs	Mon Nov 04 11:00:58 2024 +0100
+++ b/rust/hg-core/src/dirstate/parsers.rs	Mon Nov 04 11:07:05 2024 +0100
@@ -3,9 +3,10 @@
 // This software may be used and distributed according to the terms of the
 // GNU General Public License version 2 or any later version.
 
+use crate::dirstate::entry::{DirstateEntry, EntryState};
 use crate::errors::HgError;
 use crate::utils::hg_path::HgPath;
-use crate::{dirstate::EntryState, DirstateEntry, DirstateParents};
+use crate::DirstateParents;
 use byteorder::{BigEndian, WriteBytesExt};
 use bytes_cast::{unaligned, BytesCast};
 
--- a/rust/hg-core/src/lib.rs	Mon Nov 04 11:00:58 2024 +0100
+++ b/rust/hg-core/src/lib.rs	Mon Nov 04 11:07:05 2024 +0100
@@ -22,7 +22,7 @@
         BadMatch, BadType, DirstateStatus, HgPathCow, StatusError,
         StatusOptions,
     },
-    DirstateEntry, DirstateParents, EntryState,
+    DirstateParents,
 };
 pub mod copy_tracing;
 pub mod filepatterns;
--- a/rust/hg-core/src/update.rs	Mon Nov 04 11:00:58 2024 +0100
+++ b/rust/hg-core/src/update.rs	Mon Nov 04 11:07:05 2024 +0100
@@ -10,8 +10,8 @@
 };
 
 use crate::{
+    dirstate::entry::{ParentFileData, TruncatedTimestamp},
     dirstate::{dirstate_map::DirstateEntryReset, on_disk::write_tracked_key},
-    dirstate::{ParentFileData, TruncatedTimestamp},
     errors::{HgError, IoResultExt},
     exit_codes, narrow,
     operations::{list_rev_tracked_files, ExpandedManifestEntry},
--- a/rust/hg-cpython/src/dirstate/dirstate_map.rs	Mon Nov 04 11:00:58 2024 +0100
+++ b/rust/hg-cpython/src/dirstate/dirstate_map.rs	Mon Nov 04 11:07:05 2024 +0100
@@ -18,7 +18,7 @@
     dirstate::dirstate_map::{
         DirstateEntryReset, DirstateIdentity as CoreDirstateIdentity,
     },
-    dirstate::{ParentFileData, TruncatedTimestamp},
+    dirstate::entry::{DirstateEntry, ParentFileData, TruncatedTimestamp},
 };
 
 use crate::{
@@ -30,8 +30,8 @@
     dirstate::dirstate_map::DirstateMapWriteMode,
     dirstate::on_disk::DirstateV2ParseError,
     dirstate::owning::OwningDirstateMap, dirstate::StateMapIter, revlog::Node,
-    utils::files::normalize_case, utils::hg_path::HgPath, DirstateEntry,
-    DirstateError, DirstateParents,
+    utils::files::normalize_case, utils::hg_path::HgPath, DirstateError,
+    DirstateParents,
 };
 
 // TODO
--- a/rust/hg-cpython/src/dirstate/item.rs	Mon Nov 04 11:00:58 2024 +0100
+++ b/rust/hg-cpython/src/dirstate/item.rs	Mon Nov 04 11:07:05 2024 +0100
@@ -7,9 +7,7 @@
 use cpython::PyResult;
 use cpython::Python;
 use cpython::PythonObject;
-use hg::dirstate::DirstateEntry;
-use hg::dirstate::DirstateV2Data;
-use hg::dirstate::TruncatedTimestamp;
+use hg::dirstate::entry::{DirstateEntry, DirstateV2Data, TruncatedTimestamp};
 use std::cell::Cell;
 
 py_class!(pub class DirstateItem |py| {
--- a/rust/rhg/src/commands/status.rs	Mon Nov 04 11:00:58 2024 +0100
+++ b/rust/rhg/src/commands/status.rs	Mon Nov 04 11:07:05 2024 +0100
@@ -14,9 +14,8 @@
 use clap::Arg;
 use format_bytes::format_bytes;
 use hg::config::Config;
-use hg::dirstate::has_exec_bit;
+use hg::dirstate::entry::{has_exec_bit, TruncatedTimestamp};
 use hg::dirstate::status::StatusPath;
-use hg::dirstate::TruncatedTimestamp;
 use hg::errors::{HgError, IoResultExt};
 use hg::filepatterns::parse_pattern_args;
 use hg::lock::LockError;