On Sat, Jan 28, 2012 at 9:54 AM, Daniel Shahaf <d...@daniel.shahaf.name> wrote: > On Fri, Jan 27, 2012, at 21:30, Johan Corveleyn wrote: >> On Fri, Jan 27, 2012 at 4:44 PM, Bert Huijben <b...@qqmail.nl> wrote: >> >> -----Original Message----- >> >> From: Johan Corveleyn [mailto:jcor...@gmail.com] >> >> Sent: vrijdag 27 januari 2012 16:31 >> >> To: Subversion Development >> >> Subject: regexp matching in svn? >> >> >> >> Hi, >> >> >> >> Is there any existing regexp matching functionality somewhere in de >> >> svn codebase, in a way that is reusable for new functionality? If not, >> >> does anyone know of a reusable third-party library that could be >> >> easily intregrated (I know, it would be Yet Another Dependency, but >> >> I'm just asking for options ...)? >> >> >> >> Use-case: I like the '-x-p' (show C-function) option for 'svn diff', >> >> but this is limited to C-like syntax. GNU diff also has a '-F RE' >> >> option, where RE is a regular expression that is used for matching the >> >> "function-line". I know I could make use of this functionality by >> >> invoking GNU diff as external diff command, but for several reasons it >> >> would be interesting if svn could do this internally (for one thing: >> >> GNU diff isn't always available / installed). >> >> >> >> And I'm sure there would be other useful things people could do with >> >> regexp functionality ... >> > >> > Apr (or Apr-Util) has regex support, not sure which but we require both. >> >> Thanks, but I can't find it. I found apr_strmatch in apr-util, but >> that doesn't do regex, it just matches a fixed string (which would >> also be useful (it actually covers my concrete use-case), but it's not >> -F). Maybe I'm overlooking something. >> >> If it's not in apr(-util) or some other dependency we already have, >> how about PCRE (www.pcre.org) ? > > I must have missed the point where you explained why decreeing "GNU diff > must be installed" company policy is not an option.
Yes, it's an option. But it's a hassle. I'm investigating other options. Other than that, there is something about GNU diff's -F option that I don't like: it doesn't trim leading whitespace from the matched "function line", unlike the -p option. If we implement this ourselves, we can decide to do this (depending on community consensus of course). We don't have to do exactly the same as GNU diff's -p / -F (just like we also show 50 characters of -p, unlike GNU diff which shows 40 characters). -- Johan