diff --git a/rust/rhg/src/main.rs b/rust/rhg/src/main.rs --- a/rust/rhg/src/main.rs +++ b/rust/rhg/src/main.rs @@ -167,7 +167,29 @@ ) } } - let repo_path = early_args.repo.as_deref().map(get_path_from_bytes); + let repo_arg = early_args.repo.unwrap_or(Vec::new()); + let repo_path = { + if repo_arg.len() == 0 { + None + } else { + let config_val = non_repo_config.get_str(b"paths", &(repo_arg)); + if config_val.is_ok() { + let val = config_val.unwrap(); + if !val.is_none() { + let real_val = val.unwrap(); + if real_val.len() > 0 { + Some(get_path_from_bytes(val.unwrap().as_bytes())) + } else { + Some(get_path_from_bytes(&repo_arg)) + } + } else { + Some(get_path_from_bytes(&repo_arg)) + } + } else { + Some(get_path_from_bytes(&repo_arg)) + } + } + }; let repo_result = match Repo::find(&non_repo_config, repo_path) { Ok(repo) => Ok(repo), Err(RepoError::NotFound { at }) if repo_path.is_none() => { diff --git a/tests/test-globalopts.t b/tests/test-globalopts.t --- a/tests/test-globalopts.t +++ b/tests/test-globalopts.t @@ -65,19 +65,19 @@ -R with path aliases: + $ cd c TODO: add rhg support for path aliases #if no-rhg - $ cd c $ hg -R default identify 8580ff50825a tip $ hg -R relative identify 8580ff50825a tip +#endif $ echo '[paths]' >> $HGRCPATH $ echo 'relativetohome = a' >> $HGRCPATH $ HOME=`pwd`/../ hg -R relativetohome identify 8580ff50825a tip $ cd .. -#endif #if no-outer-repo