Proposed Patch to hgignore
Jakob Krainz
jakob at hawo.stw.uni-erlangen.de
Thu Mar 6 15:01:09 CST 2008
On Thu 2008-03-06 14:00:19 -0600, Matt Mackall wrote:
>
> As discussed in the distant past, this feature is very difficult to
> implement in a way that is simultaneously correct and easy to
> understand, nevermind fast. Even though it looks simple on paper.
>
> Ever wonder why regexes themselves don't have a negation operator?
> It's the sort of deep result that computer science professors tend to
> skim over but could easily fill a book or two.
>
> --
> Mathematics is the supreme nostalgia of our time.
>
Maybe, but my patch uses only facilities that are already present
in mercurial (look at the -I and -X options).
in other words, my solution doesnt create a regex that matches
anything _but_ a pattern, it creates a regex that _matches_ said pattern
and feeds it to another parameter of the constructor of the matcher object.
have a look at the patch, it happens in mercurial/ignore.py
the matcher object is defined in mercurial/util.py
it accepts two lists of patterns, and matches (which leads to an ignore)
if any pattern in the first list matches and _no_ pattern in the second list.
the second list of patterns does indeed consist of ordinary regular
expressions, the negation is done on logic level after the matching.
a valid comparison would be the hosts.allow / hosts.deny mechanism
of wietse venemas tcp_wrapper.
(cf. http://itso.iu.edu/TCP_Wrappers )
--
jakob krainz
More information about the Mercurial-devel
mailing list