This is an archive of the discontinued Mercurial Phabricator instance.

rhg: add a `Files` `Command` to prepare the `rhg files` subcommand
ClosedPublic

Authored by acezar on Aug 3 2020, 10:26 AM.

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.Aug 3 2020, 10:26 AM
Alphare accepted this revision.Aug 3 2020, 11:17 AM
acezar updated this revision to Diff 22251.Aug 4 2020, 4:58 AM
indygreg accepted this revision.Aug 8 2020, 4:09 PM
indygreg added a subscriber: indygreg.
indygreg added inline comments.
rust/rhg/src/commands/files.rs
47

I imagine this pattern could become quite common. We may want to introduce some type of _writer_ type that has impl Drop so we can do something like the following:

{
    let mut stdout = self.ui.stdout_writer();
    stdout.write(b"...")?;
}
This revision is now accepted and ready to land.Aug 8 2020, 4:09 PM
Alphare added inline comments.Aug 12 2020, 5:58 AM
rust/rhg/src/commands/files.rs
47

I can see that being useful, we'll see if that comes up a lot. The question of doing line-buffering as a config option is still up for debate, maybe that'll complicate the pattern you're proposing somewhat.