ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/cli/tests
Martin von Zweigbergk a6ef3f0b6c cli: make set of immutable commits configurable
This adds a new `revset-aliases.immutable_heads()s` config for
defining the set of immutable commits. The set is defined as the
configured revset, as well as its ancestors, and the root commit
commit (even if the configured set is empty).

This patch also adds enforcement of the config where we already had
checks preventing rewrite of the root commit. The working-copy commit
is implicitly assumed to be writable in most cases. Specifically, we
won't prevent amending the working copy even if the user includes it
in the config but we do prevent `jj edit @` in that case. That seems
good enough to me. Maybe we should emit a warning when the working
copy is in the set of immutable commits.

Maybe we should add support for something more like [Mercurial's
phases](https://wiki.mercurial-scm.org/Phases), which is propagated on
push and pull. There's already some affordance for that in the view
object's `public_heads` field. However, this is simpler, especially
since we can't propagate the phase to Git remotes, and seems like a
good start. Also, it lets you say that commits authored by other users
are immutable, for example.

For now, the functionality is in the CLI library. I'm not sure if we
want to move it into the library crate. I'm leaning towards letting
library users do whatever they want without being restricted by
immutable commits. I do think we should move the functionality into a
future `ui-lib` or `ui-util` crate. That crate would have most of the
functionality in the current `cli_util` module (but in a
non-CLI-specific form).
2023-09-25 15:41:45 -07:00
..
common cli tests: Move current_operation_id to test_utils 2023-08-22 17:39:56 -07:00
test_abandon_command.rs cli: make set of immutable commits configurable 2023-09-25 15:41:45 -07:00
test_alias.rs commands: Implement next and prev 2023-09-05 23:13:39 +02:00
test_branch_command.rs cli: make set of immutable commits configurable 2023-09-25 15:41:45 -07:00
test_builtin_aliases.rs revsets: add trunk alias with default to main/master/root 2023-09-17 10:17:23 +10:00
test_cat_command.rs tests: move tests/ under cli/ so they're run again 2023-08-05 06:18:59 +00:00
test_checkout.rs cli: hint for same change ids 2023-09-21 22:53:46 -03:00
test_chmod_command.rs revset: convert root symbol to function 2023-09-04 10:36:30 +09:00
test_commit_command.rs cli: add support for setting default description 2023-08-13 23:59:15 +05:30
test_commit_template.rs revset: convert root symbol to function 2023-09-04 10:36:30 +09:00
test_concurrent_operations.rs tests: move tests/ under cli/ so they're run again 2023-08-05 06:18:59 +00:00
test_config_command.rs cleanup: fix warnings from nightly clippy 2023-08-14 22:11:56 -07:00
test_debug_command.rs revset: convert root symbol to function 2023-09-04 10:36:30 +09:00
test_describe_command.rs cli: add support for setting default description 2023-08-13 23:59:15 +05:30
test_diff_command.rs revset: convert root symbol to function 2023-09-04 10:36:30 +09:00
test_diffedit_command.rs merge_tools: Allow 3-pane diff editing 2023-08-21 20:19:15 -07:00
test_duplicate_command.rs cli: jj duplicate should refuse to duplicate only the root commit 2023-09-25 15:41:45 -07:00
test_edit_command.rs cli: make set of immutable commits configurable 2023-09-25 15:41:45 -07:00
test_git_clone.rs cleanup: fix warnings from nightly clippy 2023-08-14 22:11:56 -07:00
test_git_colocated.rs revset: convert root symbol to function 2023-09-04 10:36:30 +09:00
test_git_fetch.rs cli: make set of immutable commits configurable 2023-09-25 15:41:45 -07:00
test_git_import_export.rs cli tests: Move current_operation_id to test_utils 2023-08-22 17:39:56 -07:00
test_git_push.rs cli: make set of immutable commits configurable 2023-09-25 15:41:45 -07:00
test_git_remotes.rs git: prohibit creation of remote named "git" 2023-08-29 22:50:46 +09:00
test_git_submodule.rs tests: move tests/ under cli/ so they're run again 2023-08-05 06:18:59 +00:00
test_gitignores.rs tests: move tests/ under cli/ so they're run again 2023-08-05 06:18:59 +00:00
test_global_opts.rs cli docs: document that --config-toml can be repeated 2023-09-14 18:09:27 -07:00
test_immutable_commits.rs cli: make set of immutable commits configurable 2023-09-25 15:41:45 -07:00
test_init_command.rs revset: convert root symbol to function 2023-09-04 10:36:30 +09:00
test_interdiff_command.rs revset: convert root symbol to function 2023-09-04 10:36:30 +09:00
test_log_command.rs Allow \0 escape for nulls 2023-09-14 17:11:05 -04:00
test_move_command.rs cli templates: include branches in short commit description 2023-08-10 20:58:40 -07:00
test_new_command.rs revset: convert root symbol to function 2023-09-04 10:36:30 +09:00
test_next_prev_commands.rs commands: Implement next and prev 2023-09-05 23:13:39 +02:00
test_obslog_command.rs revset: convert root symbol to function 2023-09-04 10:36:30 +09:00
test_operations.rs Allow \0 escape for nulls 2023-09-14 17:11:05 -04:00
test_rebase_command.rs revset: convert root symbol to function 2023-09-04 10:36:30 +09:00
test_resolve_command.rs merge_tools: create builtin merge editor 2023-09-18 06:33:29 +02:00
test_restore_command.rs cli: make set of immutable commits configurable 2023-09-25 15:41:45 -07:00
test_revset_output.rs revset: translate symbol rules in error message 2023-09-07 15:29:39 +09:00
test_show_command.rs tests: move tests/ under cli/ so they're run again 2023-08-05 06:18:59 +00:00
test_sparse_command.rs tests: move tests/ under cli/ so they're run again 2023-08-05 06:18:59 +00:00
test_split_command.rs cli: when splitting change without description, skip it on second part 2023-08-15 10:12:12 -07:00
test_squash_command.rs cli templates: include branches in short commit description 2023-08-10 20:58:40 -07:00
test_status_command.rs Fix .gitignore handling of ignored directories 2023-08-22 22:08:32 -07:00
test_templater.rs cli: make set of immutable commits configurable 2023-09-25 15:41:45 -07:00
test_tree_level_conflicts.rs revset: convert root symbol to function 2023-09-04 10:36:30 +09:00
test_undo.rs cli: make set of immutable commits configurable 2023-09-25 15:41:45 -07:00
test_unsquash_command.rs cli templates: include branches in short commit description 2023-08-10 20:58:40 -07:00
test_untrack_command.rs tests: move tests/ under cli/ so they're run again 2023-08-05 06:18:59 +00:00
test_util_command.rs tests: move tests/ under cli/ so they're run again 2023-08-05 06:18:59 +00:00
test_working_copy.rs working_copy: in LockedWorkingCopy::drop(), discard unsaved changes 2023-09-01 12:25:47 -07:00
test_workspaces.rs revset: resolve "@" symbol's workspace id earlier (while parsing) 2023-08-20 17:57:18 -07:00