diff --git a/lib/src/revset.rs b/lib/src/revset.rs index 669d8f88ca..04e267cb6e 100644 --- a/lib/src/revset.rs +++ b/lib/src/revset.rs @@ -444,6 +444,15 @@ impl RevsetExpression { }) } + /// Ancestors of `self`, including `self` until `generation` back. + pub fn ancestors_at(self: &Rc, generation: u64) -> Rc { + Rc::new(RevsetExpression::Ancestors { + heads: self.clone(), + generation: generation..(generation + 1), + is_legacy: false, + }) + } + /// Children of `self`. pub fn children(self: &Rc) -> Rc { Rc::new(RevsetExpression::Descendants { @@ -469,6 +478,15 @@ impl RevsetExpression { }) } + /// Descendants of `self`, including `self` until `generation` ahead. + pub fn descendants_at(self: &Rc, generation: u64) -> Rc { + Rc::new(RevsetExpression::Descendants { + roots: self.clone(), + generation: generation..(generation + 1), + is_legacy: false, + }) + } + /// Commits that are descendants of `self` and ancestors of `heads`, both /// inclusive. pub fn dag_range_to(