| 724 | } |
| 725 | |
| 726 | fn from_remote(info: &RemoteViewInfo) -> CliResult<Self> { |
| 727 | let scope = if info.scope.eq_ignore_ascii_case("shared") { |
| 728 | "shared" |
| 729 | } else if info.scope.eq_ignore_ascii_case("draft") { |
| 730 | "draft" |
| 731 | } else { |
| 732 | return Err(CliError::Internal(anyhow::anyhow!( |
| 733 | "Remote view '{}' has unsupported scope '{}'", |
| 734 | info.name, |
| 735 | info.scope |
| 736 | ))); |
| 737 | }; |
| 738 | |
| 739 | Ok(Self { |
| 740 | name: info.name.clone(), |
| 741 | current: false, |
| 742 | scope: scope.to_string(), |
| 743 | parent: info.parent.clone(), |
| 744 | change_count: info.change_count, |
| 745 | own_change_count: None, |
| 746 | inherited_change_count: None, |
| 747 | state: info.state.clone(), |
| 748 | set_id: info.set_id.clone(), |
| 749 | }) |
| 750 | } |
| 751 | } |
| 752 | |
| 753 | fn sanitized_remote_label(remote: &str) -> String { |