The first of `hashes` that `view` cannot see, if any — for checking that what a sandbox's provenance explains is its own view's work.
(
&self,
view: &str,
hashes: &[Hash],
)
| 765 | /// The first of `hashes` that `view` cannot see, if any — for checking |
| 766 | /// that what a sandbox's provenance explains is its own view's work. |
| 767 | pub fn first_foreign_change( |
| 768 | &self, |
| 769 | view: &str, |
| 770 | hashes: &[Hash], |
| 771 | ) -> Result<Option<Hash>, RepositoryError> { |
| 772 | if hashes.is_empty() { |
| 773 | return Ok(None); |
| 774 | } |
| 775 | let txn = self.pristine.read_txn().map_err(db)?; |
| 776 | let state = |
| 777 | txn.get_view(view) |
| 778 | .map_err(db)? |
| 779 | .ok_or_else(|| RepositoryError::ViewNotFound { |
| 780 | name: view.to_string(), |
| 781 | })?; |
| 782 | let visible = super::graph_visibility_closure(&txn, &state)?; |
| 783 | for hash in hashes { |
| 784 | match txn.get_internal(hash).map_err(db)? { |
| 785 | Some(id) if visible.contains(id) => {} |
| 786 | _ => return Ok(Some(*hash)), |
| 787 | } |
| 788 | } |
| 789 | Ok(None) |
| 790 | } |
| 791 | |
| 792 | /// Cache side: the changes the view has that this cache holds no file |
| 793 | /// for. |