Verify that an ID, its record, and this canonical location all agree.
(&self, id: WorkingCopyId)
| 724 | |
| 725 | /// Verify that an ID, its record, and this canonical location all agree. |
| 726 | pub fn validate_working_copy(&self, id: WorkingCopyId) -> Result<(), RepositoryError> { |
| 727 | // One layout for all three checks: they describe the same moment. |
| 728 | let layout = self.handle_layout()?; |
| 729 | let actual = self.working_copy_id_in(&layout)?; |
| 730 | if actual != id { |
| 731 | return Err(RepositoryError::WorkingCopyIdentityMismatch { |
| 732 | requested: id, |
| 733 | actual, |
| 734 | }); |
| 735 | } |
| 736 | let record = self.working_copy_record_in(&layout, id)?; |
| 737 | if record.location_fingerprint != layout.location_fingerprint { |
| 738 | return Err(RepositoryError::WorkingCopyLocationMismatch { id }); |
| 739 | } |
| 740 | Ok(()) |
| 741 | } |
| 742 | |
| 743 | /// Resolve the authoritative desired view for a validated working copy. |
| 744 | pub fn desired_view_name(&self, id: WorkingCopyId) -> Result<String, RepositoryError> { |