Last patch introduced config reading at startup to parse value of --repository
flag. However, that patch only tried to check for current repository at current
working directory and not it's ancestors. This patch fixes that.
Details
Details
- Reviewers
Alphare - Group Reviewers
hg-reviewers - Commits
- rHG88119fffecc8: rhg: look for repository in ancestors also instead of cwd only
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Branch
- default
- Lint
No Linters Available - Unit
No Unit Test Coverage
Event Timeline
rust/hg-core/src/repo.rs | ||
---|---|---|
46–48 | This doc should also mention ancestors. Something like "Find the nearest repository root, if any, in the current directory or its ancestors" The try_ prefix can be dropped from the name since fallibility is already apparent from the return type and there’s no equivalent infallibly (panicky) API. Compare with std::cell::RefCell which has both borrow and try_borrow, and std::fs::File whose open method is not named try_open. | |
86–87 | Please use if let or match instead of is_ok + unwrap |
rust/hg-core/src/repo.rs | ||
---|---|---|
86–87 | Sorry I didn’t realize this earlier: this entire match can be replaced with the ? operator: let root = Self::find_repo_root()? Self::new_at_path(root, config) |
This doc should also mention ancestors. Something like "Find the nearest repository root, if any, in the current directory or its ancestors"
The try_ prefix can be dropped from the name since fallibility is already apparent from the return type and there’s no equivalent infallibly (panicky) API. Compare with std::cell::RefCell which has both borrow and try_borrow, and std::fs::File whose open method is not named try_open.