Best way to check if a file matches an ignore pattern

Nicholas Allen nick.allen at onlinehome.de
Sun Sep 7 15:59:17 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Aaron,

Good idea ;-). It may be hard to make this portable between Windows and
Linux though. I guess the user would have to specify the path to Python
and it would have to be the same Python that Bazaar used. Also what
happens in the case where setup.exe has its own embedded python
interpreter on Windows?

Nick

Aaron Bentley wrote:
> Nicholas Allen wrote:
>> Sorry, I was not clear enough - I meant from the command line.
> 
> What makes you think you can't use bzrlib from the commandline? :-)
> 
> $python -c "import sys
> from bzrlib import workingtree, errors
> try:
>     tree, relpath = workingtree.WorkingTree.open_containing(sys.argv[1])
> except (errors.NoWorkingTree, errors.NotBranchError):
>     sys.exit(3)
> if tree.path2id(relpath):
>     sys.exit(0)
> elif tree.is_ignored(relpath):
>     sys.exit(1)
> else:
>     sys.exit(0)
> " bzrr.pyc
> 
> Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIw+xF1+i51gqqEGkRAhKGAKC5HHDtsENPls1FHf7gnOXzg4XWwACfZNSp
iafb8e/LVr73pUrdCb2+noU=
=67X3
-----END PGP SIGNATURE-----



More information about the bazaar mailing list