changeset 52307:22d24f6d6411

rust-lib: remove exports for not too common pattern-related types This only muddies the lib and makes the imports more confusing.
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 04 Nov 2024 11:26:41 +0100
parents f33b87b46135
children 7756494c5ecd
files rust/hg-core/src/dirstate/dirstate_map.rs rust/hg-core/src/dirstate/status.rs rust/hg-core/src/lib.rs rust/hg-core/src/matchers.rs rust/hg-core/src/sparse.rs rust/hg-cpython/src/dirstate/status.rs rust/rhg/src/commands/status.rs rust/rhg/src/ui.rs
diffstat 8 files changed, 17 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/rust/hg-core/src/dirstate/dirstate_map.rs	Mon Nov 04 11:21:43 2024 +0100
+++ b/rust/hg-core/src/dirstate/dirstate_map.rs	Mon Nov 04 11:26:41 2024 +0100
@@ -17,12 +17,12 @@
 use crate::dirstate::parsers::parse_dirstate_entries;
 use crate::dirstate::CopyMapIter;
 use crate::dirstate::StateMapIter;
+use crate::filepatterns::PatternFileWarning;
 use crate::matchers::Matcher;
 use crate::utils::filter_map_results;
 use crate::utils::hg_path::{HgPath, HgPathBuf};
 use crate::DirstateParents;
 use crate::FastHashbrownMap as FastHashMap;
-use crate::PatternFileWarning;
 
 /// Append to an existing data file if the amount of unreachable data (not used
 /// anymore) is less than this fraction of the total amount of existing data.
--- a/rust/hg-core/src/dirstate/status.rs	Mon Nov 04 11:21:43 2024 +0100
+++ b/rust/hg-core/src/dirstate/status.rs	Mon Nov 04 11:26:41 2024 +0100
@@ -17,6 +17,7 @@
 use crate::dirstate::entry::TruncatedTimestamp;
 use crate::dirstate::on_disk::DirstateV2ParseError;
 use crate::filepatterns::PatternError;
+use crate::filepatterns::PatternFileWarning;
 use crate::matchers::get_ignore_function;
 use crate::matchers::{Matcher, VisitChildrenSet};
 use crate::utils::files::filesystem_now;
@@ -26,7 +27,6 @@
 use crate::utils::hg_path::hg_path_to_path_buf;
 use crate::utils::hg_path::HgPath;
 use crate::utils::hg_path::HgPathError;
-use crate::PatternFileWarning;
 use once_cell::sync::OnceCell;
 use rayon::prelude::*;
 use sha1::{Digest, Sha1};
--- a/rust/hg-core/src/lib.rs	Mon Nov 04 11:21:43 2024 +0100
+++ b/rust/hg-core/src/lib.rs	Mon Nov 04 11:26:41 2024 +0100
@@ -41,11 +41,6 @@
 pub mod update;
 pub mod utils;
 pub mod vfs;
-
-pub use filepatterns::{
-    parse_pattern_syntax_kind, read_pattern_file, IgnorePattern,
-    PatternFileWarning, PatternSyntax,
-};
 use std::{collections::HashMap, sync::atomic::AtomicBool};
 use twox_hash::RandomXxHashBuilder64;
 
--- a/rust/hg-core/src/matchers.rs	Mon Nov 04 11:21:43 2024 +0100
+++ b/rust/hg-core/src/matchers.rs	Mon Nov 04 11:26:41 2024 +0100
@@ -14,14 +14,15 @@
     dirstate::dirs_multiset::{DirsChildrenMultiset, DirsMultiset},
     filepatterns::{
         build_single_regex, filter_subincludes, get_patterns_from_file,
-        PatternError, PatternFileWarning, PatternResult,
+        IgnorePattern, PatternError, PatternFileWarning, PatternResult,
+        PatternSyntax,
     },
     utils::{
         files::{dir_ancestors, find_dirs},
         hg_path::{HgPath, HgPathBuf, HgPathError},
         Escaped,
     },
-    FastHashMap, IgnorePattern, PatternSyntax,
+    FastHashMap,
 };
 
 use crate::dirstate::status::IgnoreFnType;
@@ -265,8 +266,7 @@
 /// ```
 /// use hg::{
 ///     matchers::{PatternMatcher, Matcher},
-///     IgnorePattern,
-///     PatternSyntax,
+///     filepatterns::{IgnorePattern, PatternSyntax},
 ///     utils::hg_path::{HgPath, HgPathBuf}
 /// };
 /// use std::collections::HashSet;
@@ -387,8 +387,7 @@
 /// ```
 /// use hg::{
 ///     matchers::{IncludeMatcher, Matcher},
-///     IgnorePattern,
-///     PatternSyntax,
+///     filepatterns::{IgnorePattern, PatternSyntax},
 ///     utils::hg_path::HgPath
 /// };
 /// use std::path::Path;
--- a/rust/hg-core/src/sparse.rs	Mon Nov 04 11:21:43 2024 +0100
+++ b/rust/hg-core/src/sparse.rs	Mon Nov 04 11:26:41 2024 +0100
@@ -5,7 +5,10 @@
 use crate::{
     errors::HgError,
     exit_codes::STATE_ERROR,
-    filepatterns::{PatternError, parse_pattern_file_contents},
+    filepatterns::{
+        parse_pattern_file_contents, IgnorePattern, PatternError,
+        PatternFileWarning, PatternSyntax,
+    },
     matchers::{
         AlwaysMatcher, DifferenceMatcher, IncludeMatcher, Matcher,
         UnionMatcher,
@@ -15,8 +18,7 @@
     repo::Repo,
     requirements::SPARSE_REQUIREMENT,
     utils::{hg_path::HgPath, SliceExt},
-    IgnorePattern, PatternFileWarning, PatternSyntax, Revision,
-    NULL_REVISION,
+    Revision, NULL_REVISION,
 };
 
 /// Command which is triggering the config read
--- a/rust/hg-cpython/src/dirstate/status.rs	Mon Nov 04 11:21:43 2024 +0100
+++ b/rust/hg-cpython/src/dirstate/status.rs	Mon Nov 04 11:26:41 2024 +0100
@@ -17,19 +17,19 @@
 use hg::dirstate::status::{
     BadMatch, DirstateStatus, StatusError, StatusOptions, StatusPath,
 };
-use hg::filepatterns::PatternError;
+use hg::filepatterns::{
+    parse_pattern_syntax_kind, IgnorePattern, PatternError, PatternFileWarning,
+};
 use hg::matchers::{
     DifferenceMatcher, IntersectionMatcher, Matcher, NeverMatcher,
     PatternMatcher, UnionMatcher,
 };
 use hg::{
     matchers::{AlwaysMatcher, FileMatcher, IncludeMatcher},
-    parse_pattern_syntax_kind,
     utils::{
         files::{get_bytes_from_path, get_path_from_bytes},
         hg_path::{HgPath, HgPathBuf},
     },
-    IgnorePattern, PatternFileWarning,
 };
 use std::borrow::Borrow;
 
--- a/rust/rhg/src/commands/status.rs	Mon Nov 04 11:21:43 2024 +0100
+++ b/rust/rhg/src/commands/status.rs	Mon Nov 04 11:26:41 2024 +0100
@@ -19,7 +19,7 @@
     BadMatch, DirstateStatus, StatusError, StatusOptions, StatusPath,
 };
 use hg::errors::{HgError, IoResultExt};
-use hg::filepatterns::parse_pattern_args;
+use hg::filepatterns::{parse_pattern_args, PatternFileWarning};
 use hg::lock::LockError;
 use hg::matchers::{AlwaysMatcher, IntersectionMatcher};
 use hg::repo::Repo;
@@ -31,7 +31,6 @@
     get_bytes_from_os_str, get_bytes_from_os_string, get_path_from_bytes,
 };
 use hg::utils::hg_path::{hg_path_to_path_buf, HgPath};
-use hg::PatternFileWarning;
 use hg::Revision;
 use hg::{self, narrow, sparse};
 use log::info;
--- a/rust/rhg/src/ui.rs	Mon Nov 04 11:21:43 2024 +0100
+++ b/rust/rhg/src/ui.rs	Mon Nov 04 11:26:41 2024 +0100
@@ -6,10 +6,10 @@
 use hg::config::Config;
 use hg::config::PlainInfo;
 use hg::errors::HgError;
+use hg::filepatterns::PatternFileWarning;
 use hg::repo::Repo;
 use hg::sparse;
 use hg::utils::files::get_bytes_from_path;
-use hg::PatternFileWarning;
 use std::borrow::Cow;
 use std::io;
 use std::io::{ErrorKind, Write};