[engine] Implement symlink handling

Review Request #3691 - Created April 13, 2016 and submitted

Stu Hood
3121, 3190
gmalmquist, kwlzn, nhoward_tw, patricklaw, peiyu

In order to properly invalidate for watchman events, we need to record that we walked symlinks in the product graph. This review adds symlink handling to engine.exp.fs, and improves the type safety of filesystem operations by requiring that a PathGlobs object matches exactly one of Files, Dirs or Links.

  • Replace fs.Path with fs.Stat subclasses: fs.{File,Dir,Link}
  • Add explicit support to PathGlobs for matching directories. A PathGlobs object matches either Files or Dirs, but not both.
  • Resolve symlinks by recursively requesting Files/Dirs for a Path projected from a ReadLink
  • Replace RecursiveSubDirectories with use of a PathGlobs object recursively matching Dirs.
  • Add ProjectTree.{lstat, readlink, listdir}
  • Split test_fs.py from test_path_globs.py, and prepare to test ScmProjectTree (see #3189)
  • Include tests in test_fs.py to validate the actual filesystem events that occurred.


Stu Hood
Timur Abishev
Stu Hood
Stu Hood
Stu Hood
Review request changed

Status: Closed (submitted)

Change Summary:

Merged as f83e2b0272e2ff1c464e453c1f74d9335e18fcc3