HomePhabricator

revset: add diff(pattern) predicate for "grep --diff"

Authored by yuja.

Description

revset: add diff(pattern) predicate for "grep --diff"

I find this is useful in GUI log viewer since the tool only needs to support
"log -rREV" command.

This is basic implementation. Windowed search is not implemented since it
wouldn't work pretty well with the smartset API. And filename matcher is
not supported because the syntax isn't determined. My idea is to add handling
of diff(pattern, file(..)) and diff(pattern, follow(..)), which will then be
evolved to a full revset+matcher combinator support:

x & diff(pattern, y & z)
                  =====
                  y & z builds (revs(y) & revs(z), matcher(y) & matcher(z))
                  pair, and narrows the search space of diff()
    ====================
    diff() returns matched (revs, matcher) pair
========================
revs and matcher will be combined respectively by &-operator, and the matcher
will optionally be used to filter "hg log -p" output

The predicate name "diff()" wouldn't be great, but grep() is already used.
Another options I can think of are "grepdiff()" and "containsdiff()".
Naming suggestions are welcome.

Details

Committed
yujaSep 8 2020, 5:16 AM
Parents
rHGac39a8a214b1: stringutil: add function to compile stringmatcher pattern into regexp
Branches
Unknown
Tags
Unknown