mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-14 00:24:36 +00:00
revset: remove public_heads()
The `public_heads()` revset only contains the root commit in practice. I'm not sure what we want to do about phases, but since we don't have any real support for them yet, let's just remove this revset. I didn't update the changelog because we don't seem to have documented the revset function (and it seems unlikely that users who found out about it found it useful enough to use it when they could just use `root`).
This commit is contained in:
parent
2a3d402d0c
commit
3ff1ab520b
3 changed files with 0 additions and 47 deletions
|
@ -612,10 +612,6 @@ fn internal_evaluate<'index>(
|
|||
}
|
||||
Ok(Box::new(EagerRevset { index_entries }))
|
||||
}
|
||||
RevsetExpression::PublicHeads => Ok(revset_for_commit_ids(
|
||||
repo,
|
||||
&repo.view().public_heads().iter().cloned().collect_vec(),
|
||||
)),
|
||||
RevsetExpression::Latest { candidates, count } => {
|
||||
let candidate_set = internal_evaluate(repo, candidates)?;
|
||||
Ok(take_latest_revset(repo, candidate_set.as_ref(), *count))
|
||||
|
|
|
@ -223,7 +223,6 @@ pub enum RevsetExpression {
|
|||
Heads(Rc<RevsetExpression>),
|
||||
Roots(Rc<RevsetExpression>),
|
||||
VisibleHeads,
|
||||
PublicHeads,
|
||||
Branches(String),
|
||||
RemoteBranches {
|
||||
branch_needle: String,
|
||||
|
@ -271,10 +270,6 @@ impl RevsetExpression {
|
|||
Rc::new(RevsetExpression::VisibleHeads)
|
||||
}
|
||||
|
||||
pub fn public_heads() -> Rc<RevsetExpression> {
|
||||
Rc::new(RevsetExpression::PublicHeads)
|
||||
}
|
||||
|
||||
pub fn branches(needle: String) -> Rc<RevsetExpression> {
|
||||
Rc::new(RevsetExpression::Branches(needle))
|
||||
}
|
||||
|
@ -803,10 +798,6 @@ static BUILTIN_FUNCTION_MAP: Lazy<HashMap<&'static str, RevsetFunction>> = Lazy:
|
|||
let candidates = parse_expression_rule(arg.into_inner(), state)?;
|
||||
Ok(candidates.roots())
|
||||
});
|
||||
map.insert("public_heads", |name, arguments_pair, _state| {
|
||||
expect_no_arguments(name, arguments_pair)?;
|
||||
Ok(RevsetExpression::public_heads())
|
||||
});
|
||||
map.insert("branches", |name, arguments_pair, state| {
|
||||
let ([], [opt_arg]) = expect_arguments(name, arguments_pair)?;
|
||||
let needle = if let Some(arg) = opt_arg {
|
||||
|
@ -1154,7 +1145,6 @@ fn try_transform_expression_bottom_up(
|
|||
RevsetExpression::Roots(candidates) => {
|
||||
transform_rec(candidates, f)?.map(RevsetExpression::Roots)
|
||||
}
|
||||
RevsetExpression::PublicHeads => None,
|
||||
RevsetExpression::Branches(_) => None,
|
||||
RevsetExpression::RemoteBranches { .. } => None,
|
||||
RevsetExpression::Tags => None,
|
||||
|
|
|
@ -1192,39 +1192,6 @@ fn test_evaluate_expression_visible_heads(use_git: bool) {
|
|||
);
|
||||
}
|
||||
|
||||
#[test_case(false ; "local backend")]
|
||||
#[test_case(true ; "git backend")]
|
||||
fn test_evaluate_expression_public_heads(use_git: bool) {
|
||||
let settings = testutils::user_settings();
|
||||
let test_repo = TestRepo::init(use_git);
|
||||
let repo = &test_repo.repo;
|
||||
|
||||
let root_commit = repo.store().root_commit();
|
||||
let mut tx = repo.start_transaction(&settings, "test");
|
||||
let mut_repo = tx.mut_repo();
|
||||
let mut graph_builder = CommitGraphBuilder::new(&settings, mut_repo);
|
||||
let commit1 = graph_builder.initial_commit();
|
||||
let commit2 = graph_builder.initial_commit();
|
||||
|
||||
// Can get public heads with root commit as only public head
|
||||
assert_eq!(
|
||||
resolve_commit_ids(mut_repo, "public_heads()"),
|
||||
vec![root_commit.id().clone()]
|
||||
);
|
||||
// Can get public heads with a single public head
|
||||
mut_repo.add_public_head(&commit1);
|
||||
assert_eq!(
|
||||
resolve_commit_ids(mut_repo, "public_heads()"),
|
||||
vec![commit1.id().clone()]
|
||||
);
|
||||
// Can get public heads with multiple public head
|
||||
mut_repo.add_public_head(&commit2);
|
||||
assert_eq!(
|
||||
resolve_commit_ids(mut_repo, "public_heads()"),
|
||||
vec![commit2.id().clone(), commit1.id().clone()]
|
||||
);
|
||||
}
|
||||
|
||||
#[test_case(false ; "local backend")]
|
||||
#[test_case(true ; "git backend")]
|
||||
fn test_evaluate_expression_git_refs(use_git: bool) {
|
||||
|
|
Loading…
Reference in a new issue