Page MenuHomePhabricator

`arc land` may fail with missing rebase extension
Closed, ResolvedPublic

Description

Running current arc land, I get this locally:

[2021-07-19 09:20:22] EXCEPTION: (CommandException) Command failed with error #255!
COMMAND
hg --encoding utf-8 rebase --dest 162a9c1e8e44c6077c4772e1f3268dca9b1f2953 --rev 409349be71c5dbbcc6af40f928d963b0cd4d8c55..ade642d0c045240f69e86c3a0b2a3baaf8d1f87d --logfile - --keep --collapse

STDOUT
'rebase' is provided by the following extension:

    rebase        command to move sets of revisions to a different ancestor

(use 'hg help extensions' for information on enabling extensions)


STDERR
hg: unknown command 'rebase'
 at [<arcanist>/src/future/exec/ExecFuture.php:421]
arcanist(head=master, ref.master=a43a3a9aabe2, custom=1)
  #0 ExecFuture::raiseResultError(array) called at [<arcanist>/src/future/exec/ExecFuture.php:325]
  #1 ExecFuture::resolvex() called at [<arcanist>/src/land/engine/ArcanistMercurialLandEngine.php:839]
  #2 ArcanistMercurialLandEngine::executeMerge(ArcanistLandCommitSet, string) called at [<arcanist>/src/land/engine/ArcanistLandEngine.php:1248]
  #3 ArcanistLandEngine::execute() called at [<arcanist>/src/workflow/ArcanistLandWorkflow.php:344]
  #4 ArcanistLandWorkflow::runWorkflow(PhutilArgumentParser) called at [<arcanist>/src/workflow/ArcanistWorkflow.php:227]
  #5 ArcanistWorkflow::executeWorkflow(PhutilArgumentParser) called at [<arcanist>/src/toolset/ArcanistPhutilWorkflow.php:21]
  #6 ArcanistPhutilWorkflow::execute(PhutilArgumentParser) called at [<arcanist>/src/parser/argument/PhutilArgumentParser.php:492]
  #7 PhutilArgumentParser::parseWorkflowsFull(array) called at [<arcanist>/src/runtime/ArcanistRuntime.php:171]
  #8 ArcanistRuntime::executeCore(array) called at [<arcanist>/src/runtime/ArcanistRuntime.php:37]
  #9 ArcanistRuntime::execute(array) called at [<arcanist>/support/init/init-arcanist.php:6]
  #10 require_once(string) called at [<arcanist>/bin/arc:10]

This isn't newly-introduced (it reproduces at rARC246e604a, before recent changes) and is likely just an artifact of something in my local environment changing since the last time I ran this workflow. I currently have:

$ hg --version
Mercurial Distributed SCM (version 5.7)
(see https://mercurial-scm.org for more information)

Copyright (C) 2005-2021 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

...which it looks like I just installed from source.

Desired behavior is to either work, or fail with a less-opaque error ("rebase extension is required"). The rebase extension is required. A capability test can be performed through the existing $api->getMercurialFeature(...) API with some additions for the "rebase" extension following in the footsteps of the "shelve" extension, and by adding --config extensions.rebase= to rebase commands, although perhaps we should consider a way to do this automatically or at least less-manually.

Event Timeline

epriestley created this task.

...perhaps we should consider a way to do this automatically or at least less-manually.

We also have this little dance to load arc-hg in a couple of places now:

$argv = array();
foreach ($this->getMercurialExtensionArguments() as $arg) {
  $argv[] = $arg;
}

...so an API like this might be reasonable:

$api->execxLocalWithExtension(
  'rebase',
  'rebase --logfile ...');

$api->execxLocalWithExtension(
  'arc-hg',
  'arc-ls-markers ...');

I like that idea. I'll take a look.

I'm also surprised that rebase extension isn't enabled by default. I guess I have been turning it on in my default setup.

(After picking up D21697, the approach works properly in my environment where I originally ran into this, but there are a couple of rebase calls still present in ArcanistMercurialLandEngine that don't use the new API yet.)

I caught one cosmetic issue in D21711, but this works properly for me locally now. Thanks!