Run a one-off graph build for a repo that has no database yet.
(self, repo: WatchRepo)
| 978 | proc.wait(timeout=5) |
| 979 | |
| 980 | def _initial_build(self, repo: WatchRepo) -> None: |
| 981 | """Run a one-off graph build for a repo that has no database yet.""" |
| 982 | logger.info("Building initial graph for %s...", repo.alias) |
| 983 | |
| 984 | crg_bin = shutil.which("code-review-graph") |
| 985 | if crg_bin: |
| 986 | cmd: list[str] = [crg_bin, "build", "--repo", repo.path] |
| 987 | else: |
| 988 | cmd = [ |
| 989 | sys.executable, |
| 990 | "-m", |
| 991 | "code_review_graph", |
| 992 | "build", |
| 993 | "--repo", |
| 994 | repo.path, |
| 995 | ] |
| 996 | |
| 997 | result = subprocess.run( |
| 998 | cmd, |
| 999 | capture_output=True, |
| 1000 | text=True, |
| 1001 | check=False, |
| 1002 | ) |
| 1003 | if result.returncode != 0: |
| 1004 | logger.warning( |
| 1005 | "Initial build for '%s' failed (rc=%d): %s", |
| 1006 | repo.alias, |
| 1007 | result.returncode, |
| 1008 | result.stderr.strip(), |
| 1009 | ) |