pub fn list_files(&self, pkg: &Package) -> CargoResult<Vec<PathBuf>> {
        let root = pkg.root();

        let parse = |p: &String| {
            Pattern::new(p).map_err(|e| {
                human(format!("could not parse pattern `{}`: {}", p, e))
            })
        };
        let exclude = try!(pkg.manifest().exclude().iter()
                              .map(|p| parse(p)).collect::<Result<Vec<_>, _>>());
        let include = try!(pkg.manifest().include().iter()
                              .map(|p| parse(p)).collect::<Result<Vec<_>, _>>());

        let mut filter = |p: &Path| {
            let relative_path = util::without_prefix(p, &root).unwrap();
            include.iter().any(|p| p.matches_path(&relative_path)) || {
                include.is_empty() &&
                 !exclude.iter().any(|p| p.matches_path(&relative_path))
            }
        };

        // If this package is a git repository, then we really do want to query
        // the git repository as it takes into account items such as .gitignore.
        // We're not quite sure where the git repository is, however, so we do a
        // bit of a probe.
        //
        // We check all packages in this source that are ancestors of the
        // specified package (including the same package) to see if they're at
        // the root of the git repository. This isn't always true, but it'll get
        // us there most of the time!
        let repo = self.packages.iter()
                       .map(|pkg| pkg.root())
                       .filter(|path| root.starts_with(path))
                       .filter_map(|path| git2::Repository::open(&path).ok())
                       .next();
        match repo {
            Some(repo) => self.list_files_git(pkg, repo, &mut filter),
            None => self.list_files_walk(pkg, &mut filter),
        }
    }
/// List all files relevant to building this package inside this source.
///
/// This function will use the appropriate methods to determine the
/// set of files underneath this source's directory which are relevant for
/// building `pkg`.
///
/// The basic assumption of this method is that all files in the directory
/// are relevant for building this package, but it also contains logic to
/// use other methods like .gitignore to filter the list of files.
List all files relevant to building this package inside this source.
This function will use the appropriate methods to determine the
set of files underneath this source's directory which are relevant for
building `pkg`.

The basic assumption of this method is that all files in the directory
are relevant for building this package, but it also contains logic to
use other methods like .gitignore to filter the list of files.
List all files relevant to building this package inside this source . This function will use the appropriate methods to determine the set of files underneath this source ' s directory which are relevant for building ` pkg ` . The basic assumption of this method is that all files in the directory are relevant for building this package but it also contains logic to use other methods like . gitignore to filter the list of files .
pub fn list_files(&self, pkg: &Package) -> CargoResult<Vec<PathBuf>> {
        let root = pkg.root();
        let parse = |p: &String| {
            Pattern::new(p).map_err(|e| {
                human(format!("could not parse pattern `{}`: {}", p, e))
            })
        };
        let exclude = try!(pkg.manifest().exclude().iter()
                              .map(|p| parse(p)).collect::<Result<Vec<_>, _>>());
        let include = try!(pkg.manifest().include().iter()
                              .map(|p| parse(p)).collect::<Result<Vec<_>, _>>());
        let mut filter = |p: &Path| {
            let relative_path = util::without_prefix(p, &root).unwrap();
            include.iter().any(|p| p.matches_path(&relative_path)) || {
                include.is_empty() &&
                 !exclude.iter().any(|p| p.matches_path(&relative_path))
            }
        };
        // If this package is a git repository, then we really do want to query
        // the git repository as it takes into account items such as .gitignore.
        // We're not quite sure where the git repository is, however, so we do a
        // bit of a probe.
        //
        // We check all packages in this source that are ancestors of the
        // specified package (including the same package) to see if they're at
        // the root of the git repository. This isn't always true, but it'll get
        // us there most of the time!
        let repo = self.packages.iter()
                       .map(|pkg| pkg.root())
                       .filter(|path| root.starts_with(path))
                       .filter_map(|path| git2::Repository::open(&path).ok())
                       .next();
        match repo {
            Some(repo) => self.list_files_git(pkg, repo, &mut filter),
            None => self.list_files_walk(pkg, &mut filter),
        }
    }
pub fn list_files ( & self , pkg : & Package ) -> CargoResult < Vec < PathBuf > > { let root = pkg . root ( ) ; let parse = | p : & String | { Pattern :: new ( p ) . map_err ( | e | { human ( format ! ( " " p e ) ) } ) } ; let exclude = try ! ( pkg manifest ( ) exclude ( ) iter ( ) map ( p parse ( p ) ) collect Result Vec ( ) ) ; let include = try ! ( pkg manifest ( ) include ( ) iter ( ) map ( p parse ( p ) ) collect Result Vec ( ) ) ; let mut filter = | p : & Path | { let relative_path = util :: without_prefix ( p , & root ) . unwrap ( ) ; include . iter ( ) . any ( | p | p . matches_path ( & relative_path ) ) || { include . is_empty ( ) && ! exclude . iter ( ) . any ( | p | p . matches_path ( & relative_path ) ) } } ; // If this package is a git repository, then we really do want to query // the git repository as it takes into account items such as .gitignore. // We're not quite sure where the git repository is, however, so we do a // bit of a probe. // // We check all packages in this source that are ancestors of the // specified package (including the same package) to see if they're at // the root of the git repository. This isn't always true, but it'll get // us there most of the time! let repo = self . packages . iter ( ) . map ( | pkg | pkg . root ( ) ) . filter ( | path | root . starts_with ( path ) ) . filter_map ( | path | git2 :: Repository :: open ( & path ) . ok ( ) ) . next ( ) ; match repo { Some ( repo ) => self . list_files_git ( pkg , repo , & mut filter ) , None => self . list_files_walk ( pkg , & mut filter ) , } }
List all files relevant to building this package inside this source.
List all files relevant to building this package inside this source .
&self
pkg
&Package
&self
pkg
&Package