rust/rhg/src/main.rs
changeset 46729 6cd9f53aaed8
parent 46667 93e9f448273c
child 46731 3d692e724d06
equal deleted inserted replaced
46728:562a676e255a 46729:6cd9f53aaed8
    93             let on_unsupported = OnUnsupported::Abort;
    93             let on_unsupported = OnUnsupported::Abort;
    94 
    94 
    95             exit(&ui, on_unsupported, Err(error.into()))
    95             exit(&ui, on_unsupported, Err(error.into()))
    96         });
    96         });
    97 
    97 
       
    98     if let Some(repo_path_bytes) = &early_args.repo {
       
    99         lazy_static::lazy_static! {
       
   100             static ref SCHEME_RE: regex::bytes::Regex =
       
   101                 // Same as `_matchscheme` in `mercurial/util.py`
       
   102                 regex::bytes::Regex::new("^[a-zA-Z0-9+.\\-]+:").unwrap();
       
   103         }
       
   104         if SCHEME_RE.is_match(&repo_path_bytes) {
       
   105             exit(
       
   106                 &ui,
       
   107                 OnUnsupported::from_config(&non_repo_config),
       
   108                 Err(CommandError::UnsupportedFeature {
       
   109                     message: format_bytes!(
       
   110                         b"URL-like --repository {}",
       
   111                         repo_path_bytes
       
   112                     ),
       
   113                 }),
       
   114             )
       
   115         }
       
   116     }
    98     let repo_path = early_args.repo.as_deref().map(get_path_from_bytes);
   117     let repo_path = early_args.repo.as_deref().map(get_path_from_bytes);
    99     let repo_result = match Repo::find(&non_repo_config, repo_path) {
   118     let repo_result = match Repo::find(&non_repo_config, repo_path) {
   100         Ok(repo) => Ok(repo),
   119         Ok(repo) => Ok(repo),
   101         Err(RepoError::NotFound { at }) if repo_path.is_none() => {
   120         Err(RepoError::NotFound { at }) if repo_path.is_none() => {
   102             // Not finding a repo is not fatal yet, if `-R` was not given
   121             // Not finding a repo is not fatal yet, if `-R` was not given