• Yuya Nishihara's avatar
    log: introduce struct that carries log traversal options · c1d0f83d62c4
    Yuya Nishihara authored
    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.
commands.py 252 KB