ok/jj
1
0
Fork 0
forked from mirrors/jj

cli: rename ui.default-revset to revsets.log

I plan to add `revsets.short-prefixes` and `revsets.immutable` soon,
and I think `[revsets]` seems like reasonable place to put them. It
seems consistent with our `[templates]` section. However, it also
suffers from the same problem as that section, which is that the
difference between `[templates]` and `[template-aliases]` is not
clear. We can decide about about templates and revsets later.
This commit is contained in:
Martin von Zweigbergk 2023-05-10 23:26:23 -07:00 committed by Martin von Zweigbergk
parent 0a51c5fc2e
commit ac31c83e13
6 changed files with 37 additions and 13 deletions

View file

@ -27,6 +27,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
without arguments is now called `visible_heads()`. `heads()` with one argument
is unchanged.
* The `ui.default-revset` config was renamed to `revsets.log`.
### New features
* `jj git push --deleted` will remove all locally deleted branches from the remote.

View file

@ -141,6 +141,15 @@ ui.default-command = "log"
ui.diff.format = "git"
```
### Default revisions to log
You can configure the revisions `jj log` without `-r` should show.
```toml
# Show commits that are not in `main`
revsets.log = "main.."
```
### Graph style
```toml

View file

@ -136,11 +136,15 @@ impl UserSettings {
}
pub fn default_revset(&self) -> String {
self.config
.get_string("ui.default-revset")
.unwrap_or_else(|_| {
"@ | (remote_branches() | tags()).. | ((remote_branches() | tags())..)-".to_string()
})
self.config.get_string("revsets.log").unwrap_or_else(|_| {
// For compatibility with old config files (<0.8.0)
self.config
.get_string("ui.default-revset")
.unwrap_or_else(|_| {
"@ | (remote_branches() | tags()).. | ((remote_branches() | tags())..)-"
.to_string()
})
})
}
pub fn signature(&self) -> Signature {

View file

@ -328,7 +328,7 @@ struct StatusArgs {}
/// Show commit history
#[derive(clap::Args, Clone, Debug)]
struct LogArgs {
/// Which revisions to show. Defaults to the `ui.default-revset` setting,
/// Which revisions to show. Defaults to the `revsets.log` setting,
/// or `@ | (remote_branches() | tags()).. | ((remote_branches() |
/// tags())..)-` if it is not set.
#[arg(long, short)]

View file

@ -56,11 +56,6 @@
"description": "Default command to run when no explicit command is given",
"default": "log"
},
"default-revset": {
"type": "string",
"description": "Default set of revisions to show when no explicit revset is given for jj log and similar commands",
"default": "@ | (remote_branches() | tags()).. | ((remote_branches() | tags())..)-"
},
"color": {
"description": "Whether to colorize command output",
"enum": [
@ -267,6 +262,20 @@
}
}
},
"revsets": {
"type": "object",
"description": "Revset expressions used by various commands",
"properties": {
"log": {
"type": "string",
"description": "Default set of revisions to show when no explicit revset is given for jj log and similar commands",
"default": "@ | (remote_branches() | tags()).. | ((remote_branches() | tags())..)-"
}
},
"additionalProperties": {
"type": "string"
}
},
"revset-aliases": {
"type": "object",
"description": "Custom symbols/function aliases that can used in revset expressions",

View file

@ -788,7 +788,7 @@ fn test_default_revset() {
test_env.jj_cmd_success(&repo_path, &["describe", "-m", "add a file"]);
// Set configuration to only show the root commit.
test_env.add_config(r#"ui.default-revset = "root""#);
test_env.add_config(r#"revsets.log = "root""#);
// Log should only contain one line (for the root commit), and not show the
// commit created above.
@ -813,7 +813,7 @@ fn test_default_revset_per_repo() {
// Set configuration to only show the root commit.
std::fs::write(
repo_path.join(".jj/repo/config.toml"),
r#"ui.default-revset = "root""#,
r#"revsets.log = "root""#,
)
.unwrap();