This is an archive of the discontinued Mercurial Phabricator instance.

rust: make exit handling consistent with `hg`
AcceptedPublic

Authored by indygreg on May 6 2018, 12:11 AM.

Details

Reviewers
kevincox
durin42
Group Reviewers
hg-reviewers
Summary

Now that dispatch.run() handles special exit cases and always returns
an exit code, Rust's (formerly lacking) invocation of dispatch.run() can
handle the return value with minimal hassle.

In addition, we change Rust to exit 1 instead of 255 in the case
of unhandled errors, as that is actually what Python does.

This fixes a few test failures when running the test suite with rhg.

Diff Detail

Repository
rHG Mercurial
Lint
Lint Skipped
Unit
Unit Tests Skipped

Event Timeline

indygreg created this revision.May 6 2018, 12:11 AM
kevincox accepted this revision.May 6 2018, 3:51 AM
kevincox added inline comments.
rust/hgcli/src/main.rs
204

s/unreachable/panic/ since the code can never be hit as long as the python code returns the right type.

Also it might be a good idea to try to print out the value returned in the error message. Although if not easy it is probably not worth it.

durin42 accepted this revision.May 31 2018, 3:07 PM
This revision is now accepted and ready to land.May 31 2018, 3:07 PM