Plugin roots touched relative to base (staged set, or base...HEAD).
(base: str, staged_only: bool)
| 127 | |
| 128 | |
| 129 | def changed_plugins(base: str, staged_only: bool) -> list[Path]: |
| 130 | """Plugin roots touched relative to base (staged set, or base...HEAD).""" |
| 131 | if staged_only: |
| 132 | files = git_ok("diff", "--cached", "--name-only") or "" |
| 133 | else: |
| 134 | files = git_ok("diff", "--name-only", f"{base}...HEAD") or "" |
| 135 | changed = {Path(line) for line in files.splitlines() if line} |
| 136 | |
| 137 | hits: list[Path] = [] |
| 138 | for pj in all_plugin_jsons(): |
| 139 | root_rel = Path(rel(plugin_root(pj))) |
| 140 | if any( |
| 141 | c == root_rel or root_rel in c.parents or str(c).startswith(f"{root_rel}/") |
| 142 | for c in changed |
| 143 | ): |
| 144 | hits.append(pj) |
| 145 | return hits |
| 146 | |
| 147 | |
| 148 | def cmd_apply(base: str) -> int: |
no test coverage detected