bmsdna-devtools 0.57.1__tar.gz → 0.57.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/PKG-INFO +11 -6
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/README.md +10 -5
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/cli.py +8 -3
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/find_repo.py +90 -51
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/pyproject.toml +1 -1
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/skills/bmsdna-devtools/SKILL.md +4 -3
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_find_repo.py +129 -54
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/uv.lock +1 -1
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/.github/workflows/auto-release.yml +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/.github/workflows/python-publish.yml +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/.github/workflows/python-test.yml +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/.gitignore +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/.python-version +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/__init__.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/_api_dump.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/ado_auth.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/ado_issue.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/agent_mentions.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/api_usage.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/app_service_logs.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/azure_arm.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/azure_auth.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/bdt_config.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/business_user.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/ci_plan.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/ci_plan_env.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/cli_tools.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/commit.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/dead_code.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/deps/__init__.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/deps/advisories.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/deps/cli.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/deps/cooldown.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/deps/lockfiles.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/deps/osv.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/deps/versions.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/env_config.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/env_files.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/find_injection.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/gh_args.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/gh_issue.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/gh_pr.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/github_api.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/gitrepo.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/injection_frontend.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/injection_python.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/issue_do.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/issue_show.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/issue_watch.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/lint.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/lint_findings.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/lint_models.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/lint_sql.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/lint_sql_files.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/lint_tooling.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/lint_typescript.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/logs.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_build.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_cancel.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_choice.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_create_args.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_drift.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_info.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_issue_link.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_labels.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_markdown.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_merge_defaults.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pr_ref.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/pull.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/testdb.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/translate.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/__init__.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/cli.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/pipeline.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/pricing.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/report.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/sql/00_schema.sql +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/sql/01_ingest_claude.sql +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/sql/01_ingest_codex.sql +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/sql/02_messages.sql +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/sql/03_markers.sql +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/sql/04_facts.sql +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/usage/sql/05_views.sql +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/bmsdna/devtools/worktree.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/justfile +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/conftest.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/fake_github.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_ado_auth.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_ado_issue.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_ado_issue_flow.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_agent_mentions.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_api_usage.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_app_service_logs.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_azure_arm.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_bdt_config.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_business_user.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_ci_plan.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_ci_plan_env.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_cli_cleanup.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_cli_commit.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_cli_deps.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_cli_issue.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_cli_pr_create.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_cli_pr_id.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_cli_pull.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_cli_tools.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_cli_version.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_commit.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_deps_advisories.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_deps_cooldown.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_deps_lockfiles.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_deps_osv.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_deps_versions.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_env_config.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_env_files.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_find_injection.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_gh_issue.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_gh_pr.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_github_api.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_gitrepo.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_issue_do.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_issue_for_me.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_issue_show.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_issue_watch.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_lint.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_lint_models.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_lint_sql.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_lint_sql_files.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_lint_tooling.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_lint_typescript.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_logs.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_pr_build.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_pr_build_create_options.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_pr_build_flow.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_pr_cancel_build.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_pr_choice.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_pr_create_args.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_pr_description_not_truncated.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_pr_drift.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_pr_info.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_pr_issue_link.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_pr_labels.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_pr_markdown.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_pr_merge_defaults.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_pull.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_testdb.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_translate.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_usage.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_wait_timeout.py +0 -0
- {bmsdna_devtools-0.57.1 → bmsdna_devtools-0.57.2}/tests/test_worktree_clean.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: bmsdna-devtools
|
|
3
|
-
Version: 0.57.
|
|
3
|
+
Version: 0.57.2
|
|
4
4
|
Summary: Shared Azure DevOps / GitHub / git / Azure Monitor developer tooling for BMS projects
|
|
5
5
|
Requires-Python: >=3.14
|
|
6
6
|
Requires-Dist: azure-identity>=1.19.0
|
|
@@ -709,7 +709,7 @@ those orgs are searched.
|
|
|
709
709
|
## `bdt list-repo`
|
|
710
710
|
|
|
711
711
|
```bash
|
|
712
|
-
bdt list-repo [--root ~/projects] [--org MYORG] [--github-org MYORG] [--local] [--no-local] [--fast] [--json] [--pat PAT]
|
|
712
|
+
bdt list-repo [--root ~/projects] [--org MYORG] [--github-org MYORG] [--local] [--no-local] [--include-disabled] [--fast] [--json] [--pat PAT]
|
|
713
713
|
```
|
|
714
714
|
|
|
715
715
|
The browse counterpart to `bdt find-repo`: lists **every** repo of the Azure DevOps org and/or GitHub org
|
|
@@ -726,11 +726,16 @@ configured, or with `--local`, it lists the clones under the work dir instead (t
|
|
|
726
726
|
- **Description:** GitHub has a repo description and it is used. Azure DevOps repos and local clones have none, so the
|
|
727
727
|
first sentence of the README stands in (empty if there is no README, or only badges, headings and template text).
|
|
728
728
|
- **Commit:** the newest commit of the default branch (GitHub / Azure DevOps).
|
|
729
|
-
- **
|
|
730
|
-
(
|
|
731
|
-
|
|
729
|
+
- **Disabled repos:** Azure DevOps (and GitHub) repos that are disabled are left out. `--include-disabled` lists them too,
|
|
730
|
+
marked `(DISABLED)` in the description column of the text output and `"disabled": true` in `--json`. A disabled Azure DevOps
|
|
731
|
+
repo has no commit or description (they aren't readable, so they aren't requested). Azure DevOps has no disabled *projects*,
|
|
732
|
+
only disabled repos.
|
|
733
|
+
- **Cost:** GitHub returns descriptions and newest commits in one GraphQL query per 100 repos (about 5 s for 43 repos).
|
|
734
|
+
Azure DevOps needs a commit request per repo, plus README requests for repos that have commits, 16 at a time
|
|
735
|
+
(about 9 s for ~300 repos). `--fast` skips those for Azure DevOps, leaving commit and description empty.
|
|
736
|
+
Repos without commits, or whose commits can't be read, have empty fields.
|
|
732
737
|
- **`--json`:** prints an array of objects for scripts instead of the aligned text, with full (untruncated) values:
|
|
733
|
-
`project`, `name`, `source` (`ado`/`github`), `git_url` (to clone), `web_url` (to open in the browser),
|
|
738
|
+
`project`, `name`, `source` (`ado`/`github`), `disabled`, `git_url` (to clone), `web_url` (to open in the browser),
|
|
734
739
|
`location`, `last_commit_id`, `last_commit_date` (ISO 8601), `last_commit_author`, `description`.
|
|
735
740
|
Both URLs are always there; local clones have `name` instead of `project`/`source`, and their `git_url` is the clone's
|
|
736
741
|
`origin` (`web_url` is "" for a host other than GitHub / Azure DevOps).
|
|
@@ -690,7 +690,7 @@ those orgs are searched.
|
|
|
690
690
|
## `bdt list-repo`
|
|
691
691
|
|
|
692
692
|
```bash
|
|
693
|
-
bdt list-repo [--root ~/projects] [--org MYORG] [--github-org MYORG] [--local] [--no-local] [--fast] [--json] [--pat PAT]
|
|
693
|
+
bdt list-repo [--root ~/projects] [--org MYORG] [--github-org MYORG] [--local] [--no-local] [--include-disabled] [--fast] [--json] [--pat PAT]
|
|
694
694
|
```
|
|
695
695
|
|
|
696
696
|
The browse counterpart to `bdt find-repo`: lists **every** repo of the Azure DevOps org and/or GitHub org
|
|
@@ -707,11 +707,16 @@ configured, or with `--local`, it lists the clones under the work dir instead (t
|
|
|
707
707
|
- **Description:** GitHub has a repo description and it is used. Azure DevOps repos and local clones have none, so the
|
|
708
708
|
first sentence of the README stands in (empty if there is no README, or only badges, headings and template text).
|
|
709
709
|
- **Commit:** the newest commit of the default branch (GitHub / Azure DevOps).
|
|
710
|
-
- **
|
|
711
|
-
(
|
|
712
|
-
|
|
710
|
+
- **Disabled repos:** Azure DevOps (and GitHub) repos that are disabled are left out. `--include-disabled` lists them too,
|
|
711
|
+
marked `(DISABLED)` in the description column of the text output and `"disabled": true` in `--json`. A disabled Azure DevOps
|
|
712
|
+
repo has no commit or description (they aren't readable, so they aren't requested). Azure DevOps has no disabled *projects*,
|
|
713
|
+
only disabled repos.
|
|
714
|
+
- **Cost:** GitHub returns descriptions and newest commits in one GraphQL query per 100 repos (about 5 s for 43 repos).
|
|
715
|
+
Azure DevOps needs a commit request per repo, plus README requests for repos that have commits, 16 at a time
|
|
716
|
+
(about 9 s for ~300 repos). `--fast` skips those for Azure DevOps, leaving commit and description empty.
|
|
717
|
+
Repos without commits, or whose commits can't be read, have empty fields.
|
|
713
718
|
- **`--json`:** prints an array of objects for scripts instead of the aligned text, with full (untruncated) values:
|
|
714
|
-
`project`, `name`, `source` (`ado`/`github`), `git_url` (to clone), `web_url` (to open in the browser),
|
|
719
|
+
`project`, `name`, `source` (`ado`/`github`), `disabled`, `git_url` (to clone), `web_url` (to open in the browser),
|
|
715
720
|
`location`, `last_commit_id`, `last_commit_date` (ISO 8601), `last_commit_author`, `description`.
|
|
716
721
|
Both URLs are always there; local clones have `name` instead of `project`/`source`, and their `git_url` is the clone's
|
|
717
722
|
`origin` (`web_url` is "" for a host other than GitHub / Azure DevOps).
|
|
@@ -2014,11 +2014,16 @@ def list_repo_cmd(
|
|
|
2014
2014
|
"--no-local",
|
|
2015
2015
|
help="Don't look for local clones of the listed repos: --json then has no `location` (otherwise the clone's path, or null if not cloned)",
|
|
2016
2016
|
),
|
|
2017
|
+
include_disabled: bool = typer.Option(
|
|
2018
|
+
False,
|
|
2019
|
+
"--include-disabled",
|
|
2020
|
+
help="Also list disabled repos (left out by default): marked `(DISABLED)` in the text, `\"disabled\": true` in --json",
|
|
2021
|
+
),
|
|
2017
2022
|
fast: bool = typer.Option(
|
|
2018
2023
|
False,
|
|
2019
2024
|
"--fast",
|
|
2020
|
-
help="
|
|
2021
|
-
"
|
|
2025
|
+
help="Azure DevOps only: skip the commit and README requests per repo, leaving those columns empty "
|
|
2026
|
+
"(GitHub always comes with them, in one query per 100 repos)",
|
|
2022
2027
|
),
|
|
2023
2028
|
as_json: bool = typer.Option(False, "--json", help="Print a JSON array instead of aligned text"),
|
|
2024
2029
|
pat: str | None = typer.Option(
|
|
@@ -2038,7 +2043,7 @@ def list_repo_cmd(
|
|
|
2038
2043
|
git and browser URL, and the path of the local clone (see --no-local).
|
|
2039
2044
|
"""
|
|
2040
2045
|
find_repo_mod.run_list(
|
|
2041
|
-
root=root, org=org, github_org=github_org, local=local, no_local=no_local, fast=fast, as_json=as_json, pat=pat
|
|
2046
|
+
root=root, org=org, github_org=github_org, local=local, no_local=no_local, include_disabled=include_disabled, fast=fast, as_json=as_json, pat=pat
|
|
2042
2047
|
)
|
|
2043
2048
|
|
|
2044
2049
|
|
|
@@ -86,10 +86,12 @@ class RemoteRepo:
|
|
|
86
86
|
source: str = "ado"
|
|
87
87
|
description: str = ""
|
|
88
88
|
last_commit: CommitInfo = CommitInfo()
|
|
89
|
+
disabled: bool = False
|
|
89
90
|
|
|
90
91
|
|
|
91
92
|
ADO_API_VERSION = "7.1"
|
|
92
93
|
ADO_PAGE_SIZE = 100
|
|
94
|
+
ADO_DETAIL_WORKERS = 16
|
|
93
95
|
|
|
94
96
|
|
|
95
97
|
def _ado_get(url: str, headers: dict[str, str], params: dict[str, str | int] | None = None) -> tuple[bool, dict | str]:
|
|
@@ -155,7 +157,10 @@ def _ado_all_repos(org: str, headers: dict[str, str]) -> list[RemoteRepo]:
|
|
|
155
157
|
print(f"warning: couldn't list repos for project '{project['name']}': {str(data).strip()}", file=sys.stderr)
|
|
156
158
|
return []
|
|
157
159
|
assert isinstance(data, dict)
|
|
158
|
-
return [
|
|
160
|
+
return [
|
|
161
|
+
RemoteRepo(project["name"], r["name"], r["remoteUrl"], disabled=bool(r.get("isDisabled")))
|
|
162
|
+
for r in data.get("value", [])
|
|
163
|
+
]
|
|
159
164
|
|
|
160
165
|
all_repos: list[RemoteRepo] = []
|
|
161
166
|
with ThreadPoolExecutor(max_workers=8) as pool:
|
|
@@ -170,7 +175,7 @@ def find_remote(org: str, name: str, pat: str | None = None) -> list[RemoteRepo]
|
|
|
170
175
|
return _prefer_exact(_ado_all_repos(org, headers), name, key=lambda r: r.name)
|
|
171
176
|
|
|
172
177
|
|
|
173
|
-
def _github_all_repos(client: GitHubClient, org: str
|
|
178
|
+
def _github_all_repos(client: GitHubClient, org: str) -> list[RemoteRepo]:
|
|
174
179
|
"""Every repo of `org`'s GitHub account.
|
|
175
180
|
|
|
176
181
|
Unlike Azure DevOps, GitHub has a single flat list of repos per org/user
|
|
@@ -185,13 +190,8 @@ def _github_all_repos(client: GitHubClient, org: str, limit: int | None = 1000)
|
|
|
185
190
|
path, params = "user/repos", {"affiliation": "owner"}
|
|
186
191
|
else:
|
|
187
192
|
path = f"users/{org_path}/repos"
|
|
188
|
-
items = client.paginate(path, params, limit=
|
|
189
|
-
return [
|
|
190
|
-
RemoteRepo(
|
|
191
|
-
org, r["name"], r["html_url"], source="github", description=r.get("description") or "", last_commit=CommitInfo(date=r.get("pushed_at") or "")
|
|
192
|
-
)
|
|
193
|
-
for r in items
|
|
194
|
-
]
|
|
193
|
+
items = client.paginate(path, params, limit=1000)
|
|
194
|
+
return [RemoteRepo(org, r["name"], r["html_url"], source="github") for r in items]
|
|
195
195
|
|
|
196
196
|
|
|
197
197
|
def find_github(client: GitHubClient, org: str, name: str) -> list[RemoteRepo]:
|
|
@@ -243,9 +243,17 @@ def readme_summary(text: str) -> str:
|
|
|
243
243
|
|
|
244
244
|
|
|
245
245
|
def _ado_details(org: str, repo: RemoteRepo, headers: dict[str, str]) -> RemoteRepo:
|
|
246
|
-
"""`repo` plus
|
|
246
|
+
"""`repo` plus its default-branch newest commit and a README-derived description (Azure DevOps has neither on the repo)."""
|
|
247
247
|
base = f"https://dev.azure.com/{quote(org)}/{quote(repo.project)}/_apis/git/repositories/{quote(repo.name)}"
|
|
248
|
-
#
|
|
248
|
+
# Failures below are a blank field, not a failed listing (no access, empty repo, no README).
|
|
249
|
+
ok, commits = _ado_get(f"{base}/commits", headers, {"searchCriteria.$top": 1})
|
|
250
|
+
commit_list = commits.get("value") if ok and isinstance(commits, dict) else None
|
|
251
|
+
if commit_list == []:
|
|
252
|
+
return repo # a successful answer with no commits: no README either, don't spend requests on it
|
|
253
|
+
last_commit = CommitInfo() # also what a failed commit request leaves; the README may still be readable
|
|
254
|
+
if commit_list:
|
|
255
|
+
c = commit_list[0]
|
|
256
|
+
last_commit = CommitInfo(c.get("commitId", ""), c.get("committer", {}).get("date", ""), c.get("author", {}).get("name", ""))
|
|
249
257
|
# JSON is requested explicitly: without it the items API answers with the raw file instead of `content`.
|
|
250
258
|
description = ""
|
|
251
259
|
for name in README_NAMES:
|
|
@@ -255,42 +263,63 @@ def _ado_details(org: str, repo: RemoteRepo, headers: dict[str, str]) -> RemoteR
|
|
|
255
263
|
if ok and isinstance(readme, dict):
|
|
256
264
|
description = readme_summary(readme.get("content") or "")
|
|
257
265
|
break
|
|
258
|
-
ok, commits = _ado_get(f"{base}/commits", headers, {"searchCriteria.$top": 1})
|
|
259
|
-
last_commit = CommitInfo()
|
|
260
|
-
if ok and isinstance(commits, dict) and commits.get("value"):
|
|
261
|
-
c = commits["value"][0]
|
|
262
|
-
last_commit = CommitInfo(c.get("commitId", ""), c.get("committer", {}).get("date", ""), c.get("author", {}).get("name", ""))
|
|
263
266
|
return replace(repo, description=description, last_commit=last_commit)
|
|
264
267
|
|
|
265
268
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
269
|
+
_GITHUB_REPOS_QUERY = """
|
|
270
|
+
query($login: String!, $after: String) {
|
|
271
|
+
repositoryOwner(login: $login) {
|
|
272
|
+
repositories(first: 100, after: $after, ownerAffiliations: OWNER) {
|
|
273
|
+
pageInfo { hasNextPage endCursor }
|
|
274
|
+
nodes {
|
|
275
|
+
name url description pushedAt isDisabled
|
|
276
|
+
defaultBranchRef { target { ... on Commit { oid committedDate author { name } } } }
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
"""
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def _github_repos_with_commits(client: GitHubClient, org: str) -> list[RemoteRepo]:
|
|
285
|
+
"""Every repo of `org` (an org or a user) with description and default-branch newest commit, 100 repos per request.
|
|
286
|
+
|
|
287
|
+
One GraphQL query per page gets what would take a REST request per repo for the commit. An empty
|
|
288
|
+
repo has no default branch: it keeps its push time.
|
|
289
|
+
"""
|
|
290
|
+
repos: list[RemoteRepo] = []
|
|
291
|
+
after: str | None = None
|
|
292
|
+
while True:
|
|
293
|
+
owner = client.graphql(_GITHUB_REPOS_QUERY, login=org, after=after)["repositoryOwner"]
|
|
294
|
+
if owner is None:
|
|
295
|
+
sys.exit(f"GitHub account '{org}' not found (or not visible to your token).")
|
|
296
|
+
page = owner["repositories"]
|
|
297
|
+
for r in page["nodes"]:
|
|
298
|
+
commit = ((r.get("defaultBranchRef") or {}).get("target")) or {}
|
|
299
|
+
last_commit = (
|
|
300
|
+
CommitInfo(commit.get("oid", ""), commit.get("committedDate", ""), (commit.get("author") or {}).get("name") or "")
|
|
301
|
+
if commit
|
|
302
|
+
else CommitInfo(date=r.get("pushedAt") or "")
|
|
303
|
+
)
|
|
304
|
+
repos.append(
|
|
305
|
+
RemoteRepo(
|
|
306
|
+
org, r["name"], r["url"], source="github", description=r.get("description") or "", last_commit=last_commit, disabled=bool(r.get("isDisabled"))
|
|
307
|
+
)
|
|
308
|
+
)
|
|
309
|
+
if not page["pageInfo"]["hasNextPage"]:
|
|
310
|
+
return repos
|
|
311
|
+
after = page["pageInfo"]["endCursor"]
|
|
284
312
|
|
|
285
313
|
|
|
286
314
|
def list_remote(
|
|
287
|
-
*, org: str | None, github_org: str | None, pat: str | None = None, fast: bool = False
|
|
315
|
+
*, org: str | None, github_org: str | None, pat: str | None = None, fast: bool = False, include_disabled: bool = False
|
|
288
316
|
) -> list[RemoteRepo]:
|
|
289
317
|
"""Every repo of `org` (Azure DevOps) and/or `github_org` (GitHub), sorted by project and name.
|
|
290
318
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
319
|
+
Disabled repos are left out unless `include_disabled` (they can't be cloned, and their commits and
|
|
320
|
+
README aren't readable, so they get no description or commit either). GitHub comes with description and
|
|
321
|
+
newest commit in one query per 100 repos. Azure DevOps costs a commit request plus up to a few README
|
|
322
|
+
requests per repo, run concurrently like the project fan-out, unless `fast`.
|
|
294
323
|
"""
|
|
295
324
|
repos: list[RemoteRepo] = []
|
|
296
325
|
headers = auth_header(pat) if org else {}
|
|
@@ -300,19 +329,19 @@ def list_remote(
|
|
|
300
329
|
if org:
|
|
301
330
|
searches.append(pool.submit(_ado_all_repos, org, headers))
|
|
302
331
|
if github_org and gh:
|
|
303
|
-
searches.append(pool.submit(
|
|
332
|
+
searches.append(pool.submit(_github_repos_with_commits, gh, github_org))
|
|
304
333
|
for search in searches:
|
|
305
334
|
repos += search.result()
|
|
306
335
|
|
|
307
|
-
if not
|
|
336
|
+
if not include_disabled:
|
|
337
|
+
repos = [r for r in repos if not r.disabled]
|
|
338
|
+
|
|
339
|
+
if org and not fast:
|
|
340
|
+
|
|
308
341
|
def details(r: RemoteRepo) -> RemoteRepo:
|
|
309
|
-
if r.source
|
|
310
|
-
assert gh
|
|
311
|
-
return _github_last_commit(gh, r)
|
|
312
|
-
assert org
|
|
313
|
-
return _ado_details(org, r, headers)
|
|
342
|
+
return r if r.source != "ado" or r.disabled else _ado_details(org, r, headers)
|
|
314
343
|
|
|
315
|
-
with ThreadPoolExecutor(max_workers=
|
|
344
|
+
with ThreadPoolExecutor(max_workers=ADO_DETAIL_WORKERS) as pool:
|
|
316
345
|
repos = list(pool.map(details, repos))
|
|
317
346
|
return sorted(repos, key=lambda r: (r.project.lower(), r.name.lower()))
|
|
318
347
|
|
|
@@ -413,6 +442,7 @@ def run_list(
|
|
|
413
442
|
github_org: str | None = None,
|
|
414
443
|
local: bool = False,
|
|
415
444
|
no_local: bool = False,
|
|
445
|
+
include_disabled: bool = False,
|
|
416
446
|
fast: bool = False,
|
|
417
447
|
as_json: bool = False,
|
|
418
448
|
pat: str | None = None,
|
|
@@ -425,7 +455,7 @@ def run_list(
|
|
|
425
455
|
"""
|
|
426
456
|
if local and no_local:
|
|
427
457
|
sys.exit("--local and --no-local contradict each other.")
|
|
428
|
-
entries: list[dict[str, str | None]]
|
|
458
|
+
entries: list[dict[str, str | bool | None]]
|
|
429
459
|
search_root = root or work_dir()
|
|
430
460
|
if local or not (org or github_org):
|
|
431
461
|
if no_local:
|
|
@@ -449,19 +479,28 @@ def run_list(
|
|
|
449
479
|
for r in list_local(search_root)
|
|
450
480
|
]
|
|
451
481
|
labels = [str(e["location"]) for e in entries]
|
|
482
|
+
descriptions = [str(e["description"]) for e in entries]
|
|
452
483
|
else:
|
|
453
|
-
remote = list_remote(org=org, github_org=github_org, pat=pat, fast=fast)
|
|
484
|
+
remote = list_remote(org=org, github_org=github_org, pat=pat, fast=fast, include_disabled=include_disabled)
|
|
454
485
|
# Without a work dir there is simply nothing cloned; only the --local listing insists that it exists.
|
|
455
486
|
clones = {} if no_local or not search_root.is_dir() else local_clones_by_web_url(search_root)
|
|
456
487
|
entries = []
|
|
457
488
|
for r in remote:
|
|
458
489
|
git_url, browse_url = _remote_urls(r)
|
|
459
|
-
entry: dict[str, str | None] = {
|
|
490
|
+
entry: dict[str, str | bool | None] = {
|
|
491
|
+
"project": r.project,
|
|
492
|
+
"name": r.name,
|
|
493
|
+
"source": r.source,
|
|
494
|
+
"disabled": r.disabled,
|
|
495
|
+
"git_url": git_url,
|
|
496
|
+
"web_url": browse_url,
|
|
497
|
+
}
|
|
460
498
|
if not no_local:
|
|
461
499
|
clone_path = clones.get(browse_url.lower())
|
|
462
500
|
entry["location"] = str(clone_path) if clone_path else None
|
|
463
501
|
entries.append({**entry, **_commit_fields(r.last_commit), "description": r.description})
|
|
464
502
|
labels = [f"{r.project}/{r.name}" for r in remote]
|
|
503
|
+
descriptions = ["(DISABLED) " * r.disabled + r.description for r in remote]
|
|
465
504
|
|
|
466
505
|
if as_json:
|
|
467
506
|
print(json.dumps(entries, indent=2, ensure_ascii=False))
|
|
@@ -470,9 +509,9 @@ def run_list(
|
|
|
470
509
|
labels = [_printable(label) for label in labels]
|
|
471
510
|
authors = [_printable(str(e["last_commit_author"])) for e in entries]
|
|
472
511
|
label_w, author_w = max(map(len, labels), default=0), max(map(len, authors), default=0)
|
|
473
|
-
for label, author, e in zip(labels, authors, entries):
|
|
512
|
+
for label, author, description, e in zip(labels, authors, descriptions, entries):
|
|
474
513
|
commit = f"{str(e['last_commit_date'])[:10]:<10} {str(e['last_commit_id'])[:8]:<8} {author:<{author_w}}"
|
|
475
|
-
print(f"{label:<{label_w}} {commit} {_printable(
|
|
514
|
+
print(f"{label:<{label_w}} {commit} {_printable(description)}".rstrip())
|
|
476
515
|
|
|
477
516
|
|
|
478
517
|
def _printable(text: str) -> str:
|
|
@@ -10,7 +10,7 @@ packages = ["bmsdna"]
|
|
|
10
10
|
|
|
11
11
|
[project]
|
|
12
12
|
name = "bmsdna-devtools"
|
|
13
|
-
version = "0.57.
|
|
13
|
+
version = "0.57.2"
|
|
14
14
|
description = "Shared Azure DevOps / GitHub / git / Azure Monitor developer tooling for BMS projects"
|
|
15
15
|
readme = "README.md"
|
|
16
16
|
requires-python = ">=3.14" # pgdevkit>=0.7.1 requires 3.14; was >=3.11 before adding it as a dependency
|
|
@@ -198,14 +198,15 @@ copies an env file in (auto-detects `.local_env` then `.env`), and runs
|
|
|
198
198
|
## Listing all repos
|
|
199
199
|
|
|
200
200
|
```bash
|
|
201
|
-
bdt list-repo [--org MYORG] [--github-org MYORG] [--local] [--no-local] [--fast] [--json]
|
|
201
|
+
bdt list-repo [--org MYORG] [--github-org MYORG] [--local] [--no-local] [--include-disabled] [--fast] [--json]
|
|
202
202
|
```
|
|
203
203
|
|
|
204
204
|
Every repo of the Azure DevOps / GitHub org (`AZDO_ORG`, `GITHUB_ORG`; else the local clones) with newest commit
|
|
205
205
|
(date, id, author) and a README/GitHub one-line description -- use it to see what repos exist before `bdt find-repo <name>`
|
|
206
|
-
locates or clones one. `--json` gives an array of objects (`project`, `name`, `git_url`, `web_url`, `location`, `last_commit_id`,
|
|
206
|
+
locates or clones one. `--json` gives an array of objects (`project`, `name`, `disabled`, `git_url`, `web_url`, `location`, `last_commit_id`,
|
|
207
207
|
`last_commit_date`, `last_commit_author`, `description`) for processing; `location` is your local clone of the repo (null if
|
|
208
|
-
none; `--no-local` skips the lookup and drops the key).
|
|
208
|
+
none; `--no-local` skips the lookup and drops the key). Disabled repos are hidden unless `--include-disabled`. `--fast` skips
|
|
209
|
+
the per-repo requests for commit and README (Azure DevOps).
|
|
209
210
|
|
|
210
211
|
## Committing and pushing
|
|
211
212
|
|
|
@@ -796,34 +796,43 @@ def test_list_remote_fast_makes_no_per_repo_requests(monkeypatch) -> None:
|
|
|
796
796
|
assert not [c for c in calls if c[0].endswith(("/items", "/commits"))]
|
|
797
797
|
|
|
798
798
|
|
|
799
|
-
class
|
|
800
|
-
"""
|
|
801
|
-
|
|
802
|
-
def __init__(self,
|
|
803
|
-
|
|
804
|
-
self.
|
|
805
|
-
self.
|
|
806
|
-
|
|
807
|
-
def
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
return
|
|
811
|
-
|
|
799
|
+
class FakeGitHubGraphQL:
|
|
800
|
+
"""Stands in for GitHubClient.graphql, serving `pages` of repository nodes one call at a time."""
|
|
801
|
+
|
|
802
|
+
def __init__(self, pages: list[list[dict]], owner_missing: bool = False):
|
|
803
|
+
self.pages = pages
|
|
804
|
+
self.owner_missing = owner_missing
|
|
805
|
+
self.calls: list[dict] = []
|
|
806
|
+
|
|
807
|
+
def graphql(self, query, **variables):
|
|
808
|
+
self.calls.append(variables)
|
|
809
|
+
if self.owner_missing:
|
|
810
|
+
return {"repositoryOwner": None}
|
|
811
|
+
i = len(self.calls) - 1
|
|
812
|
+
return {
|
|
813
|
+
"repositoryOwner": {
|
|
814
|
+
"repositories": {
|
|
815
|
+
"pageInfo": {"hasNextPage": i + 1 < len(self.pages), "endCursor": f"cursor{i}"},
|
|
816
|
+
"nodes": self.pages[i],
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
}
|
|
812
820
|
|
|
813
821
|
|
|
814
|
-
def
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
{"
|
|
822
|
-
|
|
822
|
+
def _gh_node(name: str, **kw) -> dict:
|
|
823
|
+
return {
|
|
824
|
+
"name": name,
|
|
825
|
+
"url": f"https://github.com/org/{name}",
|
|
826
|
+
"description": None,
|
|
827
|
+
"pushedAt": "2020-01-01T00:00:00Z",
|
|
828
|
+
"isDisabled": False,
|
|
829
|
+
"defaultBranchRef": {"target": {"oid": "abc123", "committedDate": "2026-03-04T05:06:07Z", "author": {"name": "Ann"}}},
|
|
830
|
+
**kw,
|
|
831
|
+
}
|
|
823
832
|
|
|
824
833
|
|
|
825
|
-
def
|
|
826
|
-
client =
|
|
834
|
+
def test_list_remote_reads_github_description_and_newest_commit_in_one_query_per_page(monkeypatch) -> None:
|
|
835
|
+
client = FakeGitHubGraphQL([[_gh_node("a", description="Does a")], [_gh_node("empty", defaultBranchRef=None)]])
|
|
827
836
|
monkeypatch.setattr(find_repo_mod, "require_gh", lambda: client)
|
|
828
837
|
|
|
829
838
|
result = list_remote(org=None, github_org="org")
|
|
@@ -837,46 +846,61 @@ def test_list_remote_reads_github_description_and_newest_commit(monkeypatch) ->
|
|
|
837
846
|
description="Does a",
|
|
838
847
|
last_commit=CommitInfo("abc123", "2026-03-04T05:06:07Z", "Ann"),
|
|
839
848
|
),
|
|
840
|
-
# empty repo
|
|
849
|
+
# empty repo: no default branch, so it keeps the push time
|
|
841
850
|
RemoteRepo("org", "empty", "https://github.com/org/empty", source="github", last_commit=CommitInfo(date="2020-01-01T00:00:00Z")),
|
|
842
851
|
]
|
|
843
|
-
assert
|
|
852
|
+
assert client.calls == [{"login": "org", "after": None}, {"login": "org", "after": "cursor0"}]
|
|
844
853
|
|
|
845
854
|
|
|
846
|
-
def
|
|
847
|
-
|
|
848
|
-
monkeypatch.setattr(find_repo_mod, "require_gh", lambda: client)
|
|
855
|
+
def test_list_remote_unknown_github_account_exits(monkeypatch) -> None:
|
|
856
|
+
monkeypatch.setattr(find_repo_mod, "require_gh", lambda: FakeGitHubGraphQL([], owner_missing=True))
|
|
849
857
|
|
|
850
|
-
|
|
858
|
+
with pytest.raises(SystemExit) as exc_info:
|
|
859
|
+
list_remote(org=None, github_org="nobody")
|
|
851
860
|
|
|
852
|
-
assert
|
|
853
|
-
assert client.commit_calls == []
|
|
861
|
+
assert "nobody" in str(exc_info.value)
|
|
854
862
|
|
|
855
863
|
|
|
856
|
-
def
|
|
857
|
-
|
|
858
|
-
[
|
|
859
|
-
{"name": "limited", "html_url": "u1", "description": "d", "pushed_at": "2026-01-01T00:00:00Z"},
|
|
860
|
-
{"name": "ok", "html_url": "u2", "description": "d", "pushed_at": "2026-01-02T00:00:00Z"},
|
|
861
|
-
],
|
|
862
|
-
{
|
|
863
|
-
"limited": FakeResp(403, {"message": "rate limited"}),
|
|
864
|
-
"ok": FakeResp(body=[{"sha": "abc", "commit": {"author": {"name": "Ann"}, "committer": {"date": "2026-01-03T00:00:00Z"}}}]),
|
|
865
|
-
},
|
|
864
|
+
def test_list_remote_hides_disabled_repos_unless_asked(monkeypatch) -> None:
|
|
865
|
+
monkeypatch.setattr(
|
|
866
|
+
find_repo_mod, "require_gh", lambda: FakeGitHubGraphQL([[_gh_node("on"), _gh_node("off", isDisabled=True)]])
|
|
866
867
|
)
|
|
867
|
-
limits: list = []
|
|
868
|
-
paginate = client.paginate
|
|
869
|
-
client.paginate = lambda path, params=None, **kw: (limits.append(kw.get("limit", "unset")), paginate(path, params))[1] # type: ignore[method-assign]
|
|
870
|
-
monkeypatch.setattr(find_repo_mod, "require_gh", lambda: client)
|
|
871
868
|
|
|
872
|
-
|
|
869
|
+
assert [r.name for r in list_remote(org=None, github_org="org")] == ["on"]
|
|
870
|
+
shown = list_remote(org=None, github_org="org", include_disabled=True)
|
|
871
|
+
assert [(r.name, r.disabled) for r in shown] == [("off", True), ("on", False)]
|
|
873
872
|
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
873
|
+
|
|
874
|
+
def test_list_remote_ado_disabled_repos_are_filtered_and_get_no_detail_requests(monkeypatch) -> None:
|
|
875
|
+
calls: list = []
|
|
876
|
+
repos = {
|
|
877
|
+
"A": [
|
|
878
|
+
{"name": "live", "remoteUrl": "https://a/live"},
|
|
879
|
+
{"name": "off", "remoteUrl": "https://a/off", "isDisabled": True},
|
|
880
|
+
]
|
|
881
|
+
}
|
|
882
|
+
monkeypatch.setattr(requests, "get", _fake_ado_details([{"name": "A"}], repos, {"live": "# Live\n\nLive repo."}, {"live": "2026-01-02T03:04:05Z"}, calls))
|
|
883
|
+
|
|
884
|
+
default = list_remote(org="org", github_org=None)
|
|
885
|
+
included = list_remote(org="org", github_org=None, include_disabled=True)
|
|
886
|
+
|
|
887
|
+
assert [r.name for r in default] == ["live"]
|
|
888
|
+
assert [(r.name, r.disabled, r.description) for r in included] == [("live", False, "Live repo."), ("off", True, "")]
|
|
889
|
+
assert not [c for c in calls if "/off/" in c[0]] # disabled repos' commits/README are never requested
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
def test_list_remote_ado_skips_readme_requests_for_repos_without_commits(monkeypatch) -> None:
|
|
893
|
+
calls: list = []
|
|
894
|
+
monkeypatch.setattr(
|
|
895
|
+
requests,
|
|
896
|
+
"get",
|
|
897
|
+
_fake_ado_details([{"name": "A"}], {"A": [{"name": "empty", "remoteUrl": "https://a/empty"}]}, {}, {}, calls),
|
|
898
|
+
)
|
|
899
|
+
|
|
900
|
+
[repo] = list_remote(org="org", github_org=None)
|
|
901
|
+
|
|
902
|
+
assert repo == RemoteRepo("A", "empty", "https://a/empty")
|
|
903
|
+
assert [c[0].rsplit("/", 1)[-1] for c in calls if "/empty/" in c[0]] == ["commits"]
|
|
880
904
|
|
|
881
905
|
|
|
882
906
|
def test_list_remote_ado_tries_other_readme_names(monkeypatch) -> None:
|
|
@@ -891,7 +915,7 @@ def test_list_remote_ado_tries_other_readme_names(monkeypatch) -> None:
|
|
|
891
915
|
content = readmes.get(params["path"])
|
|
892
916
|
return FakeResp(body={"content": content}) if content else FakeResp(404, {"message": "nope"})
|
|
893
917
|
if url.endswith("/commits"):
|
|
894
|
-
return FakeResp(body={"value": []})
|
|
918
|
+
return FakeResp(body={"value": [{"commitId": "c1", "author": {"name": "Ann"}, "committer": {"date": "2026-01-01"}}]})
|
|
895
919
|
return FakeResp(body={"value": [{"name": "alpha", "remoteUrl": "https://a/alpha"}]})
|
|
896
920
|
|
|
897
921
|
monkeypatch.setattr(requests, "get", fake_get)
|
|
@@ -975,6 +999,7 @@ def test_run_list_json_is_structured(monkeypatch, capsys) -> None:
|
|
|
975
999
|
"project": "P",
|
|
976
1000
|
"name": "a",
|
|
977
1001
|
"source": "ado",
|
|
1002
|
+
"disabled": False,
|
|
978
1003
|
"git_url": "u1",
|
|
979
1004
|
"web_url": "",
|
|
980
1005
|
"location": None,
|
|
@@ -1136,3 +1161,53 @@ def test_cli_list_repo_no_local_flag(tmp_path, monkeypatch) -> None:
|
|
|
1136
1161
|
result = runner.invoke(app, ["list-repo", "--local", "--no-local", "--root", str(tmp_path)])
|
|
1137
1162
|
|
|
1138
1163
|
assert result.exit_code == 1
|
|
1164
|
+
|
|
1165
|
+
|
|
1166
|
+
def test_run_list_marks_disabled_repos_in_text_and_json(monkeypatch, capsys) -> None:
|
|
1167
|
+
import json
|
|
1168
|
+
|
|
1169
|
+
seen: list = []
|
|
1170
|
+
monkeypatch.setattr(
|
|
1171
|
+
find_repo_mod,
|
|
1172
|
+
"list_remote",
|
|
1173
|
+
lambda **kw: seen.append(kw["include_disabled"]) or [RemoteRepo("P", "gone", "u", disabled=True), RemoteRepo("P", "ok", "u2", description="Fine")],
|
|
1174
|
+
)
|
|
1175
|
+
|
|
1176
|
+
run_list(root=None, org="org", include_disabled=True)
|
|
1177
|
+
text = capsys.readouterr().out
|
|
1178
|
+
run_list(root=None, org="org", include_disabled=True, as_json=True)
|
|
1179
|
+
data = json.loads(capsys.readouterr().out)
|
|
1180
|
+
|
|
1181
|
+
assert [line.endswith(("(DISABLED)", "Fine")) for line in text.splitlines()] == [True, True]
|
|
1182
|
+
assert text.splitlines()[0].startswith("P/gone") and "(DISABLED)" in text.splitlines()[0]
|
|
1183
|
+
assert [e["disabled"] for e in data] == [True, False]
|
|
1184
|
+
assert seen == [True, True]
|
|
1185
|
+
|
|
1186
|
+
|
|
1187
|
+
def test_cli_list_repo_include_disabled_flag_is_forwarded(monkeypatch) -> None:
|
|
1188
|
+
seen: dict = {}
|
|
1189
|
+
monkeypatch.setattr(find_repo_mod, "run_list", lambda **kw: seen.update(kw))
|
|
1190
|
+
|
|
1191
|
+
result = runner.invoke(app, ["list-repo", "--org", "o", "--include-disabled"])
|
|
1192
|
+
|
|
1193
|
+
assert result.exit_code == 0, result.output
|
|
1194
|
+
assert seen["include_disabled"] is True
|
|
1195
|
+
runner.invoke(app, ["list-repo", "--org", "o"])
|
|
1196
|
+
assert seen["include_disabled"] is False
|
|
1197
|
+
|
|
1198
|
+
|
|
1199
|
+
def test_list_remote_ado_failing_commit_request_still_looks_up_the_readme(monkeypatch) -> None:
|
|
1200
|
+
def fake_get(url, headers=None, params=None, timeout=None):
|
|
1201
|
+
if url.endswith("/_apis/projects"):
|
|
1202
|
+
return FakeResp(body={"value": [{"name": "A"}]})
|
|
1203
|
+
if url.endswith("/commits"):
|
|
1204
|
+
return FakeResp(503, {"message": "try later"})
|
|
1205
|
+
if url.endswith("/items"):
|
|
1206
|
+
return FakeResp(body={"content": "Readable README."}) if params["path"] == "/README.md" else FakeResp(404, {})
|
|
1207
|
+
return FakeResp(body={"value": [{"name": "alpha", "remoteUrl": "https://a/alpha"}]})
|
|
1208
|
+
|
|
1209
|
+
monkeypatch.setattr(requests, "get", fake_get)
|
|
1210
|
+
|
|
1211
|
+
[repo] = list_remote(org="org", github_org=None)
|
|
1212
|
+
|
|
1213
|
+
assert (repo.description, repo.last_commit) == ("Readable README.", CommitInfo())
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|