revset: move resolve_symbol() to tests

It's no longer used in library code.
This commit is contained in:
Yuya Nishihara 2023-05-12 16:07:40 +09:00
parent 916b00c33e
commit f58beca760
2 changed files with 12 additions and 11 deletions

View file

@ -1770,14 +1770,6 @@ impl SymbolResolver for DefaultSymbolResolver<'_> {
}
}
pub fn resolve_symbol(
repo: &dyn Repo,
symbol: &str,
workspace_id: Option<&WorkspaceId>,
) -> Result<Vec<CommitId>, RevsetResolutionError> {
DefaultSymbolResolver::new(repo, workspace_id).resolve_symbol(symbol)
}
fn resolve_commit_ref(
repo: &dyn Repo,
commit_ref: &RevsetCommitRef,

View file

@ -24,9 +24,9 @@ use jujutsu_lib::op_store::{RefTarget, WorkspaceId};
use jujutsu_lib::repo::Repo;
use jujutsu_lib::repo_path::RepoPath;
use jujutsu_lib::revset::{
optimize, parse, resolve_symbol, DefaultSymbolResolver, ReverseRevsetGraphIterator, Revset,
RevsetAliasesMap, RevsetExpression, RevsetFilterPredicate, RevsetGraphEdge,
RevsetResolutionError, RevsetWorkspaceContext,
optimize, parse, DefaultSymbolResolver, ReverseRevsetGraphIterator, Revset, RevsetAliasesMap,
RevsetExpression, RevsetFilterPredicate, RevsetGraphEdge, RevsetResolutionError,
RevsetWorkspaceContext, SymbolResolver as _,
};
use jujutsu_lib::settings::GitSettings;
use jujutsu_lib::tree::merge_trees;
@ -36,6 +36,14 @@ use testutils::{
create_random_commit, write_random_commit, CommitGraphBuilder, TestRepo, TestWorkspace,
};
fn resolve_symbol(
repo: &dyn Repo,
symbol: &str,
workspace_id: Option<&WorkspaceId>,
) -> Result<Vec<CommitId>, RevsetResolutionError> {
DefaultSymbolResolver::new(repo, workspace_id).resolve_symbol(symbol)
}
fn revset_for_commits<'index>(
repo: &'index dyn Repo,
commits: &[&Commit],
@ -47,6 +55,7 @@ fn revset_for_commits<'index>(
.evaluate(repo)
.unwrap()
}
#[test_case(false ; "local backend")]
#[test_case(true ; "git backend")]
fn test_resolve_symbol_root(use_git: bool) {