test-debugrevset: fix debugruntest compat

Summary:
The test requires the Rust implementation of `debugrevset`. However by setting
`workingcopy.use-rust` to False (default) the `clidispatch` would request
falling back to a Python implementation of `debugrevset`, which does not exist.

Fix it by setting `workingcopy.use-rust` to True. We should make sure
`run-tests.py` and `debugruntest` has a same view of default hgrc. But that
is a potentially breaking change and would be done separately.

Reviewed By: zzl0

Differential Revision: D42825820

fbshipit-source-id: db537c0226d205f9fc5d1a464a6ef4b4d8793185
This commit is contained in:
Jun Wu 2023-02-01 12:05:24 -08:00 committed by Facebook GitHub Bot
parent 6f940d0d4c
commit 065cbf8e8e
4 changed files with 13 additions and 2 deletions

View File

@ -1141,6 +1141,12 @@ def _dispatch(req):
msg = _formatargs(fullargs)
with perftrace.trace("Main Python Command"):
repo = None
# Right now Rust `hgcommands` (undesirably) sets `func` to the
# command description, not a callable function.
if not callable(func):
raise error.ProgrammingError(
f"'{cmd}' only has a Rust implementation but it wants to fallback to Python."
)
if func.cmdtemplate:
templ = cmdtemplatestate(ui, cmdoptions)
args.insert(0, templ)

View File

@ -406,6 +406,7 @@ impl Dispatcher {
let res = || -> Result<u8> {
add_global_flag_derived_configs(&mut self.optional_repo, parsed.clone().try_into()?);
tracing::debug!("command handled by a Rust function");
match handler.func() {
CommandFunc::Repo(f) => f(parsed, io, self.repo_mut()?),
CommandFunc::OptionalRepo(f) => f(parsed, io, &mut self.optional_repo),
@ -416,6 +417,9 @@ impl Dispatcher {
CommandFunc::WorkingCopy(f) => {
let repo = self.repo_mut()?;
if !repo.config().get_or_default("workingcopy", "use-rust")? {
tracing::warn!(
"command requires working copy but Rust working copy is disabled"
);
// TODO(T131699257): Migrate all tests to use Rust
// workingcopy and removed fallback to Python.
return Err(errors::FallbackToPython("requested command that uses working copy but workingcopy.use-rust not set to True".to_owned()).into());

View File

@ -1,6 +1,7 @@
#chg-compatible
#debugruntest-compatible
$ configure modern
$ setconfig workingcopy.use-rust=True
Setup repo:
$ newclientrepo repo1

View File

@ -184,7 +184,7 @@ Read file content:
Make a commit on tip, and amend. They do not trigger remote lookups:
$ echo Z > Z
$ LOG=warn hg up -q tip
$ LOG=error hg up -q tip
$ LOG=dag::protocol=debug,dag::cache=trace hg commit -Am Z Z
TRACE dag::cache: cached missing ae226a63078b2a472fa38ec61318bb37e8c10bfb (definitely missing)
DEBUG dag::cache: reusing cache (1 missing)