ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/cli
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
..
examples backend: move constant functions first 2023-09-19 05:24:51 -07:00
src cli: make set of immutable commits configurable 2023-09-25 15:41:45 -07:00
testing fake_diff_editor: Allow specifying extra arguments to be ignored 2023-08-21 20:19:15 -07:00
tests cli: make set of immutable commits configurable 2023-09-25 15:41:45 -07:00
build.rs
Cargo.toml cargo: make jj installable with cargo binstall 2023-09-20 09:35:18 -07:00
LICENSE cargo: add LICENSE file to each crate we publish 2023-09-22 21:48:28 -07:00