Set the current view (internal, does not update working copy). Update the view pointer on disk without materializing. This updates both the in-memory state and persists the change to disk, but does **NOT** update the working copy. The working copy may be left inconsistent with the view pointer — `status()` handles this gracefully (files tracked on other views show as `Added` rather than `Untrac
(&mut self, view: &str)
| 612 | /// Returns an error if the view does not exist or the pointer file |
| 613 | /// cannot be written. |
| 614 | pub fn set_current_view(&mut self, view: &str) -> Result<(), RepositoryError> { |
| 615 | // Verify the view exists in the pristine database |
| 616 | { |
| 617 | let txn = self |
| 618 | .pristine |
| 619 | .read_txn() |
| 620 | .map_err(|e| RepositoryError::Database(e.to_string()))?; |
| 621 | |
| 622 | if txn |
| 623 | .get_view(view) |
| 624 | .map_err(|e| RepositoryError::Database(e.to_string()))? |
| 625 | .is_none() |
| 626 | { |
| 627 | return Err(RepositoryError::ViewNotFound { |
| 628 | name: view.to_string(), |
| 629 | }); |
| 630 | } |
| 631 | } |
| 632 | |
| 633 | self.current_view = view.to_string(); |
| 634 | self.write_current_view(view)?; |
| 635 | Ok(()) |
| 636 | } |
| 637 | |
| 638 | /// Align the view pointer without materializing the working copy. |
| 639 | /// |