revset: simplify evaluation of "all()"

I think this is more readable, and apparently it produces slightly better code
maybe because the compiler can determine that there are no unwanted markers.
This commit is contained in:
Yuya Nishihara 2023-04-03 12:12:40 +09:00
parent 0bfdbcaa1e
commit 426f3e4e0a

View File

@ -549,7 +549,8 @@ impl<'index, 'heads> EvaluationContext<'index, 'heads> {
// (and `remote_branches()`) specified in the revset expression. Alternatively, // (and `remote_branches()`) specified in the revset expression. Alternatively,
// some optimization rules could be removed, but that means `author(_) & x` // some optimization rules could be removed, but that means `author(_) & x`
// would have to test `:heads() & x`. // would have to test `:heads() & x`.
self.evaluate(&RevsetExpression::visible_heads().ancestors()) let walk = self.composite_index.walk_revs(self.visible_heads, &[]);
Ok(Box::new(RevWalkRevset { walk }))
} }
RevsetExpression::Commits(commit_ids) => Ok(self.revset_for_commit_ids(commit_ids)), RevsetExpression::Commits(commit_ids) => Ok(self.revset_for_commit_ids(commit_ids)),
RevsetExpression::Children(roots) => { RevsetExpression::Children(roots) => {