Exclude files/directories for version control systems
use File::Find::Rule (); use File::Find::Rule::VCS (); # Find all files smaller than 10k, ignoring version control files my @files = File::Find::Rule->ignore_vcs ->file ->size('<10Ki') ->in( $dir );
Many tools need to be equally useful both on ordinary files, and on code that has been checked out from revision control systems.
File::Find::Rule::VCS provides quick and convenient methods to exclude the version control directories of several major Version Control Systems (currently \s-1CVS\s0, subversion, and Bazaar).
File::Find::Rule::VCS implements methods to ignore the following:
In addition, the following version control systems do not create directories in the checkout and do not require the use of any ignore methods
# Ignore all common version control systems $find->ignore_vcs;
# Ignore a specific named version control systems $find->ignore_vcs($name);
# Ignore nothing (silent pass-through) $find->ignore_vcs('');
The \*(C`ignore_vcs\*(C' method excludes the files for a named Version Control System from your File::Find::Rule search.
If passed, the name of the version control system is case in-sensitive. Names currently supported are 'cvs', 'svn', 'subversion', 'bzr', and 'bazaar'.
As a convenience for high-level APIs, if the \s-1VCS\s0 name is the defined null string '' then the call will be treated as a nullop.
If no params at all are passed, this method will ignore all supported version control systems. If ignoring every version control system, please note that any legitimate directories called \*(L"\s-1CVS\s0\*(R" or files starting with .# will be ignored, which is not always desirable.
In widely-distributed code, you instead should try to detect the specific version control system used and call ignore_vcs with the specific name.
Passing \*(C`undef\*(C', or an unsupported name, will throw an exception.
The \*(C`ignore_cvs\*(C' method excluding all \s-1CVS\s0 directories from your File::Find::Rule search.
It will also exclude all the files left around by \s-1CVS\s0 after an automated merge that start with '.#' (dot-hash).
The \*(C`ignore_rcs\*(C' method excluding all \s-1RCS\s0 directories from your File::Find::Rule search.
It will also exclude all the files used by \s-1RCS\s0 to store the revisions (end with ',v').
The \*(C`ignore_svn\*(C' method excluding all Subversion (\*(C`.svn\*(C') directories from your File::Find::Rule search.
The \*(C`ignore_bzr\*(C' method excluding all Bazaar (\*(C`.bzr\*(C') directories from your File::Find::Rule search.
The \*(C`ignore_git\*(C' method excluding all Git (\*(C`.git\*(C') directories from your File::Find::Rule search.
The \*(C`ignore_hg\*(C' method excluding all Mercurial/Hg (\*(C`.hg\*(C') directories from your File::Find::Rule search.
- Add support for other version control systems.
- Add other useful VCS-related methods
Bugs should always be submitted via the \s-1CPAN\s0 bug tracker
<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=File-Find-Rule-VCS>
For other issues, contact the maintainer
Adam Kennedy <[email protected]>
<http://ali.as/>, File::Find::Rule
Copyright 2005 - 2010 Adam Kennedy.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the \s-1LICENSE\s0 file included with this module.