Class PatternMatchRevFilter

  • public abstract class PatternMatchRevFilter
    extends RevFilter
    Abstract filter that searches text using extended regular expressions.
    • Constructor Detail

      • PatternMatchRevFilter

        protected PatternMatchRevFilter​(String pattern,
                                        boolean innerString,
                                        boolean rawEncoding,
                                        int flags)
        Construct a new pattern matching filter.
        pattern - text of the pattern. Callers may want to surround their pattern with ".*" on either end to allow matching in the middle of the string.
        innerString - should .* be wrapped around the pattern of ^ and $ are missing? Most users will want this set.
        rawEncoding - should forceToRaw(String) be applied to the pattern before compiling it?
        flags - flags from Pattern to control how matching performs.
    • Method Detail

      • forceToRaw

        protected static final String forceToRaw​(String patternText)
        Encode a string pattern for faster matching on byte arrays.

        Force the characters to our funny UTF-8 only convention that we use on raw buffers. This avoids needing to perform character set decodes on the individual commit buffers.

        patternText - original pattern string supplied by the user or the application.
        same pattern, but re-encoded to match our funny raw UTF-8 character sequence RawCharSequence.
      • pattern

        public String pattern()
        Get the pattern this filter uses.
        the pattern this filter is applying to candidate strings.
      • include

        public boolean include​(RevWalk walker,
                               RevCommit cmit)
                        throws MissingObjectException,
        Determine if the supplied commit should be included in results.
        Specified by:
        include in class RevFilter
        walker - the active walker this filter is being invoked from within.
        cmit - the commit currently being tested. The commit has been parsed and its body is available for inspection only if the filter returns true from RevFilter.requiresCommitBody().
        true to include this commit in the results; false to have this commit be omitted entirely from the results.
        MissingObjectException - an object the filter needs to consult to determine its answer does not exist in the Git repository the walker is operating on. Filtering this commit is impossible without the object.
        IncorrectObjectTypeException - an object the filter needed to consult was not of the expected object type. This usually indicates a corrupt repository, as an object link is referencing the wrong type.
        IOException - a loose object or pack file could not be read to obtain data necessary for the filter to make its decision.
      • requiresCommitBody

        public boolean requiresCommitBody()
        Whether the filter needs the commit body to be parsed.
        requiresCommitBody in class RevFilter
        true if the filter needs the commit body to be parsed.
      • text

        protected abstract CharSequence text​(RevCommit cmit)
        Obtain the raw text to match against.
        cmit - current commit being evaluated.
        sequence for the commit's content that we need to match on.