This is an archive of the discontinued Mercurial Phabricator instance.

rhg: add exit code to HgError::Abort()
ClosedPublic

Authored by pulkit on Jun 7 2021, 8:00 AM.

Details

Summary

My previous attempts to have rhg end with correct exit code was more of bug
hunting. I found cases which were failing and fixed them. But as one might
expect, more tests started failing.

Let's add exit code HgError::Abort() and make it users explicitly tell what
exit code they want.

Diff Detail

Repository
rHG Mercurial
Branch
default
Lint
No Linters Available
Unit
No Unit Test Coverage

Event Timeline

pulkit created this revision.Jun 7 2021, 8:00 AM
SimonSapin added inline comments.
rust/hg-core/src/config/layer.rs
83

Let’s define some named const items instead of using integer literals in this and other calls to HgError::abort. Maybe in errors.rs?

rust/hg-core/src/errors.rs
33–36

Please change this variant to use named fields, in order to say what this integer represents:

Abort { message: String, detailed_exit_code: i32 }

… and change "The given string" in the doc-comment to "message"

pixel gun 3d apk is a Android Gun game where you are experiance the 800+ guns and play with your friends.

pulkit updated this revision to Diff 28511.Jun 9 2021, 3:49 AM
Alphare requested changes to this revision.Jun 9 2021, 5:18 AM
Alphare added a subscriber: Alphare.
Alphare added inline comments.
rust/hg-core/src/exitcode.rs
1 ↗(On Diff #28511)

Nitpicking here, but exit_codes.rs would probably be a better name for this file.

rust/hg-core/src/repo.rs
154

This should use the constants defined above

This revision now requires changes to proceed.Jun 9 2021, 5:18 AM
baymax updated this revision to Diff 28537.Jun 9 2021, 1:22 PM

✅ refresh by Heptapod after a successful CI run (🐙 💚)

Alphare accepted this revision.Jun 10 2021, 3:32 AM
This revision is now accepted and ready to land.Jun 10 2021, 3:32 AM
This revision was automatically updated to reflect the committed changes.
rust/rhg/src/error.rs