(self, directory, name, expression)
| 485 | return self.client.query("clock", root)["clock"] |
| 486 | |
| 487 | def _subscribe(self, directory, name, expression): |
| 488 | root, rel_path = self._watch_root(directory) |
| 489 | # Only receive notifications of files changing, filtering out other |
| 490 | # types like special files: |
| 491 | # https://facebook.github.io/watchman/docs/type |
| 492 | only_files_expression = [ |
| 493 | "allof", |
| 494 | ["anyof", ["type", "f"], ["type", "l"]], |
| 495 | expression, |
| 496 | ] |
| 497 | query = { |
| 498 | "expression": only_files_expression, |
| 499 | "fields": ["name"], |
| 500 | "since": self._get_clock(root), |
| 501 | "dedup_results": True, |
| 502 | } |
| 503 | if rel_path: |
| 504 | query["relative_root"] = rel_path |
| 505 | logger.debug( |
| 506 | "Issuing watchman subscription %s, for root %s. Query: %s", |
| 507 | name, |
| 508 | root, |
| 509 | query, |
| 510 | ) |
| 511 | self.client.query("subscribe", root, name, query) |
| 512 | |
| 513 | def _subscribe_dir(self, directory, filenames): |
| 514 | if not directory.exists(): |
no test coverage detected