--- a/rust/hg-core/src/lib.rs Wed May 15 22:11:41 2019 -0700
+++ b/rust/hg-core/src/lib.rs Wed Apr 24 11:34:09 2019 +0200
@@ -4,6 +4,9 @@
// GNU General Public License version 2 or any later version.
extern crate byteorder;
extern crate memchr;
+#[macro_use]
+extern crate lazy_static;
+extern crate regex;
mod ancestors;
pub mod dagops;
@@ -15,6 +18,11 @@
pack_dirstate, parse_dirstate, CopyVec, CopyVecEntry, DirstateEntry,
DirstateParents, DirstateVec,
};
+mod filepatterns;
+
+pub use filepatterns::{
+ build_single_regex, read_pattern_file, PatternSyntax, PatternTuple,
+};
/// Mercurial revision numbers
///
@@ -42,6 +50,8 @@
fn parents(&self, Revision) -> Result<[Revision; 2], GraphError>;
}
+pub type LineNumber = usize;
+
#[derive(Clone, Debug, PartialEq)]
pub enum GraphError {
ParentOutOfRange(Revision),
@@ -73,3 +83,20 @@
DirstateParseError::CorruptedEntry(e.to_string())
}
}
+
+#[derive(Debug)]
+pub enum PatternError {
+ UnsupportedSyntax(String),
+}
+
+#[derive(Debug)]
+pub enum PatternFileError {
+ IO(std::io::Error),
+ Pattern(PatternError, LineNumber),
+}
+
+impl From<std::io::Error> for PatternFileError {
+ fn from(e: std::io::Error) -> Self {
+ PatternFileError::IO(e)
+ }
+}