jj/cli/tests
Jonathan Tan 0bc1341fd0 revset: add count_estimate() to Revset trait
The count() function in this trait is used by "jj branch" to determine
(and then report) how many commits a certain branch is ahead/behind
another branch. This is currently implemented by walking all commits
in the revset, counting how many were encountered. But this could be
improved: if the number is large, it is probably sufficient to report
"at least N" (instead of walking all the way), and this does not scale
well to jj backends that may not have all commits present locally (which
may prefer to return an estimate, rather than access the network).

Therefore, add a function that is explicitly documented to be O(1)
and that can return a range of values if the backend so chooses.

Also remove count(), as it is not immediately obvious that it is an
expensive call, and callers that are willing to pay the cost can obtain
the exact same functionality through iter().count() anyway. (In this
commit, all users of count() are migrated to iter().count() to preserve
all existing functionality; they will be migrated to count_estimate() in
a subsequent commit.)

"branch" needed to be updated due to this change. Although jj
is currently only available in English, I have attempted to keep
user-visible text from being assembled piece by piece, so that if we
later decide to translate jj into other languages, things will be easier
for translators.
2024-01-22 15:07:00 -08:00
..
common testing: allow testing of commands that expect stdin 2024-01-22 13:58:45 -08:00
test_abandon_command.rs test_abandon_command: create another test for bug 2600 2023-12-01 17:03:44 -08:00
test_alias.rs cli: don't panic on empty alias substitution 2023-12-24 23:31:28 +09:00
test_branch_command.rs revset: add count_estimate() to Revset trait 2024-01-22 15:07:00 -08:00
test_builtin_aliases.rs tests: set git_settings.auto_local_branch where it matters 2023-12-17 08:30:24 +09:00
test_cat_command.rs tests: replace jj_cmd_success() involving mutation to allow stderr output 2023-10-11 19:24:01 +09:00
test_checkout.rs cli templates: include info on divergent change ids in short commit template 2023-10-26 17:58:13 -07:00
test_chmod_command.rs cli: print a hint about how to resolve conflicts 2023-12-10 12:44:57 -08:00
test_commit_command.rs clippy: fix new issues spotted by nightly version 2023-11-16 10:20:07 -08:00
test_commit_template.rs cli: include branches and tags in default "show" template 2024-01-11 15:47:09 +09:00
test_concurrent_operations.rs cli: give root operation special treatment in template (like root commit) 2024-01-14 10:15:14 -08:00
test_config_command.rs Support --user and --repo argument for config list command 2024-01-17 11:19:23 -08:00
test_debug_command.rs op_store: add a virtual root operation, similar to root commit 2024-01-14 10:15:14 -08:00
test_describe_command.rs clippy: run cargo clippy --fix --workspace with recent nightly 2023-10-29 20:19:44 -07:00
test_diff_command.rs clippy: fix new issues spotted by nightly version 2023-11-16 10:20:07 -08:00
test_diffedit_command.rs cli: send status messages to stderr, specify stdout/stderr explicitly 2023-10-11 19:24:01 +09:00
test_duplicate_command.rs cli: send status messages to stderr, specify stdout/stderr explicitly 2023-10-11 19:24:01 +09:00
test_edit_command.rs git_backend: replace git2::Repository with gix::Repository 2023-11-02 19:33:06 +09:00
test_git_clone.rs tests: set git_settings.auto_local_branch where it matters 2023-12-17 08:30:24 +09:00
test_git_colocated.rs tests: set git_settings.auto_local_branch where it matters 2023-12-17 08:30:24 +09:00
test_git_fetch.rs git: turn git.auto-local-branch off by default 2023-12-17 08:30:24 +09:00
test_git_import_export.rs object_id: make ObjectId constructors non-trait methods 2024-01-05 23:36:57 +09:00
test_git_push.rs tests: set git_settings.auto_local_branch where it matters 2023-12-17 08:30:24 +09:00
test_git_remotes.rs tests: don't create new branch by "jj branch set" 2023-11-11 07:03:31 +09:00
test_git_submodule.rs tests: replace jj_cmd_success() involving mutation to allow stderr output 2023-10-11 19:24:01 +09:00
test_gitignores.rs cli: send status messages to stderr, specify stdout/stderr explicitly 2023-10-11 19:24:01 +09:00
test_global_opts.rs cli: error out early if -R path is invalid 2023-12-24 00:20:38 +09:00
test_immutable_commits.rs immutable commits: remove the hint if trying to edit the root commit 2023-10-29 21:13:39 -07:00
test_init_command.rs tests: set git_settings.auto_local_branch where it matters 2023-12-17 08:30:24 +09:00
test_interdiff_command.rs tests: replace jj_cmd_success() involving mutation to allow stderr output 2023-10-11 19:24:01 +09:00
test_log_command.rs tests: don't create new branch by "jj branch set" 2023-11-11 07:03:31 +09:00
test_move_command.rs cli: send status messages to stderr, specify stdout/stderr explicitly 2023-10-11 19:24:01 +09:00
test_new_command.rs cli new: have --no-edit print description of the new commit 2023-11-23 11:15:38 -08:00
test_next_prev_commands.rs next: support prompting for ambiguous commit targets 2024-01-22 13:58:45 -08:00
test_obslog_command.rs tests: replace jj_cmd_success() involving mutation to allow stderr output 2023-10-11 19:24:01 +09:00
test_operations.rs cli: give root operation special treatment in template (like root commit) 2024-01-14 10:15:14 -08:00
test_rebase_command.rs cli rebase: tests for weird ancestry for -s and -b 2023-11-28 21:36:51 -08:00
test_repo_change_report.rs cli: print a hint about how to resolve conflicts 2023-12-10 12:44:57 -08:00
test_resolve_command.rs cli: print a hint about how to resolve conflicts 2023-12-10 12:44:57 -08:00
test_restore_command.rs cli: print a hint about how to resolve conflicts 2023-12-10 12:44:57 -08:00
test_revset_output.rs tests: replace jj_cmd_success() involving mutation to allow stderr output 2023-10-11 19:24:01 +09:00
test_show_command.rs tests: replace jj_cmd_success() involving mutation to allow stderr output 2023-10-11 19:24:01 +09:00
test_sparse_command.rs cli: send status messages to stderr, specify stdout/stderr explicitly 2023-10-11 19:24:01 +09:00
test_split_command.rs test_split_command: check that new commits inherit author dates 2023-12-24 19:25:16 -08:00
test_squash_command.rs cli: send status messages to stderr, specify stdout/stderr explicitly 2023-10-11 19:24:01 +09:00
test_status_command.rs tests: replace jj_cmd_success() involving mutation to allow stderr output 2023-10-11 19:24:01 +09:00
test_tag_command.rs Implement tag command. 2024-01-22 09:23:18 -08:00
test_templater.rs tests: migrate most tests from test_templater.rs 2023-10-27 05:30:53 +09:00
test_tree_level_conflicts.rs tests: replace jj_cmd_success() involving mutation to allow stderr output 2023-10-11 19:24:01 +09:00
test_undo.rs cli: remove weird line break from the "jj branch forget" hint 2023-12-16 07:50:15 +09:00
test_unsquash_command.rs cli: send status messages to stderr, specify stdout/stderr explicitly 2023-10-11 19:24:01 +09:00
test_untrack_command.rs tests: replace jj_cmd_success() involving mutation to allow stderr output 2023-10-11 19:24:01 +09:00
test_util_command.rs cli: disallow gc run from non-head operation 2024-01-09 10:37:03 +09:00
test_working_copy.rs tests: replace jj_cmd_success() involving mutation to allow stderr output 2023-10-11 19:24:01 +09:00
test_workspaces.rs op_store: add a virtual root operation, similar to root commit 2024-01-14 10:15:14 -08:00