Abstract filter that searches text using only substring search.
Inheritance: RevFilter
コード例 #1
0
        ///	<summary>
        /// Create a new author filter.
        ///	<para />
        ///	An optimized substring search may be automatically selected if the
        ///	pattern does not contain any regular expression meta-characters.
        ///	<para />
        ///	The search is performed using a case-insensitive comparison. The
        ///	character encoding of the commit message itself is not respected. The
        ///	filter matches on raw UTF-8 byte sequences.
        ///	</summary>
        ///	<param name="pattern">Regular expression pattern to match.</param>
        ///	<returns>
        /// A new filter that matches the given expression against the author
        /// name and address of a commit.
        /// </returns>
        public static RevFilter create(string pattern)
        {
            if (string.IsNullOrEmpty(pattern))
            {
                throw new ArgumentNullException("pattern", "Cannot match on empty string.");
            }

            if (SubStringRevFilter.safe(pattern))
            {
                return(new SubStringSearch(pattern));
            }

            return(new PatternSearch(pattern));
        }
コード例 #2
0
        /// <summary>
        /// Create a message filter.
        ///	<para />
        ///	An optimized substring search may be automatically selected if the
        ///	pattern does not contain any regular expression meta-characters.
        ///	<para />
        ///	The search is performed using a case-insensitive comparison. The
        ///	character encoding of the commit message itself is not respected. The
        ///	filter matches on raw UTF-8 byte sequences.
        ///	</summary>
        ///	<param name="pattern">Regular expression pattern to match.</param>
        ///	<returns>
        /// A new filter that matches the given expression against the
        /// message body of the commit.
        /// </returns>
        public static RevFilter create(string pattern)
        {
            if (pattern.Length == 0)
            {
                throw new ArgumentException("Cannot match on empty string.");
            }

            if (SubStringRevFilter.safe(pattern))
            {
                return(new SubStringSearch(pattern));
            }

            return(new PatternSearch(pattern));
        }