Page MenuHomePhabricator

hg-core: add `Revlog.get_node_rev`
ClosedPublic

Authored by acezar on Sep 11 2020, 3:53 AM.

Details

Summary

Find the revision of a node given its full hash.

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.Sep 11 2020, 3:53 AM
Alphare requested changes to this revision.
Alphare added inline comments.
rust/hg-core/src/revlog/revlog.rs
82

I know Clippy will complain about the lack of is_empty method when you have a len method, if you want to add it quickly.

91

Wouldn't it make more sense to start from the end as we're more likely to be looking for recent nodes?

Also, it's not clear by looking at this that this bruteforce method is not the one we'll use in the future, using @gracinet's nodemap. I think a small comment would be enough.

This revision now requires changes to proceed.Sep 17 2020, 6:11 AM
acezar added inline comments.Sep 18 2020, 8:46 AM
rust/hg-core/src/revlog/revlog.rs
82

I've seen the clippy warning, but did not added it because it wasn't needed and since it's not enforced by an interface, I was not sure about what to do about it. Maybe having 0 warning on easy things should be a goal.

91

Like you said we're more likely to be looking for recent nodes thus searching from the start when the revolg is huge is probably not the way to go.

acezar updated this revision to Diff 22723.Sep 18 2020, 10:49 AM
acezar marked 2 inline comments as done.Sep 18 2020, 10:52 AM
acezar added inline comments.
rust/hg-core/src/revlog/revlog.rs
82

It has been added in another commit. I moved the code here

This revision was not accepted when it landed; it landed in state Needs Review.
This revision was automatically updated to reflect the committed changes.