Mercurial > hg
annotate rust/hg-core/src/dirstate_tree/dispatch.rs @ 47527:c6b91a9c242a
dirstate: use a `merged` parameter to _addpath
Differential Revision: https://phab.mercurial-scm.org/D10969
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 04 Jul 2021 01:48:11 +0200 |
parents | fe4641cf9b72 |
children | 6025353c9c55 |
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 entry: DirstateEntry, |
47525
fe4641cf9b72
dirstate: use a `added` parameter to _addpath
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47524
diff
changeset
|
51 added: bool, |
47527
c6b91a9c242a
dirstate: use a `merged` parameter to _addpath
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47525
diff
changeset
|
52 merged: bool, |
47521
abed645b8e96
dirstate: move the handling of special case within the dirstatemap
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47511
diff
changeset
|
53 from_p2: bool, |
abed645b8e96
dirstate: move the handling of special case within the dirstatemap
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47511
diff
changeset
|
54 possibly_dirty: bool, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
55 ) -> Result<(), DirstateError>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
56 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
57 /// 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
|
58 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
59 /// `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
|
60 /// 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
|
61 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
62 /// `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
|
63 /// 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
|
64 fn remove_file( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
65 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
66 filename: &HgPath, |
47511
eaae39894312
dirstate: move most of the `remove` logic with dirstatemap `removefile`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47491
diff
changeset
|
67 in_merge: bool, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
68 ) -> Result<(), DirstateError>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
69 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
70 /// 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
|
71 /// whether there was any. |
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 /// `get` will now return `None` for this filename. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
74 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
75 /// `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
|
76 /// 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
|
77 fn drop_file( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
78 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
79 filename: &HgPath, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
80 old_state: EntryState, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
81 ) -> 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
|
82 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
83 /// 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
|
84 /// (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
|
85 /// timestamp. |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
86 fn clear_ambiguous_times( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
87 &mut self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
88 filenames: Vec<HgPathBuf>, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
89 now: i32, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
90 ) -> Result<(), DirstateV2ParseError>; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
91 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
92 /// 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
|
93 /// 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
|
94 /// `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
|
95 fn non_normal_entries_contains( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
96 &mut self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
97 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
98 ) -> Result<bool, DirstateV2ParseError>; |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
99 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
100 /// 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
|
101 /// 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
|
102 /// 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
|
103 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
|
104 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
105 /// 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
|
106 /// "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
|
107 /// parent". |
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 /// 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
|
110 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
111 /// "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
|
112 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
113 /// 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
|
114 /// are `Result`s. |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
115 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
|
116 &mut self, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
117 ) -> 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
|
118 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
119 /// 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
|
120 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
121 /// 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
|
122 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
|
123 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
124 /// 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
|
125 /// (see `non_normal_entries_contains`). |
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 /// 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
|
128 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
129 /// 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
|
130 /// are `Result`s. |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
131 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
|
132 &mut self, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
133 ) -> Box< |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
134 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
|
135 >; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
136 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
137 /// 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
|
138 /// self`. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
139 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
140 /// 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
|
141 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
|
142 &self, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
143 ) -> Box< |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
144 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
|
145 >; |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
146 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
147 /// 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
|
148 /// parent". |
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 /// 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
|
151 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
152 /// "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
|
153 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
154 /// 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
|
155 /// are `Result`s. |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
156 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
|
157 &mut self, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
158 ) -> Box< |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
159 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
|
160 >; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
161 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
162 /// 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
|
163 /// tracked file. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
164 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
165 /// 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
|
166 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
|
167 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
168 directory: &HgPath, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
169 ) -> 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
|
170 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
171 /// 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
|
172 /// 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
|
173 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
|
174 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
175 /// 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
|
176 /// `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
|
177 /// 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
|
178 /// 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
|
179 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
|
180 &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
|
181 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
|
182 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
|
183 ) -> 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
|
184 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
185 /// 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
|
186 /// `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
|
187 /// 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
|
188 /// format. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
189 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
190 /// 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
|
191 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
|
192 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
193 parents: DirstateParents, |
47101
5d62243c7732
rust: Add a Timestamp struct instead of abusing Duration
Simon Sapin <simon.sapin@octobus.net>
parents:
47094
diff
changeset
|
194 now: Timestamp, |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
195 ) -> 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
|
196 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
197 /// Run the status algorithm. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
198 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
199 /// 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
|
200 /// 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
|
201 /// 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
|
202 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
|
203 &'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
|
204 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
|
205 root_dir: PathBuf, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
206 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
|
207 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
|
208 ) -> 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
|
209 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
210 /// 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
|
211 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
|
212 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
213 /// 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
|
214 /// copy source. |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
215 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
|
216 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
217 /// 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
|
218 fn copy_map_contains_key( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
219 &self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
220 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
221 ) -> 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
|
222 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
223 /// 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
|
224 fn copy_map_get( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
225 &self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
226 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
227 ) -> 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
|
228 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
229 /// 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
|
230 /// it. |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
231 fn copy_map_remove( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
232 &mut self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
233 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
234 ) -> 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
|
235 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
236 /// 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
|
237 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
|
238 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
239 key: HgPathBuf, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
240 value: HgPathBuf, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
241 ) -> 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
|
242 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
243 /// 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
|
244 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
|
245 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
246 /// 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
|
247 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
|
248 -> 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
|
249 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
250 /// 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
|
251 fn get( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
252 &self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
253 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
254 ) -> 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
|
255 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
256 /// 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
|
257 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
258 /// 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
|
259 /// 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
|
260 fn iter(&self) -> StateMapIter<'_>; |
47351
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
261 |
47491
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
262 /// 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
|
263 /// 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
|
264 /// --dirs`. |
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 /// In the flat dirstate, returns an empty iterator. |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
267 /// |
8851acad5906
rust: Document the DirstateMapMethods trait
Simon Sapin <simon.sapin@octobus.net>
parents:
47477
diff
changeset
|
268 /// 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
|
269 /// are `Result`s. |
47351
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
270 fn iter_directories( |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
271 &self, |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
272 ) -> Box< |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
273 dyn Iterator< |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
274 Item = Result< |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
275 (&HgPath, Option<Timestamp>), |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
276 DirstateV2ParseError, |
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 > + Send |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
279 + '_, |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
280 >; |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
281 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
282 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
283 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
|
284 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
|
285 self.clear() |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
286 } |
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 fn add_file( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
289 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
290 filename: &HgPath, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
291 entry: DirstateEntry, |
47525
fe4641cf9b72
dirstate: use a `added` parameter to _addpath
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47524
diff
changeset
|
292 added: bool, |
47527
c6b91a9c242a
dirstate: use a `merged` parameter to _addpath
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47525
diff
changeset
|
293 merged: bool, |
47521
abed645b8e96
dirstate: move the handling of special case within the dirstatemap
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47511
diff
changeset
|
294 from_p2: bool, |
abed645b8e96
dirstate: move the handling of special case within the dirstatemap
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47511
diff
changeset
|
295 possibly_dirty: bool, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
296 ) -> Result<(), DirstateError> { |
47527
c6b91a9c242a
dirstate: use a `merged` parameter to _addpath
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47525
diff
changeset
|
297 self.add_file(filename, entry, added, merged, from_p2, possibly_dirty) |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
298 } |
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 fn remove_file( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
301 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
302 filename: &HgPath, |
47511
eaae39894312
dirstate: move most of the `remove` logic with dirstatemap `removefile`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47491
diff
changeset
|
303 in_merge: bool, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
304 ) -> Result<(), DirstateError> { |
47511
eaae39894312
dirstate: move most of the `remove` logic with dirstatemap `removefile`
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
47491
diff
changeset
|
305 self.remove_file(filename, in_merge) |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
306 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
307 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
308 fn drop_file( |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
309 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
310 filename: &HgPath, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
311 old_state: EntryState, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
312 ) -> 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
|
313 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
|
314 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
315 |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
316 fn clear_ambiguous_times( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
317 &mut self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
318 filenames: Vec<HgPathBuf>, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
319 now: i32, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
320 ) -> Result<(), DirstateV2ParseError> { |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
321 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
|
322 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
323 |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
324 fn non_normal_entries_contains( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
325 &mut self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
326 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
327 ) -> Result<bool, DirstateV2ParseError> { |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
328 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
|
329 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
|
330 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
|
331 } |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
332 |
47108
e3cebe96c0fc
dirstate-tree: Add "non normal" and "from other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47101
diff
changeset
|
333 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
|
334 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
|
335 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
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 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
|
338 &mut self, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
339 ) -> 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
|
340 { |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
341 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
|
342 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
|
343 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
|
344 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
345 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
346 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
|
347 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
|
348 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
349 |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
350 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
|
351 &mut self, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
352 ) -> Box< |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
353 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
|
354 > { |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
355 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
|
356 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
|
357 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
|
358 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
359 |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
360 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
|
361 &self, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
362 ) -> Box< |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
363 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
|
364 > { |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
365 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
|
366 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
|
367 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
|
368 } |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
369 |
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
370 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
|
371 &mut self, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
372 ) -> Box< |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
373 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
|
374 > { |
47094
e061a1df32a8
dirstate-tree: Abstract "non-normal" and "other parent" sets
Simon Sapin <simon.sapin@octobus.net>
parents:
47093
diff
changeset
|
375 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
|
376 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
|
377 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
|
378 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
379 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
380 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
|
381 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
382 directory: &HgPath, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
383 ) -> 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_tracked_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 |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
387 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
|
388 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
|
389 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
390 |
47280
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
391 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
|
392 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
393 parents: DirstateParents, |
47101
5d62243c7732
rust: Add a Timestamp struct instead of abusing Duration
Simon Sapin <simon.sapin@octobus.net>
parents:
47094
diff
changeset
|
394 now: Timestamp, |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
395 ) -> 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
|
396 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
|
397 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
398 |
47280
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
399 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
|
400 &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
|
401 _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
|
402 _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
|
403 ) -> 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
|
404 panic!( |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
405 "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
|
406 ) |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
407 } |
1766130fe9ba
dirstate-v2: Change the on-disk format when the requirement is enabled
Simon Sapin <simon.sapin@octobus.net>
parents:
47124
diff
changeset
|
408 |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
409 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
|
410 &'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
|
411 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
|
412 root_dir: PathBuf, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
413 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
|
414 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
|
415 ) -> 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
|
416 { |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
417 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
|
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_len(&self) -> usize { |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
421 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
|
422 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
423 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
424 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
|
425 Box::new( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
426 self.copy_map |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
427 .iter() |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
428 .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
|
429 ) |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
430 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
431 |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
432 fn copy_map_contains_key( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
433 &self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
434 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
435 ) -> Result<bool, DirstateV2ParseError> { |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
436 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
|
437 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
438 |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
439 fn copy_map_get( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
440 &self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
441 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
442 ) -> Result<Option<&HgPath>, DirstateV2ParseError> { |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
443 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
|
444 } |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
445 |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
446 fn copy_map_remove( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
447 &mut self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
448 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
449 ) -> Result<Option<HgPathBuf>, DirstateV2ParseError> { |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
450 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
|
451 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
452 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
453 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
|
454 &mut self, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
455 key: HgPathBuf, |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
456 value: HgPathBuf, |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
457 ) -> Result<Option<HgPathBuf>, DirstateV2ParseError> { |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
458 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
|
459 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
460 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
461 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
|
462 (&**self).len() |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
463 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
464 |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
465 fn contains_key( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
466 &self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
467 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
468 ) -> Result<bool, DirstateV2ParseError> { |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
469 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
|
470 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
471 |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
472 fn get( |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
473 &self, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
474 key: &HgPath, |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
475 ) -> Result<Option<DirstateEntry>, DirstateV2ParseError> { |
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
476 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
|
477 } |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
478 |
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
479 fn iter(&self) -> StateMapIter<'_> { |
47335
ed1583a845d2
dirstate-v2: Make more APIs fallible, returning Result
Simon Sapin <simon.sapin@octobus.net>
parents:
47332
diff
changeset
|
480 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
|
481 } |
47351
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
482 |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
483 fn iter_directories( |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
484 &self, |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
485 ) -> Box< |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
486 dyn Iterator< |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
487 Item = Result< |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
488 (&HgPath, Option<Timestamp>), |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
489 DirstateV2ParseError, |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
490 >, |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
491 > + Send |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
492 + '_, |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
493 > { |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
494 Box::new(std::iter::empty()) |
3b9914b28133
dirstate-v2: Add --dirs to debugdirstate command
Simon Sapin <simon.sapin@octobus.net>
parents:
47335
diff
changeset
|
495 } |
47093
787ff5d21bcd
dirstate-tree: Make Rust DirstateMap bindings go through a trait object
Simon Sapin <simon.sapin@octobus.net>
parents:
diff
changeset
|
496 } |