[RFC] Improvements to is_ignored.
Martin Pool
mbp at sourcefrog.net
Wed Feb 1 09:20:45 GMT 2006
On 1 Feb 2006, James Blackwell <jblack at merconline.com> wrote:
> On Fri, Jan 20, 2006 at 04:21:17PM +0100, Jan Hudec wrote:
> > * New glob->regex convertor that more closely follows shell semantics.
> > It has * and ? not matching .-files, **/ matching any number of path
> > components (zsh-style - whole components only!) and ***/ that also
> > matches .-dirs, named character groups ([[:alnum:]], [[:digit:]],
> > [[:space::]] are unicode-aware) and RE:regexp.
>
> I tried ls "**" and "ls ***" on my system here and couldn't tell any
> difference from "ls *". I also don't seem to know how to work "RE:". I use
> bash, which isn't an uncommon shell.
The precedent is zsh and rsync. (There may be others.)
In bash you can I think write it as *(*/), with setopt extglob.
> I don't think thats necessarily a bad idea -- in fact, somebody already
> mentioned the tutorial, though I would like for us to consider the unlikely
> possibility that somebody would gloss over documentation.
>
> However, later in your post you mention possibly having to do this
> expansion within Bazaar-NG itself for windows. If that's the case for
> cmd.exe, then isn't it the case as well for bash?
Well, practically, because strings containing * will already be expanded
by bash according to its own rules -- and this is almost certainly what
bash users expect. If they want to search directories they are more
likely to write e.g.
bzr diff `find . -name \*.c`
rather than the zsh-ish
bzr diff **/*.c
Note that by setting options in many shells users can customize how even
the most trivial globs operate.
I suppose we could allow bash users to say
bzr diff --glob '**/*.c'
> If your meaning is include support for patterns that come from ZSH and are
> rarely supported elsewhere, then that's more of a problem. I think its
> so-so to allow something that most platforms support (e.g. symlinks) and not
> a good idea ("/" as a filename character) when most platforms don't.
There is no standardized extended glob syntax. We can either pick one
that suits us, or not let users express those patterns at all. A
consequence is that you may have ignore patterns which are in a
different syntax to whatever shell you have to use (but only if you do
tricky things.)
This is also true if we used regexps: there are many dialects.
> I'm particularly interested in this hypothetical question: If Martin used
> zsh (he may), adds a "RE:..." pattern to the bzr tree, will I be still be
> able to work safely without changing shells?
What shell you use has no effect on how bzr behaves. Some zsh or rsync
users may be familiar with ** as matching across directories; others can
just learn it as a new bzr feature. It is probably not something most
people will need to use.
--
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060201/cf3ebc38/attachment.pgp
More information about the bazaar
mailing list