mirror of
https://github.com/martinvonz/jj.git
synced 2025-02-11 15:07:06 +00:00
revset: add ancestors_range() method
This commit is contained in:
parent
233b31fdf2
commit
6ea10906a8
1 changed files with 10 additions and 6 deletions
|
@ -524,11 +524,7 @@ impl RevsetExpression {
|
||||||
|
|
||||||
/// Ancestors of `self`, including `self`.
|
/// Ancestors of `self`, including `self`.
|
||||||
pub fn ancestors(self: &Rc<RevsetExpression>) -> Rc<RevsetExpression> {
|
pub fn ancestors(self: &Rc<RevsetExpression>) -> Rc<RevsetExpression> {
|
||||||
Rc::new(RevsetExpression::Ancestors {
|
self.ancestors_range(GENERATION_RANGE_FULL)
|
||||||
heads: self.clone(),
|
|
||||||
generation: GENERATION_RANGE_FULL,
|
|
||||||
is_legacy: false,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
fn legacy_ancestors(self: &Rc<RevsetExpression>) -> Rc<RevsetExpression> {
|
fn legacy_ancestors(self: &Rc<RevsetExpression>) -> Rc<RevsetExpression> {
|
||||||
Rc::new(RevsetExpression::Ancestors {
|
Rc::new(RevsetExpression::Ancestors {
|
||||||
|
@ -540,9 +536,17 @@ impl RevsetExpression {
|
||||||
|
|
||||||
/// Ancestors of `self`, including `self` until `generation` back.
|
/// Ancestors of `self`, including `self` until `generation` back.
|
||||||
pub fn ancestors_at(self: &Rc<RevsetExpression>, generation: u64) -> Rc<RevsetExpression> {
|
pub fn ancestors_at(self: &Rc<RevsetExpression>, generation: u64) -> Rc<RevsetExpression> {
|
||||||
|
self.ancestors_range(generation..(generation + 1))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Ancestors of `self` in the given range.
|
||||||
|
pub fn ancestors_range(
|
||||||
|
self: &Rc<RevsetExpression>,
|
||||||
|
generation_range: Range<u64>,
|
||||||
|
) -> Rc<RevsetExpression> {
|
||||||
Rc::new(RevsetExpression::Ancestors {
|
Rc::new(RevsetExpression::Ancestors {
|
||||||
heads: self.clone(),
|
heads: self.clone(),
|
||||||
generation: generation..(generation + 1),
|
generation: generation_range,
|
||||||
is_legacy: false,
|
is_legacy: false,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue