mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-08 21:48:08 +00:00
revset: add explicit RevsetExpression::All variant
This isn't strictly necessary, but is useful while getting rid of redundant 'all() &' expression.
This commit is contained in:
parent
4337a997cf
commit
cfae28575b
1 changed files with 7 additions and 1 deletions
|
@ -217,6 +217,7 @@ pub enum RevsetFilterPredicate {
|
||||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||||
pub enum RevsetExpression {
|
pub enum RevsetExpression {
|
||||||
None,
|
None,
|
||||||
|
All,
|
||||||
Commits(Vec<CommitId>),
|
Commits(Vec<CommitId>),
|
||||||
Symbol(String),
|
Symbol(String),
|
||||||
Parents(Rc<RevsetExpression>),
|
Parents(Rc<RevsetExpression>),
|
||||||
|
@ -256,7 +257,7 @@ impl RevsetExpression {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn all() -> Rc<RevsetExpression> {
|
pub fn all() -> Rc<RevsetExpression> {
|
||||||
RevsetExpression::visible_heads().ancestors()
|
Rc::new(RevsetExpression::All)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn symbol(value: String) -> Rc<RevsetExpression> {
|
pub fn symbol(value: String) -> Rc<RevsetExpression> {
|
||||||
|
@ -1164,6 +1165,11 @@ pub fn evaluate_expression<'repo>(
|
||||||
RevsetExpression::None => Ok(Box::new(EagerRevset {
|
RevsetExpression::None => Ok(Box::new(EagerRevset {
|
||||||
index_entries: vec![],
|
index_entries: vec![],
|
||||||
})),
|
})),
|
||||||
|
RevsetExpression::All => evaluate_expression(
|
||||||
|
repo,
|
||||||
|
&RevsetExpression::visible_heads().ancestors(),
|
||||||
|
workspace_ctx,
|
||||||
|
),
|
||||||
RevsetExpression::Commits(commit_ids) => Ok(revset_for_commit_ids(repo, commit_ids)),
|
RevsetExpression::Commits(commit_ids) => Ok(revset_for_commit_ids(repo, commit_ids)),
|
||||||
RevsetExpression::Symbol(symbol) => {
|
RevsetExpression::Symbol(symbol) => {
|
||||||
let commit_ids = resolve_symbol(repo, symbol, workspace_ctx.map(|c| c.workspace_id))?;
|
let commit_ids = resolve_symbol(repo, symbol, workspace_ctx.map(|c| c.workspace_id))?;
|
||||||
|
|
Loading…
Reference in a new issue