()
| 199 | |
| 200 | |
| 201 | def main(): |
| 202 | parser = argparse.ArgumentParser() |
| 203 | parser.add_argument("--commit", help="pin this exact webref commit instead of the branch tip") |
| 204 | parser.add_argument( |
| 205 | "--branch", |
| 206 | default="main", |
| 207 | help="webref branch to resolve when --commit is omitted (default: main)", |
| 208 | ) |
| 209 | args = parser.parse_args() |
| 210 | |
| 211 | commit = args.commit or resolve_commit(args.branch) |
| 212 | print(f"Pinning {REPO}@{commit}") |
| 213 | |
| 214 | before = existing_repo_names(BZL_FILE.read_text()) |
| 215 | |
| 216 | filenames = list_cddl_files(commit) |
| 217 | print(f"Found {len(filenames)} CDDL files in {CDDL_PATH}") |
| 218 | cddl_entries = build_entries(commit, filenames) |
| 219 | |
| 220 | dfns_entries = build_dfns_entries(commit) |
| 221 | print(f"Refreshed {len(dfns_entries)} dfns indexes in {DFNS_PATH}") |
| 222 | |
| 223 | bidi_commit, bidi_sha256 = resolve_bidi_spec(BIDI_SPEC_BRANCH) |
| 224 | print(f"Pinning {BIDI_SPEC_REPO}@{bidi_commit} ({BIDI_SPEC_FILE})") |
| 225 | |
| 226 | update_pin(commit, cddl_entries, dfns_entries, bidi_commit, bidi_sha256) |
| 227 | |
| 228 | cddl_names = {name for name, _, _ in cddl_entries} |
| 229 | repo_names = cddl_names | {name for name, _, _ in dfns_entries} | {BIDI_SPEC_REPO_NAME} |
| 230 | update_module(repo_names) |
| 231 | |
| 232 | for name in sorted(cddl_names - before): |
| 233 | print(f" added: {name}") |
| 234 | for name in sorted(before - cddl_names): |
| 235 | print(f" removed: {name}") |
| 236 | print(f"Updated {BZL_FILE.relative_to(root_dir)} and {MODULE_FILE.relative_to(root_dir)}") |
| 237 | |
| 238 | |
| 239 | if __name__ == "__main__": |
no test coverage detected