Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: include untracked remote branches in default immutable_heads() #4083

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
* `jj backout --revision` has been renamed to `jj backout --revisions`.
The short alias `-r` is still supported.

* [The default `immutable_heads()` set](docs/config.md#set-of-immutable-commits)
yuja marked this conversation as resolved.
Show resolved Hide resolved
now includes `untracked_remote_branches()` with the assumption that untracked
branches aren't managed by you. Therefore, untracked branches are no longer
displayed in `jj log` by default.

### Deprecations

### New features
Expand Down
2 changes: 1 addition & 1 deletion cli/src/config-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@
"immutable_heads()": {
"type": "string",
"description": "Revisions to consider immutable. Ancestors of these are also considered immutable. The root commit is always considered immutable.",
"default": "trunk() | tags()"
"default": "trunk() | tags() | untracked_remote_branches()"
}
},
"additionalProperties": {
Expand Down
2 changes: 1 addition & 1 deletion cli/src/config/revsets.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ latest(
)
'''

'immutable_heads()' = 'trunk() | tags()'
'immutable_heads()' = 'trunk() | tags() | untracked_remote_branches()'
'immutable()' = '::(immutable_heads() | root())'
'mutable()' = '~immutable()'
8 changes: 4 additions & 4 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,10 @@ diff-invocation-mode = "file-by-file"

### Set of immutable commits

You can configure the set of immutable commits via `revset-aliases."immutable_heads()"`.
The default set of immutable heads is `trunk() | tags()`. For example, to
prevent rewriting commits on `main@origin` and commits authored by other
users:
You can configure the set of immutable commits via
`revset-aliases."immutable_heads()"`. The default set of immutable heads is
`trunk() | tags() | untracked_remote_branches()`. For example, to prevent
rewriting commits on `main@origin` and commits authored by other users:

```toml
# The `main.. &` bit is an optimization to scan for non-`mine()` commits only
Expand Down
7 changes: 0 additions & 7 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,6 @@ installer options are fine), clone the repository, and use `cargo build`
`cargo test --workspace`. If you are preparing a PR, there are some additional
recommended steps.

You will probably also want to make the `gh-pages` branch immutable (and thereby
hidden from the default `jj log` output) by running the following in your repo:

```shell
jj config set --repo "revset-aliases.'immutable_heads()'" 'remote_branches(exact:"main") | remote_branches(exact:"gh-pages")'
```

### Summary

One-time setup:
Expand Down
3 changes: 2 additions & 1 deletion docs/revsets.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,8 @@ for a comprehensive list.
'trunk()' = 'your-branch@your-remote'
```

* `immutable_heads()`: Resolves to `trunk() | tags()` by default. See
* `immutable_heads()`: Resolves to `trunk() | tags() |
untracked_remote_branches()` by default. See
[here](config.md#set-of-immutable-commits) for details.

* `immutable()`: The set of commits that `jj` treats as immutable. This is
Expand Down