comparison rust/hg-core/src/lib.rs @ 42536:2dcee6497b0b

rust-dirstate: add "dirs" Rust implementation Following the work done in d1786c1d34fa and working towards the goal of a complete Rust implementation of the dirstate, this rewrites the `dirs` class. There is already a C implementation, which relies heavily on CPython hacks and protocol violations for performance, so I don't expect this to perform as well for now, as this is very straight-forward code. The immediate benefits are new high-level documentation and some unit tests. Differential Revision: https://phab.mercurial-scm.org/D6393
author Rapha?l Gom?s <rgomes@octobus.net>
date Thu, 16 May 2019 18:03:06 +0200
parents 9609430d3625
children 326fdce22fb2
comparison
equal deleted inserted replaced
42535:df5f674050b7 42536:2dcee6497b0b
13 pub use ancestors::{AncestorsIterator, LazyAncestors, MissingAncestors}; 13 pub use ancestors::{AncestorsIterator, LazyAncestors, MissingAncestors};
14 mod dirstate; 14 mod dirstate;
15 pub mod discovery; 15 pub mod discovery;
16 pub mod testing; // unconditionally built, for use from integration tests 16 pub mod testing; // unconditionally built, for use from integration tests
17 pub use dirstate::{ 17 pub use dirstate::{
18 dirs_multiset::DirsMultiset,
18 parsers::{pack_dirstate, parse_dirstate}, 19 parsers::{pack_dirstate, parse_dirstate},
19 CopyVec, CopyVecEntry, DirstateEntry, DirstateParents, DirstateVec, 20 CopyVec, CopyVecEntry, DirsIterable, DirstateEntry, DirstateParents,
21 DirstateVec,
20 }; 22 };
21 mod filepatterns; 23 mod filepatterns;
22 mod utils; 24 mod utils;
23 25
24 pub use filepatterns::{ 26 pub use filepatterns::{
71 CorruptedEntry(String), 73 CorruptedEntry(String),
72 CorruptedParent, 74 CorruptedParent,
73 BadSize(usize, usize), 75 BadSize(usize, usize),
74 } 76 }
75 77
78 #[derive(Debug, PartialEq)]
79 pub enum DirstateMapError {
80 PathNotFound(Vec<u8>),
81 EmptyPath,
82 }
83
76 impl From<std::io::Error> for DirstatePackError { 84 impl From<std::io::Error> for DirstatePackError {
77 fn from(e: std::io::Error) -> Self { 85 fn from(e: std::io::Error) -> Self {
78 DirstatePackError::CorruptedEntry(e.to_string()) 86 DirstatePackError::CorruptedEntry(e.to_string())
79 } 87 }
80 } 88 }