The plethora of Mercurial's file pattern behaviors are really confusing.
It's only through carefully trying to compose this email for over an
hour that I'm even starting to understand it, and that complexity is a
barrier to adoption.
hblancha@aurora:base.hg$ tree
.
├── dir
│ ├── dir.txt
│ └── subdir
│ └── subdir.txt
├── file.txt
└── top.txt
hblancha@aurora:base.hg$ echo dir/*
dir/dir.txt dir/subdir
I want shell globbing, as seen in that 'echo' command. Except hg doesn't
track directories, so I expect hg's shell globbing will only list dir.txt.
hblancha@aurora:base.hg$ hg files 'dir/*'
hblancha@aurora:base.hg$
Nope. Nothing at all. (Oops, it's a "fileset"! Certainly not what I
expected.)
hblancha@aurora:base.hg$ hg files --include 'dir/*'
dir/dir.txt
dir/subdir/subdir.txt
If I use "--include", now I get radically different behavior. I had no
idea that would happen, but now I get my shell globs!
Except it's still not what I expected, because subdir.txt ended up
there. (Yes, I see the fine print in 'hg help patterns' that says "For
"-I" and "-X" options, "glob:" will match directories recursively."
Again, not what I expected.)
hblancha@aurora:base.hg$ hg files 'glob:dir/*'
dir/dir.txt
Finally, here's my glob! Even though 'hg help files' said I could only
use "filenames or filesets", not patterns, it turns out I could use
patterns after all...
Now I just have to remember which of these three very similar methods
I'm supposed to use, and explain it to my comrades who didn't invest the
effort to experiment for themselves and hope they care to remember.
Now I think I've figured out how file globbing/patterns/etc works. But
wait, it gets worse:
hblancha@aurora:base.hg$ hg sparse --reset; hg sparse -I 'dir/subdir'; tree
.
└── dir
├──*dir.txt*
└── subdir
└── subdir.txt
hblancha@aurora:base.hg$ hg sparse --reset; hg sparse -I 'glob:dir/subdir';
tree
.
└── dir
└── subdir
└── subdir.txt
We can see that 'dir/subdir' is not the same as 'glob:dir/subdir', even
though the documentation claims it should be. Also, neither should
display *dir.txt* (as far as I understand, from my experimentation this
evening), so there seems to be a sparse bug here.
Also, remember how I got the glob I wanted above? Well I can't do that
with sparse, because I can /only/ use --include, and that gets me the
behavior I didn't want.
hblancha@aurora:base.hg$ hg files 'glob:dir/*'
dir/dir.txt
hblancha@aurora:base.hg$ hg sparse --reset; hg sparse --include
'rootfilesin:dir'; tree
.
└── dir
└── dir.txt
hblancha@aurora:base.hg$ hg files 'rootfilesin:dir'
dir/dir.txt
So now I have to use "rootfilesin:" prefix, which I've never heard of
and have no muscle memory for, and is more annoying to type. At least it
works in both commands, though I don't know if I'll ever want to type
that unless I have no other choice.
I guess, in summary, my complaint is that we shouldn't have to conduct
all these experiments to figure out how to use a fundamental technique
like shell globbing in Mercurial. At best that slows us down; at worst
it makes us look elsewhere, and I really don't want that. Thanks for
listening.
--
Hollis Blanchard <hollis_blanch...@mentor.com>
Mentor Graphics Emulation Division
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel