forked from mirrors/jj
cli: include root() in the heads node of the immutable set expression
It helps to optimize '~immutable()' to '(immutable_heads() | root())..'.
This commit is contained in:
parent
50363419fb
commit
f46b738f6e
1 changed files with 4 additions and 4 deletions
|
@ -120,10 +120,10 @@ pub fn parse_immutable_expression(
|
|||
params.is_empty(),
|
||||
"invalid declaration should have been rejected by load_revset_aliases()"
|
||||
);
|
||||
let immutable_heads_revset = revset::parse(immutable_heads_str, context)?;
|
||||
Ok(immutable_heads_revset
|
||||
.ancestors()
|
||||
.union(&RevsetExpression::root()))
|
||||
// Negated ancestors expression `~::(<heads> | root())` is slightly easier
|
||||
// to optimize than negated union `~(::<heads> | root())`.
|
||||
let heads = revset::parse(immutable_heads_str, context)?;
|
||||
Ok(heads.union(&RevsetExpression::root()).ancestors())
|
||||
}
|
||||
|
||||
pub fn format_parse_error(err: &RevsetParseError) -> String {
|
||||
|
|
Loading…
Reference in a new issue