Mercurial > hg
annotate rust/hg-core/src/dirstate_tree/dispatch.rs @ 47332:4ee9f419c52e
rust: Return owned instead of borrowed DirstateEntry in DirstateMap APIs
This will enable the tree-based DirstateMap to not always have an actual
DirstateEntry in memory for all nodes, but construct it on demand.
Differential Revision: https://phab.mercurial-scm.org/D10746
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Wed, 19 May 2021 13:15:00 +0200 |
parents | 1766130fe9ba |
children | ed1583a845d2 |
rev | line source |
---|---|
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
1 use std::path::PathBuf; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
2 |
47101
5d62243c7732
rust: Add a Timestamp struct instead of abusing Duration
Simon Sapin <simon.sapin@octobus.net>
parents:
47094
diff
changeset
|
3 use crate::dirstate::parsers::Timestamp; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
4 use crate::matchers::Matcher; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
5 use crate::utils::hg_path::{HgPath, HgPathBuf}; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
6 use crate::CopyMapIter; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
7 use crate::DirstateEntry; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
8 use crate::DirstateError; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
9 use crate::DirstateMap; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
10 use crate::DirstateMapError; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
11 use crate::DirstateParents; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
12 use crate::DirstateStatus; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
13 use crate::EntryState; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
14 use crate::PatternFileWarning; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
15 use crate::StateMapIter; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
16 use crate::StatusError; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
17 use crate::StatusOptions; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
18 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
19 pub trait DirstateMapMethods { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
20 fn clear(&mut self); |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
21 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
22 fn add_file( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
23 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
24 filename: &HgPath, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
25 old_state: EntryState, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
26 entry: DirstateEntry, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
27 ) -> Result<(), DirstateMapError>; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
28 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
29 fn remove_file( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
30 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
31 filename: &HgPath, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
32 old_state: EntryState, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
33 size: i32, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
34 ) -> Result<(), DirstateMapError>; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
35 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
36 fn drop_file( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
37 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
38 filename: &HgPath, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
39 old_state: EntryState, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
40 ) -> Result<bool, DirstateMapError>; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
41 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
42 fn clear_ambiguous_times(&mut self, filenames: Vec<HgPathBuf>, now: i32); |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
43 |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
44 fn non_normal_entries_contains(&mut self, key: &HgPath) -> bool; |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
45 |
47108
e3cebe96c0fc
dirstate-tree: Add "non normal" and "from other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47101
diff
changeset
|
46 fn non_normal_entries_remove(&mut self, key: &HgPath); |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
47 |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
48 fn non_normal_or_other_parent_paths( |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
49 &mut self, |
47124
cd8ca38fccff
rust: Use `&HgPath` instead of `&HgPathBuf` in may APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47123
diff
changeset
|
50 ) -> Box<dyn Iterator<Item = &HgPath> + '_>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
51 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
52 fn set_non_normal_other_parent_entries(&mut self, force: bool); |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
53 |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
54 fn iter_non_normal_paths( |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
55 &mut self, |
47124
cd8ca38fccff
rust: Use `&HgPath` instead of `&HgPathBuf` in may APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47123
diff
changeset
|
56 ) -> Box<dyn Iterator<Item = &HgPath> + Send + '_>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
57 |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
58 fn iter_non_normal_paths_panic( |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
59 &self, |
47124
cd8ca38fccff
rust: Use `&HgPath` instead of `&HgPathBuf` in may APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47123
diff
changeset
|
60 ) -> Box<dyn Iterator<Item = &HgPath> + Send + '_>; |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
61 |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
62 fn iter_other_parent_paths( |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
63 &mut self, |
47124
cd8ca38fccff
rust: Use `&HgPath` instead of `&HgPathBuf` in may APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47123
diff
changeset
|
64 ) -> Box<dyn Iterator<Item = &HgPath> + Send + '_>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
65 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
66 fn has_tracked_dir( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
67 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
68 directory: &HgPath, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
69 ) -> Result<bool, DirstateMapError>; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
70 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
71 fn has_dir( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
72 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
73 directory: &HgPath, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
74 ) -> Result<bool, DirstateMapError>; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
75 |
47280
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
76 fn pack_v1( |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
77 &mut self, |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
78 parents: DirstateParents, |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
79 now: Timestamp, |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
80 ) -> Result<Vec<u8>, DirstateError>; |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
81 |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
82 fn pack_v2( |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
83 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
84 parents: DirstateParents, |
47101
5d62243c7732
rust: Add a Timestamp struct instead of abusing Duration
Simon Sapin <simon.sapin@octobus.net>
parents:
47094
diff
changeset
|
85 now: Timestamp, |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
86 ) -> Result<Vec<u8>, DirstateError>; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
87 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
88 fn set_all_dirs(&mut self) -> Result<(), DirstateMapError>; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
89 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
90 fn set_dirs(&mut self) -> Result<(), DirstateMapError>; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
91 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
92 fn status<'a>( |
47112
d5956136d19d
dirstate-tree: Give to `status()` mutable access to the `DirstateMap`
Simon Sapin <simon.sapin@octobus.net>
parents:
47110
diff
changeset
|
93 &'a mut self, |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
94 matcher: &'a (dyn Matcher + Sync), |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
95 root_dir: PathBuf, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
96 ignore_files: Vec<PathBuf>, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
97 options: StatusOptions, |
47110
9c6b458a08e1
rust: Move "lookup" a.k.a. "unsure" paths into `DirstateStatus` struct
Simon Sapin <simon.sapin@octobus.net>
parents:
47109
diff
changeset
|
98 ) -> Result<(DirstateStatus<'a>, Vec<PatternFileWarning>), StatusError>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
99 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
100 fn copy_map_len(&self) -> usize; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
101 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
102 fn copy_map_iter(&self) -> CopyMapIter<'_>; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
103 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
104 fn copy_map_contains_key(&self, key: &HgPath) -> bool; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
105 |
47124
cd8ca38fccff
rust: Use `&HgPath` instead of `&HgPathBuf` in may APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47123
diff
changeset
|
106 fn copy_map_get(&self, key: &HgPath) -> Option<&HgPath>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
107 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
108 fn copy_map_remove(&mut self, key: &HgPath) -> Option<HgPathBuf>; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
109 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
110 fn copy_map_insert( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
111 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
112 key: HgPathBuf, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
113 value: HgPathBuf, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
114 ) -> Option<HgPathBuf>; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
115 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
116 fn len(&self) -> usize; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
117 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
118 fn contains_key(&self, key: &HgPath) -> bool; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
119 |
47332
4ee9f419c52e
rust: Return owned instead of borrowed DirstateEntry in DirstateMap APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47280
diff
changeset
|
120 fn get(&self, key: &HgPath) -> Option<DirstateEntry>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
121 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
122 fn iter(&self) -> StateMapIter<'_>; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
123 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
124 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
125 impl DirstateMapMethods for DirstateMap { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
126 fn clear(&mut self) { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
127 self.clear() |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
128 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
129 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
130 fn add_file( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
131 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
132 filename: &HgPath, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
133 old_state: EntryState, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
134 entry: DirstateEntry, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
135 ) -> Result<(), DirstateMapError> { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
136 self.add_file(filename, old_state, entry) |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
137 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
138 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
139 fn remove_file( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
140 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
141 filename: &HgPath, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
142 old_state: EntryState, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
143 size: i32, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
144 ) -> Result<(), DirstateMapError> { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
145 self.remove_file(filename, old_state, size) |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
146 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
147 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
148 fn drop_file( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
149 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
150 filename: &HgPath, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
151 old_state: EntryState, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
152 ) -> Result<bool, DirstateMapError> { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
153 self.drop_file(filename, old_state) |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
154 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
155 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
156 fn clear_ambiguous_times(&mut self, filenames: Vec<HgPathBuf>, now: i32) { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
157 self.clear_ambiguous_times(filenames, now) |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
158 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
159 |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
160 fn non_normal_entries_contains(&mut self, key: &HgPath) -> bool { |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
161 let (non_normal, _other_parent) = |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
162 self.get_non_normal_other_parent_entries(); |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
163 non_normal.contains(key) |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
164 } |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
165 |
47108
e3cebe96c0fc
dirstate-tree: Add "non normal" and "from other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47101
diff
changeset
|
166 fn non_normal_entries_remove(&mut self, key: &HgPath) { |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
167 self.non_normal_entries_remove(key) |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
168 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
169 |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
170 fn non_normal_or_other_parent_paths( |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
171 &mut self, |
47124
cd8ca38fccff
rust: Use `&HgPath` instead of `&HgPathBuf` in may APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47123
diff
changeset
|
172 ) -> Box<dyn Iterator<Item = &HgPath> + '_> { |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
173 let (non_normal, other_parent) = |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
174 self.get_non_normal_other_parent_entries(); |
47124
cd8ca38fccff
rust: Use `&HgPath` instead of `&HgPathBuf` in may APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47123
diff
changeset
|
175 Box::new(non_normal.union(other_parent).map(|p| &**p)) |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
176 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
177 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
178 fn set_non_normal_other_parent_entries(&mut self, force: bool) { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
179 self.set_non_normal_other_parent_entries(force) |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
180 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
181 |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
182 fn iter_non_normal_paths( |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
183 &mut self, |
47124
cd8ca38fccff
rust: Use `&HgPath` instead of `&HgPathBuf` in may APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47123
diff
changeset
|
184 ) -> Box<dyn Iterator<Item = &HgPath> + Send + '_> { |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
185 let (non_normal, _other_parent) = |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
186 self.get_non_normal_other_parent_entries(); |
47124
cd8ca38fccff
rust: Use `&HgPath` instead of `&HgPathBuf` in may APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47123
diff
changeset
|
187 Box::new(non_normal.iter().map(|p| &**p)) |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
188 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
189 |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
190 fn iter_non_normal_paths_panic( |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
191 &self, |
47124
cd8ca38fccff
rust: Use `&HgPath` instead of `&HgPathBuf` in may APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47123
diff
changeset
|
192 ) -> Box<dyn Iterator<Item = &HgPath> + Send + '_> { |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
193 let (non_normal, _other_parent) = |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
194 self.get_non_normal_other_parent_entries_panic(); |
47124
cd8ca38fccff
rust: Use `&HgPath` instead of `&HgPathBuf` in may APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47123
diff
changeset
|
195 Box::new(non_normal.iter().map(|p| &**p)) |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
196 } |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
197 |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
198 fn iter_other_parent_paths( |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
199 &mut self, |
47124
cd8ca38fccff
rust: Use `&HgPath` instead of `&HgPathBuf` in may APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47123
diff
changeset
|
200 ) -> Box<dyn Iterator<Item = &HgPath> + Send + '_> { |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
201 let (_non_normal, other_parent) = |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
202 self.get_non_normal_other_parent_entries(); |
47124
cd8ca38fccff
rust: Use `&HgPath` instead of `&HgPathBuf` in may APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47123
diff
changeset
|
203 Box::new(other_parent.iter().map(|p| &**p)) |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
204 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
205 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
206 fn has_tracked_dir( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
207 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
208 directory: &HgPath, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
209 ) -> Result<bool, DirstateMapError> { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
210 self.has_tracked_dir(directory) |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
211 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
212 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
213 fn has_dir( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
214 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
215 directory: &HgPath, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
216 ) -> Result<bool, DirstateMapError> { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
217 self.has_dir(directory) |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
218 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
219 |
47280
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
220 fn pack_v1( |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
221 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
222 parents: DirstateParents, |
47101
5d62243c7732
rust: Add a Timestamp struct instead of abusing Duration
Simon Sapin <simon.sapin@octobus.net>
parents:
47094
diff
changeset
|
223 now: Timestamp, |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
224 ) -> Result<Vec<u8>, DirstateError> { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
225 self.pack(parents, now) |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
226 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
227 |
47280
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
228 fn pack_v2( |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
229 &mut self, |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
230 _parents: DirstateParents, |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
231 _now: Timestamp, |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
232 ) -> Result<Vec<u8>, DirstateError> { |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
233 panic!( |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
234 "should have used dirstate_tree::DirstateMap to use the v2 format" |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
235 ) |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
236 } |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
237 |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
238 fn set_all_dirs(&mut self) -> Result<(), DirstateMapError> { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
239 self.set_all_dirs() |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
240 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
241 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
242 fn set_dirs(&mut self) -> Result<(), DirstateMapError> { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
243 self.set_dirs() |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
244 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
245 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
246 fn status<'a>( |
47112
d5956136d19d
dirstate-tree: Give to `status()` mutable access to the `DirstateMap`
Simon Sapin <simon.sapin@octobus.net>
parents:
47110
diff
changeset
|
247 &'a mut self, |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
248 matcher: &'a (dyn Matcher + Sync), |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
249 root_dir: PathBuf, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
250 ignore_files: Vec<PathBuf>, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
251 options: StatusOptions, |
47110
9c6b458a08e1
rust: Move "lookup" a.k.a. "unsure" paths into `DirstateStatus` struct
Simon Sapin <simon.sapin@octobus.net>
parents:
47109
diff
changeset
|
252 ) -> Result<(DirstateStatus<'a>, Vec<PatternFileWarning>), StatusError> |
9c6b458a08e1
rust: Move "lookup" a.k.a. "unsure" paths into `DirstateStatus` struct
Simon Sapin <simon.sapin@octobus.net>
parents:
47109
diff
changeset
|
253 { |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
254 crate::status(self, matcher, root_dir, ignore_files, options) |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
255 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
256 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
257 fn copy_map_len(&self) -> usize { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
258 self.copy_map.len() |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
259 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
260 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
261 fn copy_map_iter(&self) -> CopyMapIter<'_> { |
47124
cd8ca38fccff
rust: Use `&HgPath` instead of `&HgPathBuf` in may APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47123
diff
changeset
|
262 Box::new(self.copy_map.iter().map(|(key, value)| (&**key, &**value))) |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
263 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
264 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
265 fn copy_map_contains_key(&self, key: &HgPath) -> bool { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
266 self.copy_map.contains_key(key) |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
267 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
268 |
47124
cd8ca38fccff
rust: Use `&HgPath` instead of `&HgPathBuf` in may APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47123
diff
changeset
|
269 fn copy_map_get(&self, key: &HgPath) -> Option<&HgPath> { |
cd8ca38fccff
rust: Use `&HgPath` instead of `&HgPathBuf` in may APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47123
diff
changeset
|
270 self.copy_map.get(key).map(|p| &**p) |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
271 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
272 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
273 fn copy_map_remove(&mut self, key: &HgPath) -> Option<HgPathBuf> { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
274 self.copy_map.remove(key) |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
275 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
276 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
277 fn copy_map_insert( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
278 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
279 key: HgPathBuf, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
280 value: HgPathBuf, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
281 ) -> Option<HgPathBuf> { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
282 self.copy_map.insert(key, value) |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
283 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
284 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
285 fn len(&self) -> usize { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
286 (&**self).len() |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
287 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
288 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
289 fn contains_key(&self, key: &HgPath) -> bool { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
290 (&**self).contains_key(key) |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
291 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
292 |
47332
4ee9f419c52e
rust: Return owned instead of borrowed DirstateEntry in DirstateMap APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47280
diff
changeset
|
293 fn get(&self, key: &HgPath) -> Option<DirstateEntry> { |
4ee9f419c52e
rust: Return owned instead of borrowed DirstateEntry in DirstateMap APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47280
diff
changeset
|
294 (&**self).get(key).cloned() |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
295 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
296 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
297 fn iter(&self) -> StateMapIter<'_> { |
47332
4ee9f419c52e
rust: Return owned instead of borrowed DirstateEntry in DirstateMap APIs
Simon Sapin <simon.sapin@octobus.net>
parents:
47280
diff
changeset
|
298 Box::new((&**self).iter().map(|(key, value)| (&**key, *value))) |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
299 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
300 } |