rust/hg-core/src/repo.rs
changeset 47410 ebdef6283798
parent 47380 bd88b6bfd8da
child 47411 88119fffecc8
equal deleted inserted replaced
47409:8a6e6b62b9a3 47410:ebdef6283798
    51     /// to make two methods instead, but in this case an `Option` is what rhg
    51     /// to make two methods instead, but in this case an `Option` is what rhg
    52     /// sub-commands get from Clap for the `-R` / `--repository` CLI argument.
    52     /// sub-commands get from Clap for the `-R` / `--repository` CLI argument.
    53     /// Having two methods would just move that `if` to almost all callers.
    53     /// Having two methods would just move that `if` to almost all callers.
    54     pub fn find(
    54     pub fn find(
    55         config: &Config,
    55         config: &Config,
    56         explicit_path: Option<&Path>,
    56         explicit_path: Option<PathBuf>,
    57     ) -> Result<Self, RepoError> {
    57     ) -> Result<Self, RepoError> {
    58         if let Some(root) = explicit_path {
    58         if let Some(root) = explicit_path {
    59             if root.join(".hg").is_dir() {
    59             if root.join(".hg").is_dir() {
    60                 Self::new_at_path(root.to_owned(), config)
    60                 Self::new_at_path(root.to_owned(), config)
    61             } else if root.is_file() {
    61             } else if root.is_file() {