Are there any easy TODO's (such as easy-fix or junior jobs)?
Aaron Bentley
aaron.bentley at utoronto.ca
Tue Apr 19 16:14:06 BST 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Also, you might want to scarf up my BaZing ignore code. It uses shell
globs, handles tree-wide and specific files, and matches on individual
filenames.
e.g.
*.c is a tree-wide glob.
./foo/bar will only match the foo/bar.
./foo/*/bar will match foo/baz/bar and foo/quirm/bar, but not
foo/baz/quirm/bar
The code can be found in libbazing/tree.py in
aaron.bentley at utoronto.ca--baz/bazing--devel--0--patch-137
Aaron
P.S. It's this stuff. I guess it needs separator-independence.
def matches_glob(path, globs):
~ basename = None
~ for glob in globs:
~ if glob.startswith("./"):
~ if matches_subglobs(path, glob):
~ return True
~ else:
~ if basename is None:
~ basename = os.path.basename(path)
~ if fnmatch.fnmatch(basename, glob):
~ return True
~ return False
def matches_subglobs(path, glob):
~ subglobs = glob.split('/')
~ pathsegments = path.split('/')
~ if len(subglobs) != len(pathsegments):
~ return False
~ for i in range(len(subglobs)):
~ if not fnmatch.fnmatch(pathsegments[i], subglobs[i]):
~ return False
~ return True
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFCZSA+0F+nu1YWqI0RAnAMAJ9PxfGoHdltVxjfSRg6LzIt30GkXwCfZOOh
AFkVUSCc3KeuNXoL/x/RpOw=
=6jOy
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list