bmsdna-devtools 1.1.0__tar.gz → 1.1.1__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-1.1.0 → bmsdna_devtools-1.1.1}/PKG-INFO +3 -1
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/README.md +2 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/worktree.py +21 -5
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/pyproject.toml +1 -1
- bmsdna_devtools-1.1.1/tests/test_worktree_create.py +110 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/uv.lock +1 -1
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/.github/workflows/auto-release.yml +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/.github/workflows/python-publish.yml +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/.github/workflows/python-test.yml +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/.gitignore +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/.python-version +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/__init__.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/_api_dump.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/ado_auth.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/ado_issue.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/agent_mentions.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/api_usage.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/app_service_logs.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/azure_arm.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/azure_auth.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/bdt_config.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/business_user.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/ci_plan.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/ci_plan_env.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/cli.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/cli_tools.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/commit.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/dead_code.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/deps/__init__.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/deps/advisories.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/deps/cli.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/deps/cooldown.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/deps/lockfiles.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/deps/osv.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/deps/versions.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/env_config.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/env_files.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/find_injection.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/find_repo.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/gh_args.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/gh_issue.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/gh_pr.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/github_api.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/gitrepo.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/injection_frontend.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/injection_python.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/issue_do.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/issue_show.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/issue_watch.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/lint.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/lint_findings.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/lint_models.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/lint_sql.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/lint_sql_files.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/lint_tooling.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/lint_typescript.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/logs.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/pr_build.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/pr_cancel.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/pr_choice.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/pr_create_args.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/pr_drift.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/pr_info.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/pr_issue_link.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/pr_labels.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/pr_list.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/pr_markdown.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/pr_merge_defaults.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/pr_ref.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/pull.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/testdb.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/translate.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/usage/__init__.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/usage/cli.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/usage/pipeline.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/usage/pricing.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/usage/report.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/usage/sql/00_schema.sql +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/usage/sql/01_ingest_claude.sql +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/usage/sql/01_ingest_codex.sql +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/usage/sql/02_messages.sql +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/usage/sql/03_markers.sql +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/usage/sql/04_facts.sql +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/usage/sql/05_views.sql +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/justfile +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/prek.toml +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/skills/bmsdna-devtools/SKILL.md +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/conftest.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/fake_github.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_ado_auth.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_ado_issue.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_ado_issue_flow.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_agent_mentions.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_api_usage.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_app_service_logs.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_azure_arm.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_bdt_config.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_business_user.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_ci_plan.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_ci_plan_env.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_cli_cleanup.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_cli_commit.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_cli_deps.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_cli_issue.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_cli_pr_create.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_cli_pr_id.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_cli_pull.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_cli_tools.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_cli_version.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_commit.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_deps_advisories.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_deps_cooldown.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_deps_lockfiles.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_deps_osv.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_deps_versions.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_env_config.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_env_files.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_find_injection.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_find_repo.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_gh_issue.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_gh_pr.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_github_api.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_gitrepo.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_issue_do.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_issue_for_me.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_issue_show.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_issue_watch.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_lint.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_lint_models.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_lint_sql.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_lint_sql_files.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_lint_tooling.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_lint_typescript.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_logs.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_pr_build.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_pr_build_create_options.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_pr_build_flow.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_pr_cancel_build.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_pr_choice.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_pr_create_args.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_pr_description_not_truncated.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_pr_drift.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_pr_info.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_pr_issue_link.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_pr_labels.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_pr_list.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_pr_markdown.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_pr_merge_defaults.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_pull.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_testdb.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_translate.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_usage.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_wait_timeout.py +0 -0
- {bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/tests/test_worktree_clean.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: bmsdna-devtools
|
|
3
|
-
Version: 1.1.
|
|
3
|
+
Version: 1.1.1
|
|
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
|
|
@@ -687,6 +687,8 @@ Creates `.worktrees/<name>` branched from `--base`. It first fetches `origin/<ba
|
|
|
687
687
|
a local base that is ahead of or has diverged from the remote is kept as is. Then it initializes submodules
|
|
688
688
|
(unless `--no-submodules`), and copies an env file into the new worktree as
|
|
689
689
|
`.env` (auto-detects `.local_env` then `.env` if `--env-file` isn't given).
|
|
690
|
+
Run from a sub-folder of a monorepo, the worktree still covers the whole repo and the env file and `--install` apply to
|
|
691
|
+
that same sub-folder inside it.
|
|
690
692
|
It also adds `.worktrees/` and `.claude/worktrees/` to the repo root's `.gitignore` if Git
|
|
691
693
|
doesn't already ignore them, and reminds you to commit the change.
|
|
692
694
|
|
|
@@ -668,6 +668,8 @@ Creates `.worktrees/<name>` branched from `--base`. It first fetches `origin/<ba
|
|
|
668
668
|
a local base that is ahead of or has diverged from the remote is kept as is. Then it initializes submodules
|
|
669
669
|
(unless `--no-submodules`), and copies an env file into the new worktree as
|
|
670
670
|
`.env` (auto-detects `.local_env` then `.env` if `--env-file` isn't given).
|
|
671
|
+
Run from a sub-folder of a monorepo, the worktree still covers the whole repo and the env file and `--install` apply to
|
|
672
|
+
that same sub-folder inside it.
|
|
671
673
|
It also adds `.worktrees/` and `.claude/worktrees/` to the repo root's `.gitignore` if Git
|
|
672
674
|
doesn't already ignore them, and reminds you to commit the change.
|
|
673
675
|
|
|
@@ -137,12 +137,28 @@ def create(
|
|
|
137
137
|
if path.exists():
|
|
138
138
|
sys.exit(f"error: {path} already exists")
|
|
139
139
|
|
|
140
|
+
# Run from a sub-folder of a monorepo, the worktree still holds the whole repository: the env file and the install
|
|
141
|
+
# command belong in the same sub-folder of it (`<worktree>/app`), the project, not in the worktree's top level.
|
|
142
|
+
# Asked before the worktree exists, so a failure leaves nothing behind.
|
|
143
|
+
found = _run_capture(["git", "rev-parse", "--show-prefix"], cwd=root)
|
|
144
|
+
if found.returncode != 0:
|
|
145
|
+
sys.exit(f"error: {root} is not inside a git work tree: {found.stderr.strip()}")
|
|
146
|
+
prefix = found.stdout.removesuffix("\n")
|
|
147
|
+
|
|
140
148
|
start, remote_start = _start_point(root, base)
|
|
141
149
|
# --no-track: the new branch must not push to / compare against origin/<base>
|
|
142
150
|
_run(["git", "worktree", "add", *(["--no-track"] if remote_start else []), str(path), "-b", name, start], cwd=root)
|
|
143
151
|
_ensure_worktree_gitignore(root)
|
|
144
152
|
|
|
145
|
-
|
|
153
|
+
project = path / prefix if prefix else path
|
|
154
|
+
if not project.is_dir():
|
|
155
|
+
print(
|
|
156
|
+
f"warning: {base} has no {prefix}; the env file and the install command use the worktree root",
|
|
157
|
+
file=sys.stderr,
|
|
158
|
+
)
|
|
159
|
+
project = path
|
|
160
|
+
|
|
161
|
+
if submodules and (path / ".gitmodules").exists():
|
|
146
162
|
_run(["git", "submodule", "update", "--init"], cwd=path)
|
|
147
163
|
|
|
148
164
|
if env_file is None:
|
|
@@ -152,12 +168,12 @@ def create(
|
|
|
152
168
|
break
|
|
153
169
|
|
|
154
170
|
if env_file and (root / env_file).exists():
|
|
155
|
-
shutil.copy(root / env_file,
|
|
171
|
+
shutil.copy(root / env_file, project / ".env")
|
|
156
172
|
|
|
157
173
|
if install_cmd:
|
|
158
|
-
_run(install_cmd, cwd=
|
|
174
|
+
_run(install_cmd, cwd=project)
|
|
159
175
|
|
|
160
|
-
print(f"worktree ready at {
|
|
176
|
+
print(f"worktree ready at {project}")
|
|
161
177
|
# A worktree based on the remote's actual DEFAULT branch makes `bdt pull`'s
|
|
162
178
|
# separate default-branch step redundant. base in ("main", "master") is
|
|
163
179
|
# only a *guess* at that (wrong on a repo whose configured default is e.g.
|
|
@@ -180,7 +196,7 @@ def create(
|
|
|
180
196
|
)
|
|
181
197
|
else:
|
|
182
198
|
print("Hint: run `bdt pull` in it to pull the latest main/master and default branch.")
|
|
183
|
-
return
|
|
199
|
+
return project
|
|
184
200
|
|
|
185
201
|
|
|
186
202
|
# --- Discovery: repos and their worktrees -------------------------------
|
|
@@ -10,7 +10,7 @@ packages = ["bmsdna"]
|
|
|
10
10
|
|
|
11
11
|
[project]
|
|
12
12
|
name = "bmsdna-devtools"
|
|
13
|
-
version = "1.1.
|
|
13
|
+
version = "1.1.1"
|
|
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
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"""`worktree.create`: where the env file and the install command go, at the repo root and in a monorepo sub-folder."""
|
|
2
|
+
|
|
3
|
+
import subprocess
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
|
|
6
|
+
import pytest
|
|
7
|
+
|
|
8
|
+
from bmsdna.devtools import worktree
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def git(cwd: Path, *args: str) -> None:
|
|
12
|
+
subprocess.run(["git", *args], cwd=cwd, check=True, capture_output=True, text=True)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@pytest.fixture
|
|
16
|
+
def repo(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> Path:
|
|
17
|
+
for key, value in {"NAME": "t", "EMAIL": "t@t"}.items():
|
|
18
|
+
monkeypatch.setenv(f"GIT_AUTHOR_{key}", value)
|
|
19
|
+
monkeypatch.setenv(f"GIT_COMMITTER_{key}", value)
|
|
20
|
+
work = tmp_path / "repo"
|
|
21
|
+
(work / "app").mkdir(parents=True)
|
|
22
|
+
git(work, "init", "-q", "-b", "main")
|
|
23
|
+
(work / "app" / "code.py").write_text("x")
|
|
24
|
+
(work / ".gitignore").write_text(".worktrees/\n")
|
|
25
|
+
git(work, "add", "-A")
|
|
26
|
+
git(work, "commit", "-q", "-m", "init")
|
|
27
|
+
(work / ".local_env").write_text("ROOT=1")
|
|
28
|
+
(work / "app" / ".local_env").write_text("APP=1")
|
|
29
|
+
return work
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
INSTALL = ["sh", "-c", "pwd -P > where.txt"]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def test_at_the_repo_root_env_and_install_use_the_worktree_root(repo: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
36
|
+
monkeypatch.chdir(repo)
|
|
37
|
+
worktree.create("feat", base="main", install_cmd=INSTALL)
|
|
38
|
+
wt = repo / ".worktrees" / "feat"
|
|
39
|
+
assert (wt / ".env").read_text() == "ROOT=1"
|
|
40
|
+
assert (wt / "where.txt").read_text().strip() == str(wt.resolve())
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def test_in_a_sub_folder_env_and_install_use_the_same_sub_folder_of_the_worktree(
|
|
44
|
+
repo: Path, monkeypatch: pytest.MonkeyPatch
|
|
45
|
+
) -> None:
|
|
46
|
+
monkeypatch.chdir(repo / "app")
|
|
47
|
+
worktree.create("feat", base="main", install_cmd=INSTALL)
|
|
48
|
+
wt = repo / "app" / ".worktrees" / "feat"
|
|
49
|
+
assert (wt / "app" / "code.py").is_file() # the worktree holds the whole repository
|
|
50
|
+
assert (wt / "app" / ".env").read_text() == "APP=1"
|
|
51
|
+
assert (wt / "app" / "where.txt").read_text().strip() == str((wt / "app").resolve())
|
|
52
|
+
assert not (wt / ".env").exists() and not (wt / "where.txt").exists()
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def test_the_ready_message_names_the_project_folder(
|
|
56
|
+
repo: Path, monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str]
|
|
57
|
+
) -> None:
|
|
58
|
+
monkeypatch.chdir(repo / "app")
|
|
59
|
+
worktree.create("feat", base="main")
|
|
60
|
+
assert f"worktree ready at {repo / 'app' / '.worktrees' / 'feat' / 'app'}" in capsys.readouterr().out
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def test_a_base_without_the_project_folder_falls_back_to_the_worktree_root(
|
|
64
|
+
repo: Path, monkeypatch: pytest.MonkeyPatch, capsys: pytest.CaptureFixture[str]
|
|
65
|
+
) -> None:
|
|
66
|
+
empty = subprocess.run(
|
|
67
|
+
["git", "mktree"], cwd=repo, input="", capture_output=True, text=True, check=True
|
|
68
|
+
).stdout.strip()
|
|
69
|
+
commit = subprocess.run(
|
|
70
|
+
["git", "commit-tree", empty, "-m", "no app here"], cwd=repo, capture_output=True, text=True, check=True
|
|
71
|
+
).stdout.strip()
|
|
72
|
+
git(repo, "branch", "bare", commit)
|
|
73
|
+
monkeypatch.chdir(repo / "app")
|
|
74
|
+
worktree.create("feat", base="bare", install_cmd=INSTALL)
|
|
75
|
+
wt = repo / "app" / ".worktrees" / "feat"
|
|
76
|
+
assert (wt / "where.txt").is_file() and (wt / ".env").read_text() == "APP=1"
|
|
77
|
+
assert "has no app/" in capsys.readouterr().err
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
def test_an_explicit_env_file_is_taken_from_the_sub_folder(repo: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
81
|
+
(repo / "app" / "custom_env").write_text("CUSTOM=1")
|
|
82
|
+
monkeypatch.chdir(repo / "app")
|
|
83
|
+
worktree.create("feat", base="main", env_file="custom_env")
|
|
84
|
+
assert (repo / "app" / ".worktrees" / "feat" / "app" / ".env").read_text() == "CUSTOM=1"
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
def test_submodules_are_initialised_when_gitmodules_sits_at_the_repo_top(
|
|
88
|
+
repo: Path, monkeypatch: pytest.MonkeyPatch
|
|
89
|
+
) -> None:
|
|
90
|
+
(repo / ".gitmodules").write_text("")
|
|
91
|
+
git(repo, "add", ".gitmodules")
|
|
92
|
+
git(repo, "commit", "-q", "-m", "gitmodules")
|
|
93
|
+
calls: list[list[str]] = []
|
|
94
|
+
real = worktree._run
|
|
95
|
+
monkeypatch.setattr(worktree, "_run", lambda cmd, cwd: (calls.append(cmd), real(cmd, cwd))[1])
|
|
96
|
+
monkeypatch.chdir(repo / "app")
|
|
97
|
+
worktree.create("feat", base="main")
|
|
98
|
+
assert ["git", "submodule", "update", "--init"] in calls
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def test_outside_a_git_work_tree_nothing_is_created(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
102
|
+
monkeypatch.chdir(tmp_path)
|
|
103
|
+
with pytest.raises(SystemExit, match="not inside a git work tree"):
|
|
104
|
+
worktree.create("feat", base="main")
|
|
105
|
+
assert not (tmp_path / ".worktrees").exists()
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def test_create_returns_the_folder_it_announces(repo: Path, monkeypatch: pytest.MonkeyPatch) -> None:
|
|
109
|
+
monkeypatch.chdir(repo / "app")
|
|
110
|
+
assert worktree.create("feat", base="main") == repo / "app" / ".worktrees" / "feat" / "app"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/usage/sql/01_ingest_claude.sql
RENAMED
|
File without changes
|
{bmsdna_devtools-1.1.0 → bmsdna_devtools-1.1.1}/bmsdna/devtools/usage/sql/01_ingest_codex.sql
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|