ok/jj
1
0
Fork 0
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:
Yuya Nishihara 2024-03-14 23:22:48 +09:00
parent 50363419fb
commit f46b738f6e

View file

@ -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 {