revset: remove None variant from resolved enum, use Commits([]) instead

We'll remove All, so it makes sense to not have None either.
This commit is contained in:
Yuya Nishihara 2023-04-06 16:38:14 +09:00
parent 0fcc13a6f4
commit 7974269bab
2 changed files with 1 additions and 3 deletions

View file

@ -574,7 +574,6 @@ impl<'index, 'heads> EvaluationContext<'index, 'heads> {
expression: &ResolvedExpression, expression: &ResolvedExpression,
) -> Result<Box<dyn InternalRevset<'index> + 'index>, RevsetEvaluationError> { ) -> Result<Box<dyn InternalRevset<'index> + 'index>, RevsetEvaluationError> {
match expression { match expression {
ResolvedExpression::None => Ok(Box::new(EagerRevset::empty())),
ResolvedExpression::All => { ResolvedExpression::All => {
// Since `all()` does not include hidden commits, some of the logical // Since `all()` does not include hidden commits, some of the logical
// transformation rules may subtly change the evaluated set. For example, // transformation rules may subtly change the evaluated set. For example,

View file

@ -460,7 +460,6 @@ pub enum ResolvedPredicateExpression {
/// Use `RevsetExpression` API to build a query programmatically. /// Use `RevsetExpression` API to build a query programmatically.
#[derive(Clone, Debug, Eq, PartialEq)] #[derive(Clone, Debug, Eq, PartialEq)]
pub enum ResolvedExpression { pub enum ResolvedExpression {
None,
All, // TODO: should be substituted at resolve_visibility() All, // TODO: should be substituted at resolve_visibility()
Commits(Vec<CommitId>), Commits(Vec<CommitId>),
Children(Box<ResolvedExpression>), // TODO: add heads: VisibleHeads Children(Box<ResolvedExpression>), // TODO: add heads: VisibleHeads
@ -1816,7 +1815,7 @@ impl VisibilityResolutionContext {
/// Resolves expression tree as set. /// Resolves expression tree as set.
fn resolve(&self, expression: &RevsetExpression) -> ResolvedExpression { fn resolve(&self, expression: &RevsetExpression) -> ResolvedExpression {
match expression { match expression {
RevsetExpression::None => ResolvedExpression::None, RevsetExpression::None => ResolvedExpression::Commits(vec![]),
RevsetExpression::All => self.resolve_all(), RevsetExpression::All => self.resolve_all(),
RevsetExpression::Commits(commit_ids) => { RevsetExpression::Commits(commit_ids) => {
ResolvedExpression::Commits(commit_ids.clone()) ResolvedExpression::Commits(commit_ids.clone())