cli: rewrite "x | x-" in default log revset as "ancestors(x, 2)"

This commit is contained in:
Yuya Nishihara 2023-09-08 08:37:38 +09:00
parent 5fc71018d6
commit 8b825796ff
3 changed files with 4 additions and 8 deletions

View File

@ -354,9 +354,8 @@ struct StatusArgs {}
/// Show commit history
#[derive(clap::Args, Clone, Debug)]
struct LogArgs {
/// Which revisions to show. Defaults to the `revsets.log` setting,
/// or `@ | (remote_branches() | tags()).. | ((remote_branches() |
/// tags())..)-` if it is not set.
/// Which revisions to show. Defaults to the `revsets.log` setting, or
/// `@ | ancestors((remote_branches() | tags()).., 2)` if it is not set.
#[arg(long, short)]
revisions: Vec<RevisionArg>,
/// Show commits modifying the given paths

View File

@ -294,7 +294,7 @@
"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())..)-"
"default": "@ | ancestors((remote_branches() | tags()).., 2)"
},
"short-prefixes": {
"type": "string",

View File

@ -159,10 +159,7 @@ impl UserSettings {
// 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()
})
.unwrap_or_else(|_| "@ | ancestors((remote_branches() | tags()).., 2)".to_string())
})
}