Skip to content

Commit

Permalink
Speedup opam list on options that do not use availibility information
Browse files Browse the repository at this point in the history
  • Loading branch information
kit-ty-kate committed Aug 8, 2024
1 parent fb73900 commit 38c333d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ users)

## List
* ◈ Add a new `--latests-only` option to only list the latest packages [#5375 @kit-ty-kate]
* Speedup `opam list` on options that do not use availibility information [#5317 @kit-ty-kate - fix #5314]

## Show

Expand Down
25 changes: 24 additions & 1 deletion src/client/opamCommands.ml
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,30 @@ let list ?(force_search=false) cli =
let results =
OpamListCommand.filter ~base:all st filter
in
if not no_depexts && not silent then
let uses_depexts = function
| OpamListCommand.Any
| OpamListCommand.Installed
| OpamListCommand.Root
| OpamListCommand.Compiler
| OpamListCommand.Pinned
| OpamListCommand.Latests_only
| OpamListCommand.Pattern _
| OpamListCommand.Atoms _
| OpamListCommand.Flag _
| OpamListCommand.Tag _
| OpamListCommand.From_repository _
| OpamListCommand.Owns_file _
-> false
| OpamListCommand.Available
| OpamListCommand.Installable
| OpamListCommand.Depends_on _
| OpamListCommand.Required_by _
| OpamListCommand.Conflicts_with _
| OpamListCommand.Coinstallable_with _
| OpamListCommand.Solution _
-> true
in
if not no_depexts && not silent && OpamFormula.exists uses_depexts state_selector then
(let drop_by_depexts =
List.fold_left (fun missing str ->
let is_missing pkgs =
Expand Down

0 comments on commit 38c333d

Please sign in to comment.