forked from mirrors/jj
revset: extract unresolved commit references to separate enum
This makes it clear what should be resolved at resolve_symbols(). Symbol is a bit special while parsing function arguments, but it's no different than the other unresolved references at expression level.
This commit is contained in:
parent
fc65b00020
commit
6d9b836d10
3 changed files with 402 additions and 231 deletions
|
@ -574,13 +574,7 @@ impl<'index, 'heads> EvaluationContext<'index, 'heads> {
|
|||
expression: &RevsetExpression,
|
||||
) -> Result<Box<dyn InternalRevset<'index> + 'index>, RevsetEvaluationError> {
|
||||
match expression {
|
||||
RevsetExpression::Symbol(_)
|
||||
| RevsetExpression::Branches(_)
|
||||
| RevsetExpression::RemoteBranches { .. }
|
||||
| RevsetExpression::Tags
|
||||
| RevsetExpression::GitRefs
|
||||
| RevsetExpression::GitHead
|
||||
| RevsetExpression::Present(_) => {
|
||||
RevsetExpression::CommitRef(_) | RevsetExpression::Present(_) => {
|
||||
panic!("Expression '{expression:?}' should have been resolved by caller");
|
||||
}
|
||||
RevsetExpression::None => Ok(Box::new(EagerRevset::empty())),
|
||||
|
@ -740,7 +734,7 @@ impl<'index, 'heads> EvaluationContext<'index, 'heads> {
|
|||
RevsetExpression::None
|
||||
| RevsetExpression::All
|
||||
| RevsetExpression::Commits(_)
|
||||
| RevsetExpression::Symbol(_)
|
||||
| RevsetExpression::CommitRef(_)
|
||||
| RevsetExpression::Children(_)
|
||||
| RevsetExpression::Ancestors { .. }
|
||||
| RevsetExpression::Range { .. }
|
||||
|
@ -748,11 +742,6 @@ impl<'index, 'heads> EvaluationContext<'index, 'heads> {
|
|||
| RevsetExpression::Heads(_)
|
||||
| RevsetExpression::Roots(_)
|
||||
| RevsetExpression::VisibleHeads
|
||||
| RevsetExpression::Branches(_)
|
||||
| RevsetExpression::RemoteBranches { .. }
|
||||
| RevsetExpression::Tags
|
||||
| RevsetExpression::GitRefs
|
||||
| RevsetExpression::GitHead
|
||||
| RevsetExpression::Latest { .. } => Ok(self.evaluate(expression)?.into_predicate()),
|
||||
RevsetExpression::Filter(predicate) => Ok(build_predicate_fn(
|
||||
self.store.clone(),
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -31,12 +31,12 @@ fn test_debug_revset() {
|
|||
]}, {
|
||||
assert_snapshot!(stdout, @r###"
|
||||
-- Parsed:
|
||||
Symbol(
|
||||
CommitRef(
|
||||
..
|
||||
)
|
||||
|
||||
-- Optimized:
|
||||
Symbol(
|
||||
CommitRef(
|
||||
..
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue