Show More
@@ -32,6 +32,7 b' use crate::StatusOptions;' | |||||
32 | /// anymore) is less than this fraction of the total amount of existing data. |
|
32 | /// anymore) is less than this fraction of the total amount of existing data. | |
33 | const ACCEPTABLE_UNREACHABLE_BYTES_RATIO: f32 = 0.5; |
|
33 | const ACCEPTABLE_UNREACHABLE_BYTES_RATIO: f32 = 0.5; | |
34 |
|
34 | |||
|
35 | #[derive(Debug)] | |||
35 | pub struct DirstateMap<'on_disk> { |
|
36 | pub struct DirstateMap<'on_disk> { | |
36 | /// Contents of the `.hg/dirstate` file |
|
37 | /// Contents of the `.hg/dirstate` file | |
37 | pub(super) on_disk: &'on_disk [u8], |
|
38 | pub(super) on_disk: &'on_disk [u8], | |
@@ -61,21 +62,25 b" pub(super) type NodeKey<'on_disk> = With" | |||||
61 |
|
62 | |||
62 | /// Similar to `&'tree Cow<'on_disk, HgPath>`, but can also be returned |
|
63 | /// Similar to `&'tree Cow<'on_disk, HgPath>`, but can also be returned | |
63 | /// for on-disk nodes that don’t actually have a `Cow` to borrow. |
|
64 | /// for on-disk nodes that don’t actually have a `Cow` to borrow. | |
|
65 | #[derive(Debug)] | |||
64 | pub(super) enum BorrowedPath<'tree, 'on_disk> { |
|
66 | pub(super) enum BorrowedPath<'tree, 'on_disk> { | |
65 | InMemory(&'tree HgPathBuf), |
|
67 | InMemory(&'tree HgPathBuf), | |
66 | OnDisk(&'on_disk HgPath), |
|
68 | OnDisk(&'on_disk HgPath), | |
67 | } |
|
69 | } | |
68 |
|
70 | |||
|
71 | #[derive(Debug)] | |||
69 | pub(super) enum ChildNodes<'on_disk> { |
|
72 | pub(super) enum ChildNodes<'on_disk> { | |
70 | InMemory(FastHashMap<NodeKey<'on_disk>, Node<'on_disk>>), |
|
73 | InMemory(FastHashMap<NodeKey<'on_disk>, Node<'on_disk>>), | |
71 | OnDisk(&'on_disk [on_disk::Node]), |
|
74 | OnDisk(&'on_disk [on_disk::Node]), | |
72 | } |
|
75 | } | |
73 |
|
76 | |||
|
77 | #[derive(Debug)] | |||
74 | pub(super) enum ChildNodesRef<'tree, 'on_disk> { |
|
78 | pub(super) enum ChildNodesRef<'tree, 'on_disk> { | |
75 | InMemory(&'tree FastHashMap<NodeKey<'on_disk>, Node<'on_disk>>), |
|
79 | InMemory(&'tree FastHashMap<NodeKey<'on_disk>, Node<'on_disk>>), | |
76 | OnDisk(&'on_disk [on_disk::Node]), |
|
80 | OnDisk(&'on_disk [on_disk::Node]), | |
77 | } |
|
81 | } | |
78 |
|
82 | |||
|
83 | #[derive(Debug)] | |||
79 | pub(super) enum NodeRef<'tree, 'on_disk> { |
|
84 | pub(super) enum NodeRef<'tree, 'on_disk> { | |
80 | InMemory(&'tree NodeKey<'on_disk>, &'tree Node<'on_disk>), |
|
85 | InMemory(&'tree NodeKey<'on_disk>, &'tree Node<'on_disk>), | |
81 | OnDisk(&'on_disk on_disk::Node), |
|
86 | OnDisk(&'on_disk on_disk::Node), | |
@@ -383,7 +388,7 b" impl<'tree, 'on_disk> NodeRef<'tree, 'on" | |||||
383 | } |
|
388 | } | |
384 |
|
389 | |||
385 | /// Represents a file or a directory |
|
390 | /// Represents a file or a directory | |
386 | #[derive(Default)] |
|
391 | #[derive(Default, Debug)] | |
387 | pub(super) struct Node<'on_disk> { |
|
392 | pub(super) struct Node<'on_disk> { | |
388 | pub(super) data: NodeData, |
|
393 | pub(super) data: NodeData, | |
389 |
|
394 | |||
@@ -399,6 +404,7 b" pub(super) struct Node<'on_disk> {" | |||||
399 | pub(super) tracked_descendants_count: u32, |
|
404 | pub(super) tracked_descendants_count: u32, | |
400 | } |
|
405 | } | |
401 |
|
406 | |||
|
407 | #[derive(Debug)] | |||
402 | pub(super) enum NodeData { |
|
408 | pub(super) enum NodeData { | |
403 | Entry(DirstateEntry), |
|
409 | Entry(DirstateEntry), | |
404 | CachedDirectory { mtime: TruncatedTimestamp }, |
|
410 | CachedDirectory { mtime: TruncatedTimestamp }, |
@@ -84,7 +84,7 b' pub struct TreeMetadata {' | |||||
84 |
|
84 | |||
85 | /// Fields are documented in the *The data file format* |
|
85 | /// Fields are documented in the *The data file format* | |
86 | /// section of `mercurial/helptext/internals/dirstate-v2.txt` |
|
86 | /// section of `mercurial/helptext/internals/dirstate-v2.txt` | |
87 | #[derive(BytesCast)] |
|
87 | #[derive(BytesCast, Debug)] | |
88 | #[repr(C)] |
|
88 | #[repr(C)] | |
89 | pub(super) struct Node { |
|
89 | pub(super) struct Node { | |
90 | full_path: PathSlice, |
|
90 | full_path: PathSlice, | |
@@ -124,7 +124,7 b' bitflags! {' | |||||
124 | } |
|
124 | } | |
125 |
|
125 | |||
126 | /// Duration since the Unix epoch |
|
126 | /// Duration since the Unix epoch | |
127 | #[derive(BytesCast, Copy, Clone)] |
|
127 | #[derive(BytesCast, Copy, Clone, Debug)] | |
128 | #[repr(C)] |
|
128 | #[repr(C)] | |
129 | struct PackedTruncatedTimestamp { |
|
129 | struct PackedTruncatedTimestamp { | |
130 | truncated_seconds: U32Be, |
|
130 | truncated_seconds: U32Be, | |
@@ -152,7 +152,7 b' type PathSize = U16Be;' | |||||
152 | /// Always sorted by ascending `full_path`, to allow binary search. |
|
152 | /// Always sorted by ascending `full_path`, to allow binary search. | |
153 | /// Since nodes with the same parent nodes also have the same parent path, |
|
153 | /// Since nodes with the same parent nodes also have the same parent path, | |
154 | /// only the `base_name`s need to be compared during binary search. |
|
154 | /// only the `base_name`s need to be compared during binary search. | |
155 | #[derive(BytesCast, Copy, Clone)] |
|
155 | #[derive(BytesCast, Copy, Clone, Debug)] | |
156 | #[repr(C)] |
|
156 | #[repr(C)] | |
157 | struct ChildNodes { |
|
157 | struct ChildNodes { | |
158 | start: Offset, |
|
158 | start: Offset, | |
@@ -160,7 +160,7 b' struct ChildNodes {' | |||||
160 | } |
|
160 | } | |
161 |
|
161 | |||
162 | /// A `HgPath` of `len` bytes |
|
162 | /// A `HgPath` of `len` bytes | |
163 | #[derive(BytesCast, Copy, Clone)] |
|
163 | #[derive(BytesCast, Copy, Clone, Debug)] | |
164 | #[repr(C)] |
|
164 | #[repr(C)] | |
165 | struct PathSlice { |
|
165 | struct PathSlice { | |
166 | start: Offset, |
|
166 | start: Offset, |
General Comments 0
You need to be logged in to leave comments.
Login now