hg parses -R and --repository CLI arguments "early" in order to know which
local repository to load config from. (Config can then affect whether or how to
fall back.)
The value of of those arguments can be not only a filesystem path, but also an
alias configured in the [paths] section. This part was missing in rhg and
this patch implements that.
The current patch still lacks functionality to read config of current repository
if we are not at root of repo. That will be fixed in upcoming patches.
A new crate home is added to get path of home directory.
The nested ifs can be replaced by:
Also, you're using get_str, when you should probably just be using get, which already returns bytes (and does not unnecessarily force UTF8). That would remove the need for as_bytes() in the above suggested code.