This is an archive of the discontinued Mercurial Phabricator instance.

rhg: add RootCommand using hg-core FindRoot operation to prepare `hg root`
ClosedPublic

Authored by acezar on Jun 5 2020, 10:31 AM.

Details

Summary

The println macro is not used to avoid string usage.
Dealing only with bytes allows us to be compatible with any encoding
and not just UTF8.

Later on, format macro will be made to have more readable code.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

acezar created this revision.Jun 5 2020, 10:31 AM
marmoute requested changes to this revision.Jun 9 2020, 5:33 AM
marmoute added a subscriber: marmoute.
marmoute added inline comments.
rust/rhg/src/commands/root.rs
25

If stdout is closed, this will fails. We probably want a better error than that eventually.

35

Maybe we use a bit more explicit error, like: "Error is RootNotFound, but no path provided" or soemthing in that flavor.

51

Same feedback, there wil be legit cas were we cannot write to stdout and we should improve the errors here (and test theses case)

61

What kind of error does Mercurial issue in this case ? Could we keep the same behavior ?

This revision now requires changes to proceed.Jun 9 2020, 5:33 AM
acezar updated this revision to Diff 21647.Jun 16 2020, 12:20 PM
acezar updated this revision to Diff 21657.Jun 17 2020, 4:25 AM
acezar marked 4 inline comments as done.Jun 22 2020, 8:24 AM
Alphare accepted this revision.Jun 22 2020, 10:44 AM
Alphare added a subscriber: Alphare.

Looks good. If I could nitpick some more, the description talks about WTF8, when it's UTF8 (because we're talking about String and not OsString).

acezar edited the summary of this revision. (Show Details)Jun 24 2020, 9:04 AM
acezar updated this revision to Diff 21697.
Alphare accepted this revision.Jun 24 2020, 10:05 AM
This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.