Mercurial > hg
annotate rust/hg-core/src/dirstate_tree/dispatch.rs @ 47491:8851acad5906
rust: Document the DirstateMapMethods trait
Differential Revision: https://phab.mercurial-scm.org/D10919
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Thu, 01 Jul 2021 18:51:18 +0200 |
parents | eb416759af7e |
children | eaae39894312 |
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; |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
4 use crate::dirstate_tree::on_disk::DirstateV2ParseError; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
5 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
|
6 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
|
7 use crate::CopyMapIter; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
8 use crate::DirstateEntry; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
9 use crate::DirstateError; |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
10 use crate::DirstateMap; |
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 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
19 /// `rust/hg-cpython/src/dirstate/dirstate_map.rs` implements in Rust a |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
20 /// `DirstateMap` Python class that wraps `Box<dyn DirstateMapMethods + Send>`, |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
21 /// a trait object of this trait. Except for constructors, this trait defines |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
22 /// all APIs that the class needs to interact with its inner dirstate map. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
23 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
24 /// A trait object is used to support two different concrete types: |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
25 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
26 /// * `rust/hg-core/src/dirstate/dirstate_map.rs` defines the "flat dirstate |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
27 /// map" which is based on a few large `HgPath`-keyed `HashMap` and `HashSet` |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
28 /// fields. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
29 /// * `rust/hg-core/src/dirstate_tree/dirstate_map.rs` defines the "tree |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
30 /// dirstate map" based on a tree data struture with nodes for directories |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
31 /// containing child nodes for their files and sub-directories. This tree |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
32 /// enables a more efficient algorithm for `hg status`, but its details are |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
33 /// abstracted in this trait. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
34 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
35 /// The dirstate map associates paths of files in the working directory to |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
36 /// various information about the state of those files. |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
37 pub trait DirstateMapMethods { |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
38 /// Remove information about all files in this map |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
39 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
|
40 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
41 /// Add or change the information associated to a given file. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
42 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
43 /// `old_state` is the state in the entry that `get` would have returned |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
44 /// before this call, or `EntryState::Unknown` if there was no such entry. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
45 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
46 /// `entry.state` should never be `EntryState::Unknown`. |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
47 fn add_file( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
48 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
49 filename: &HgPath, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
50 old_state: EntryState, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
51 entry: DirstateEntry, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
52 ) -> Result<(), DirstateError>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
53 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
54 /// Mark a file as "removed" (as in `hg rm`). |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
55 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
56 /// `old_state` is the state in the entry that `get` would have returned |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
57 /// before this call, or `EntryState::Unknown` if there was no such entry. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
58 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
59 /// `size` is not actually a size but the 0 or -1 or -2 value that would be |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
60 /// put in the size field in the dirstate-v1 format. |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
61 fn remove_file( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
62 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
63 filename: &HgPath, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
64 old_state: EntryState, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
65 size: i32, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
66 ) -> Result<(), DirstateError>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
67 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
68 /// Drop information about this file from the map if any, and return |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
69 /// whether there was any. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
70 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
71 /// `get` will now return `None` for this filename. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
72 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
73 /// `old_state` is the state in the entry that `get` would have returned |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
74 /// before this call, or `EntryState::Unknown` if there was no such entry. |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
75 fn drop_file( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
76 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
77 filename: &HgPath, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
78 old_state: EntryState, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
79 ) -> Result<bool, DirstateError>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
80 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
81 /// Among given files, mark the stored `mtime` as ambiguous if there is one |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
82 /// (if `state == EntryState::Normal`) equal to the given current Unix |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
83 /// timestamp. |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
84 fn clear_ambiguous_times( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
85 &mut self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
86 filenames: Vec<HgPathBuf>, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
87 now: i32, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
88 ) -> Result<(), DirstateV2ParseError>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
89 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
90 /// Return whether the map has an "non-normal" entry for the given |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
91 /// filename. That is, any entry with a `state` other than |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
92 /// `EntryState::Normal` or with an ambiguous `mtime`. |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
93 fn non_normal_entries_contains( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
94 &mut self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
95 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
96 ) -> Result<bool, DirstateV2ParseError>; |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
97 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
98 /// Mark the given path as "normal" file. This is only relevant in the flat |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
99 /// dirstate map where there is a separate `HashSet` that needs to be kept |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
100 /// up to date. |
47108
e3cebe96c0fc
dirstate-tree: Add "non normal" and "from other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47101
diff
changeset
|
101 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
|
102 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
103 /// Return an iterator of paths whose respective entry are either |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
104 /// "non-normal" (see `non_normal_entries_contains`) or "from other |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
105 /// parent". |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
106 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
107 /// If that information is cached, create the cache as needed. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
108 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
109 /// "From other parent" is defined as `state == Normal && size == -2`. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
110 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
111 /// Because parse errors can happen during iteration, the iterated items |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
112 /// are `Result`s. |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
113 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
|
114 &mut self, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
115 ) -> Box<dyn Iterator<Item = Result<&HgPath, DirstateV2ParseError>> + '_>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
116 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
117 /// Create the cache for `non_normal_or_other_parent_paths` if needed. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
118 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
119 /// If `force` is true, the cache is re-created even if it already exists. |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
120 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
|
121 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
122 /// Return an iterator of paths whose respective entry are "non-normal" |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
123 /// (see `non_normal_entries_contains`). |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
124 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
125 /// If that information is cached, create the cache as needed. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
126 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
127 /// Because parse errors can happen during iteration, the iterated items |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
128 /// are `Result`s. |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
129 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
|
130 &mut self, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
131 ) -> Box< |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
132 dyn Iterator<Item = Result<&HgPath, DirstateV2ParseError>> + Send + '_, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
133 >; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
134 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
135 /// Same as `iter_non_normal_paths`, but takes `&self` instead of `&mut |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
136 /// self`. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
137 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
138 /// Panics if a cache is necessary but does not exist yet. |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
139 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
|
140 &self, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
141 ) -> Box< |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
142 dyn Iterator<Item = Result<&HgPath, DirstateV2ParseError>> + Send + '_, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
143 >; |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
144 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
145 /// Return an iterator of paths whose respective entry are "from other |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
146 /// parent". |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
147 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
148 /// If that information is cached, create the cache as needed. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
149 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
150 /// "From other parent" is defined as `state == Normal && size == -2`. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
151 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
152 /// Because parse errors can happen during iteration, the iterated items |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
153 /// are `Result`s. |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
154 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
|
155 &mut self, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
156 ) -> Box< |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
157 dyn Iterator<Item = Result<&HgPath, DirstateV2ParseError>> + Send + '_, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
158 >; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
159 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
160 /// Returns whether the sub-tree rooted at the given directory contains any |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
161 /// tracked file. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
162 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
163 /// A file is tracked if it has a `state` other than `EntryState::Removed`. |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
164 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
|
165 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
166 directory: &HgPath, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
167 ) -> Result<bool, DirstateError>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
168 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
169 /// Returns whether the sub-tree rooted at the given directory contains any |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
170 /// file with a dirstate entry. |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
171 fn has_dir(&mut self, directory: &HgPath) -> Result<bool, DirstateError>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
172 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
173 /// Clear mtimes that are ambigous with `now` (similar to |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
174 /// `clear_ambiguous_times` but for all files in the dirstate map), and |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
175 /// serialize bytes to write the `.hg/dirstate` file to disk in dirstate-v1 |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
176 /// format. |
47280
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
177 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
|
178 &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
|
179 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
|
180 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
|
181 ) -> 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
|
182 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
183 /// Clear mtimes that are ambigous with `now` (similar to |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
184 /// `clear_ambiguous_times` but for all files in the dirstate map), and |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
185 /// serialize bytes to write the `.hg/dirstate` file to disk in dirstate-v2 |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
186 /// format. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
187 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
188 /// Note: this is only supported by the tree dirstate map. |
47280
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
189 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
|
190 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
191 parents: DirstateParents, |
47101
5d62243c7732
rust: Add a Timestamp struct instead of abusing Duration
Simon Sapin <simon.sapin@octobus.net>
parents:
47094
diff
changeset
|
192 now: Timestamp, |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
193 ) -> 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
|
194 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
195 /// Run the status algorithm. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
196 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
197 /// This is not sematically a method of the dirstate map, but a different |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
198 /// algorithm is used for the flat v.s. tree dirstate map so having it in |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
199 /// this trait enables the same dynamic dispatch as with other methods. |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
200 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
|
201 &'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
|
202 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
|
203 root_dir: PathBuf, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
204 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
|
205 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
|
206 ) -> 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
|
207 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
208 /// Returns how many files in the dirstate map have a recorded copy source. |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
209 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
|
210 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
211 /// Returns an iterator of `(path, copy_source)` for all files that have a |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
212 /// copy source. |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
213 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
|
214 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
215 /// Returns whether the givef file has a copy source. |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
216 fn copy_map_contains_key( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
217 &self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
218 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
219 ) -> Result<bool, DirstateV2ParseError>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
220 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
221 /// Returns the copy source for the given file. |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
222 fn copy_map_get( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
223 &self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
224 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
225 ) -> Result<Option<&HgPath>, DirstateV2ParseError>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
226 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
227 /// Removes the recorded copy source if any for the given file, and returns |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
228 /// it. |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
229 fn copy_map_remove( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
230 &mut self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
231 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
232 ) -> Result<Option<HgPathBuf>, DirstateV2ParseError>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
233 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
234 /// Set the given `value` copy source for the given `key` file. |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
235 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
|
236 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
237 key: HgPathBuf, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
238 value: HgPathBuf, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
239 ) -> Result<Option<HgPathBuf>, DirstateV2ParseError>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
240 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
241 /// Returns the number of files that have an entry. |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
242 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
|
243 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
244 /// Returns whether the given file has an entry. |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
245 fn contains_key(&self, key: &HgPath) |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
246 -> Result<bool, DirstateV2ParseError>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
247 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
248 /// Returns the entry, if any, for the given file. |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
249 fn get( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
250 &self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
251 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
252 ) -> Result<Option<DirstateEntry>, DirstateV2ParseError>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
253 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
254 /// Returns a `(path, entry)` iterator of files that have an entry. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
255 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
256 /// Because parse errors can happen during iteration, the iterated items |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
257 /// are `Result`s. |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
258 fn iter(&self) -> StateMapIter<'_>; |
47351
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
259 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
260 /// In the tree dirstate, return an iterator of "directory" (entry-less) |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
261 /// nodes with the data stored for them. This is for `hg debugdirstate |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
262 /// --dirs`. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
263 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
264 /// In the flat dirstate, returns an empty iterator. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
265 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
266 /// Because parse errors can happen during iteration, the iterated items |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
267 /// are `Result`s. |
47351
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
268 fn iter_directories( |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
269 &self, |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
270 ) -> Box< |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
271 dyn Iterator< |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
272 Item = Result< |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
273 (&HgPath, Option<Timestamp>), |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
274 DirstateV2ParseError, |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
275 >, |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
276 > + Send |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
277 + '_, |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
278 >; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
279 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
280 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
281 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
|
282 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
|
283 self.clear() |
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 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
286 fn add_file( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
287 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
288 filename: &HgPath, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
289 old_state: EntryState, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
290 entry: DirstateEntry, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
291 ) -> Result<(), DirstateError> { |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
292 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
|
293 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
294 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
295 fn remove_file( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
296 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
297 filename: &HgPath, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
298 old_state: EntryState, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
299 size: i32, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
300 ) -> Result<(), DirstateError> { |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
301 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
|
302 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
303 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
304 fn drop_file( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
305 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
306 filename: &HgPath, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
307 old_state: EntryState, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
308 ) -> Result<bool, DirstateError> { |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
309 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
|
310 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
311 |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
312 fn clear_ambiguous_times( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
313 &mut self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
314 filenames: Vec<HgPathBuf>, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
315 now: i32, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
316 ) -> Result<(), DirstateV2ParseError> { |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
317 Ok(self.clear_ambiguous_times(filenames, now)) |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
318 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
319 |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
320 fn non_normal_entries_contains( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
321 &mut self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
322 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
323 ) -> Result<bool, DirstateV2ParseError> { |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
324 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
|
325 self.get_non_normal_other_parent_entries(); |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
326 Ok(non_normal.contains(key)) |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
327 } |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
328 |
47108
e3cebe96c0fc
dirstate-tree: Add "non normal" and "from other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47101
diff
changeset
|
329 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
|
330 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
|
331 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
332 |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
333 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
|
334 &mut self, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
335 ) -> Box<dyn Iterator<Item = Result<&HgPath, DirstateV2ParseError>> + '_> |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
336 { |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
337 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
|
338 self.get_non_normal_other_parent_entries(); |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
339 Box::new(non_normal.union(other_parent).map(|p| Ok(&**p))) |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
340 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
341 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
342 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
|
343 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
|
344 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
345 |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
346 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
|
347 &mut self, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
348 ) -> Box< |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
349 dyn Iterator<Item = Result<&HgPath, DirstateV2ParseError>> + Send + '_, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
350 > { |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
351 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
|
352 self.get_non_normal_other_parent_entries(); |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
353 Box::new(non_normal.iter().map(|p| Ok(&**p))) |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
354 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
355 |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
356 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
|
357 &self, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
358 ) -> Box< |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
359 dyn Iterator<Item = Result<&HgPath, DirstateV2ParseError>> + Send + '_, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
360 > { |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
361 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
|
362 self.get_non_normal_other_parent_entries_panic(); |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
363 Box::new(non_normal.iter().map(|p| Ok(&**p))) |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
364 } |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
365 |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
366 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
|
367 &mut self, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
368 ) -> Box< |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
369 dyn Iterator<Item = Result<&HgPath, DirstateV2ParseError>> + Send + '_, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
370 > { |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
371 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
|
372 self.get_non_normal_other_parent_entries(); |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
373 Box::new(other_parent.iter().map(|p| Ok(&**p))) |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
374 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
375 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
376 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
|
377 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
378 directory: &HgPath, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
379 ) -> Result<bool, DirstateError> { |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
380 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
|
381 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
382 |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
383 fn has_dir(&mut self, directory: &HgPath) -> Result<bool, DirstateError> { |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
384 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
|
385 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
386 |
47280
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
387 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
|
388 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
389 parents: DirstateParents, |
47101
5d62243c7732
rust: Add a Timestamp struct instead of abusing Duration
Simon Sapin <simon.sapin@octobus.net>
parents:
47094
diff
changeset
|
390 now: Timestamp, |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
391 ) -> 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
|
392 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
|
393 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
394 |
47280
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
395 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
|
396 &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
|
397 _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
|
398 _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
|
399 ) -> 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
|
400 panic!( |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
401 "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
|
402 ) |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
403 } |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
404 |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
405 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
|
406 &'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
|
407 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
|
408 root_dir: PathBuf, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
409 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
|
410 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
|
411 ) -> 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
|
412 { |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
413 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
|
414 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
415 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
416 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
|
417 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
|
418 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
419 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
420 fn copy_map_iter(&self) -> CopyMapIter<'_> { |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
421 Box::new( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
422 self.copy_map |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
423 .iter() |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
424 .map(|(key, value)| Ok((&**key, &**value))), |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
425 ) |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
426 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
427 |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
428 fn copy_map_contains_key( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
429 &self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
430 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
431 ) -> Result<bool, DirstateV2ParseError> { |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
432 Ok(self.copy_map.contains_key(key)) |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
433 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
434 |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
435 fn copy_map_get( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
436 &self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
437 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
438 ) -> Result<Option<&HgPath>, DirstateV2ParseError> { |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
439 Ok(self.copy_map.get(key).map(|p| &**p)) |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
440 } |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
441 |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
442 fn copy_map_remove( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
443 &mut self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
444 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
445 ) -> Result<Option<HgPathBuf>, DirstateV2ParseError> { |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
446 Ok(self.copy_map.remove(key)) |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
447 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
448 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
449 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
|
450 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
451 key: HgPathBuf, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
452 value: HgPathBuf, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
453 ) -> Result<Option<HgPathBuf>, DirstateV2ParseError> { |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
454 Ok(self.copy_map.insert(key, value)) |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
455 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
456 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
457 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
|
458 (&**self).len() |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
459 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
460 |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
461 fn contains_key( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
462 &self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
463 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
464 ) -> Result<bool, DirstateV2ParseError> { |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
465 Ok((&**self).contains_key(key)) |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
466 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
467 |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
468 fn get( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
469 &self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
470 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
471 ) -> Result<Option<DirstateEntry>, DirstateV2ParseError> { |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
472 Ok((&**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
|
473 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
474 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
475 fn iter(&self) -> StateMapIter<'_> { |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
476 Box::new((&**self).iter().map(|(key, value)| Ok((&**key, *value)))) |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
477 } |
47351
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
478 |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
479 fn iter_directories( |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
480 &self, |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
481 ) -> Box< |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
482 dyn Iterator< |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
483 Item = Result< |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
484 (&HgPath, Option<Timestamp>), |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
485 DirstateV2ParseError, |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
486 >, |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
487 > + Send |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
488 + '_, |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
489 > { |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
490 Box::new(std::iter::empty()) |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
491 } |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
492 } |