( )⚙ D11613 rhg: refactor function to relativize paths in utils

This is an archive of the discontinued Mercurial Phabricator instance.

rhg: refactor function to relativize paths in utils
ClosedPublic

Authored by pulkit on Oct 5 2021, 8:45 AM.

Details

Summary

Commands like files, status supports printing relative paths. Hence we need
to re-use this code in other places too. So let's take this out from rhg files
into a utility function.

Next patch will make rhg status use it.

Diff Detail

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

Event Timeline

pulkit created this revision.Oct 5 2021, 8:45 AM
martinvonz accepted this revision.Oct 11 2021, 1:48 PM
martinvonz added a subscriber: martinvonz.
martinvonz added inline comments.
rust/rhg/src/utils/path_utils.rs
18

I generally find iterators easier to work with than callbacks. That makes error handling easier and it makes it easy to stop iteration at any point. I'll take this as is, but consider following up with a rewrite.

This revision is now accepted and ready to land.Oct 11 2021, 1:48 PM
This revision was automatically updated to reflect the committed changes.