feat(promote): complete pending promotion files#15338
Conversation
2eb5185 to
29ed71c
Compare
70f6fab to
c1b5fe8
Compare
|
Tested locally on bash and zsh and it doesn't seem to work, is there some additional setup needed to get this working? |
|
@ElectreAAS There should be no additional setup needed. The usual setup from #14779 should be enough. For |
c1b5fe8 to
e99306b
Compare
|
We tested this today, and a problem that popped up is the following: |
I think I've found the culprit for this: #6160 (comment) :) |
e99306b to
cf73d01
Compare
This one actually has an easy fix on bash: will allow it to work with any binary name you want. We should document this in the man page and work out what needs to be done for the other shells. |
I think that the bug is really that |
cf73d01 to
5a13ff0
Compare
5a13ff0 to
e511dd9
Compare
…ands
Promotion subcommands (apply/diff/list/show) don't build anything: they
read the [.to-promote] db and copy files between the build dir and the
source tree. Adopt the canonical shape for "workspace-aware, non-building,
may-fire-RPC" commands used by ~15 other commands (rpc/*, pkg/*, monitor,
merlin, install, etc.):
let common, config =
builder
|> Common.Builder.forbid_builds
|> Common.Builder.disable_log_file
|> Common.init
- `forbid_builds` tells `Common.init` to skip the RPC-with-builds server
setup and suppresses "Entering directory" messages.
- `disable_log_file` skips the trace-file init that would otherwise
acquire the global build-dir lock and mkdir `_build/` as a side effect
(which broke tab-completion in workspaces without a `_build/` dir).
Also removes the one-off `Common.Builder.set_no_build` helper, which was
added specifically for `Apply.promote_term` (the alias for `dune promote`)
and had no other callers. The alias now uses `Apply.term` directly, and
both `dune promote` and `dune promotion apply` share the same wide CLI
surface (`--root`, `--build-dir`, `--trace-file`, ...) matching what
`dune promotion apply` already accepted.
Signed-off-by: Ali Caglayan <alizter@gmail.com>
e511dd9 to
d842c19
Compare
`dune promote <TAB>` now completes against the entries in the build dir's `.to-promote` db instead of falling back to no completion at all. Adds a `promote_file` cmdliner conv in `bin/promotion.ml` whose completion func takes `Common.Builder.term` as the cmdliner context, runs the same `init_no_build` the runtime does (so `--root`, `--build-dir` etc. are honoured, and there's no `_build/` mkdir or trace-file rewrite per tab), and emits sorted cwd-relative paths via `Path.reach` so candidates display the same way the user would type them. Adds a `dune_complete` helper in `test/blackbox-tests/setup-script.sh` that drives the `--__complete` protocol and filters the Values group, along with cram coverage for empty/prefix/no-match tokens, already-typed positional args, `--build-dir`, and `--root`. Signed-off-by: Ali Caglayan <alizter@gmail.com>
d842c19 to
1e9a93e
Compare
dune promote <TAB>now completes against the entries in the build dir's.to-promotedb instead of falling back to no completion at all.Adds a
promote_filecmdliner conv inbin/promotion.mlwhose completion func takesCommon.Builder.termas the cmdliner context, runsCommon.initto set up the workspace exactly as the run path does (so--rootand--build-dirare honoured rather than hardcoded), and emits sorted cwd-relative paths viaPath.reachso candidates display the same way the user would type them.Adds a
dune_completehelper intest/blackbox-tests/setup-script.shthat drives the--__completeprotocol and filters the Values group, along with cram coverage for empty/prefix/no-match tokens, the outside-workspace case,--build-dir, and--root(viadune promotion apply, since thedune promotealias currently usesCommon.No_build.termand so doesn't accept--root).