HomePhabricator

log: introduce struct that carries log traversal options

Authored by yuja.

Description

log: introduce struct that carries log traversal options

I tried to refactor logcmdutil.getrevs() without using an options struct,
but none of these attempts didn't work out. Since every stage of getrevs()
needs various log command options (e.g. both matcher and revset query need
file patterns), it isn't possible to cleanly split getrevs() into a command
layer and a core logic.

So, this patch introduces a named struct to carry command options in slightly
abstracted way, which will be later used by "hg grep" and "hg churn". More
fields will be added to the walkopt struct.

Type hints aren't verified. I couldn't figure out how to teach pytype to
load its own attr type stubs in place of our .thirdparty.attr. Conditional
import didn't work. s/^from \.thirdparty // is the only way I found pytype
could parse the @attr.ib decorator.

Details

Committed
yujaSep 12 2020, 8:06 AM
Parents
rHGa717de1cb624: log: remove unused argument from _makerevset()
Branches
Unknown
Tags
Unknown