revset: forward RevsetExpression::parents()/children() to inner functions

This commit is contained in:
Yuya Nishihara 2024-06-07 12:12:03 +09:00
parent 7c9f28a96f
commit 059fc26df1

View file

@ -301,10 +301,7 @@ impl RevsetExpression {
/// Parents of `self`. /// Parents of `self`.
pub fn parents(self: &Rc<RevsetExpression>) -> Rc<RevsetExpression> { pub fn parents(self: &Rc<RevsetExpression>) -> Rc<RevsetExpression> {
Rc::new(RevsetExpression::Ancestors { self.ancestors_at(1)
heads: self.clone(),
generation: 1..2,
})
} }
/// Ancestors of `self`, including `self`. /// Ancestors of `self`, including `self`.
@ -331,10 +328,7 @@ impl RevsetExpression {
/// Children of `self`. /// Children of `self`.
pub fn children(self: &Rc<RevsetExpression>) -> Rc<RevsetExpression> { pub fn children(self: &Rc<RevsetExpression>) -> Rc<RevsetExpression> {
Rc::new(RevsetExpression::Descendants { self.descendants_at(1)
roots: self.clone(),
generation: 1..2,
})
} }
/// Descendants of `self`, including `self`. /// Descendants of `self`, including `self`.