Page MenuHomePhabricator

Landing a mercurial revision which has no changes causes errors on the revision page as well as history viewing
Open, Needs TriagePublic

Description

Okay here's an interesting one I came across...

  1. Create a revision with changes
  2. Modify the local commit to revert the changes, resulting in an empty commit
  3. Notably, arc diff will report a Usage Exception of "no changes found", and not update the diff
  4. However running arc land will result in an exception such that the commit is published, the revision throws an error when attempting to view it, and browsing history results in a different type of error. This lands the local change with it being out of sync from the phabricator revision.
$ hg add
$ hg book test
$ hg ci -m "test commit"
$ arc diff
# fill in details
$ hg revert -r test^ --all
$ hg amend
$ arc diff
# Usage Exception
$ arc land test

Arcanist (while running arc land):

[2021-09-14 21:35:33] EXCEPTION: (CommandException) Command failed with error #255!
COMMAND
hg --encoding utf-8 prune --rev '(fb1b33613c73cf6478efb40c7e2051841f3d87ea::)'

STDOUT
(empty)

STDERR
abort: cannot prune public changesets: fb1b33613c73
(see 'hg help phases' for details)
 at [<arcanist>/src/future/exec/ExecFuture.php:421]
arcanist(head=master, ref.master=d246a0656259, custom=2)
  #0 ExecFuture::raiseResultError(array) called at [<arcanist>/src/future/exec/ExecFuture.php:325]
  #1 ExecFuture::resolvex() called at [<arcanist>/src/repository/api/ArcanistRepositoryAPI.php:399]
  #2 ArcanistRepositoryAPI::execxLocal(string, string) called at [<arcanist>/src/land/engine/ArcanistMercurialLandEngine.php:1168]
  #3 ArcanistMercurialLandEngine::pruneBranches(array) called at [<arcanist>/src/land/engine/ArcanistLandEngine.php:1304]
  #4 ArcanistLandEngine::execute() called at [<arcanist>/src/workflow/ArcanistLandWorkflow.php:344]
  #5 ArcanistLandWorkflow::runWorkflow(PhutilArgumentParser) called at [<arcanist>/src/workflow/ArcanistWorkflow.php:227]
  #6 ArcanistWorkflow::executeWorkflow(PhutilArgumentParser) called at [<arcanist>/src/toolset/ArcanistPhutilWorkflow.php:21]
  #7 ArcanistPhutilWorkflow::execute(PhutilArgumentParser) called at [<arcanist>/src/parser/argument/PhutilArgumentParser.php:492]
  #8 PhutilArgumentParser::parseWorkflowsFull(array) called at [<arcanist>/src/runtime/ArcanistRuntime.php:171]
  #9 ArcanistRuntime::executeCore(array) called at [<arcanist>/src/runtime/ArcanistRuntime.php:37]
  #10 ArcanistRuntime::execute(array) called at [<arcanist>/support/init/init-arcanist.php:6]
  #11 require_once(string) called at [<arcanist>/bin/arc:10]

Browsing Revision:

2021/09/13 16:48:03 [error] 59551#59551: *285042 FastCGI sent in stderr: "PHP message: [2021-09-13 15:48:03] EXCEPTION: (RuntimeException) min(): Array must contain at least one element at [<arcanist>/src/error/PhutilErrorHandler.php:262]
PHP message: arcanist(head=mim, ref.mim=4f70fcffa8a5), phabricator(head=mim, ref.mim=885d9fc25231, custom=11)
    #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer, array)
        called at [<arcanist>/src/error/PhutilErrorHandler.php:262]
    #1 <#2> min(array)
        called at [<phabricator>/src/infrastructure/diff/engine/PhabricatorInlineCommentAdjustmentEngine.php:146]
    #2 <#2> PhabricatorInlineCommentAdjustmentEngine::execute()
        called at [<phabricator>/src/applications/differential/engine/DifferentialRevisionTimelineEngine.php:68]
    #3 <#2> DifferentialRevisionTimelineEngine::newTimelineView()
        called at [<phabricator>/src/applications/transactions/engine/PhabricatorTimelineEngine.php:70]
    #4 <#2> PhabricatorTimelineEngine::buildTimelineView()
        called at [<phabricator>/src/applications/base/controller/PhabricatorController.php:520]
    #5 <#2> PhabricatorController::buildTransactionTimeline(DifferentialRevision, DifferentialTransactionQuery, NULL, array)
        called at [<phabricator>/src/applications/differential/controller/DifferentialRevisionViewController.php:1150]
    #6 <#2> DifferentialRevisionViewController::buildTransactions(DifferentialRevision, DifferentialDiff, DifferentialDiff, array, array)
        called at [<phabricator>/src/applications/differential/controller/DifferentialRevisionViewController.php:353]
    #7 <#2> DifferentialRevisionViewController::handleRequest(AphrontRequest)
        called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
    #8 phlog(RuntimeException)
        called at [<phabricator>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
    #9 PhabricatorDefaultRequestExceptionHandler::handleRequestThr

Browsing Diffusion (namely, loading a file while the published changeset is head, and trying to Skip past commit):

2021/09/14 12:38:11 [error] 59548#59548: *310503 FastCGI sent in stderr: "PHP message: [2021-09-14 11:38:11] EXCEPTION: (RuntimeException) reset() expects parameter 1 to be array, null given at [<arcanist>/src/error/PhutilErrorHandler.php:262]
PHP message: arcanist(head=mim, ref.mim=4f70fcffa8a5), phabricator(head=mim, ref.mim=885d9fc25231, custom=11)
    #0 <#2> PhutilErrorHandler::handleError(integer, string, string, integer, array)
        called at [<arcanist>/src/error/PhutilErrorHandler.php:262]
    #1 <#2> reset(NULL)
        called at [<phabricator>/src/applications/diffusion/query/DiffusionRenameHistoryQuery.php:100]
    #2 <#2> DiffusionRenameHistoryQuery::loadCommitSequence(string)
        called at [<phabricator>/src/applications/diffusion/query/DiffusionRenameHistoryQuery.php:45]
    #3 <#2> DiffusionRenameHistoryQuery::loadOldFilename()
        called at [<phabricator>/src/applications/diffusion/controller/DiffusionBrowseController.php:666]
    #4 <#2> DiffusionBrowseController::buildBeforeResponse(string)
        called at [<phabricator>/src/applications/diffusion/controller/DiffusionBrowseController.php:108]
    #5 <#2> DiffusionBrowseController::browseFile()
        called at [<phabricator>/src/applications/diffusion/controller/DiffusionBrowseController.php:46]
    #6 <#2> DiffusionBrowseController::handleRequest(AphrontRequest)
        called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:284]
    #7 phlog(RuntimeException)
        called at [<phabricator>/src/aphront/handler/PhabricatorDefaultRequestExceptionHandler.php:41]
    #8 PhabricatorDefaultRequestExceptionHandler::handleRequestThrowable(AphrontRequest, RuntimeException)
        called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:751]
    #9 AphrontApplicationConfiguration::handleThrowable(RuntimeException)
        called at [<phabricator>/src/aphront/configuration/AphrontApplicationConfiguration.php:296]
    #10 AphrontApplicationConfigura

Running ./bin/repository reparse of the commit throws an error that it can't parse an empty diff

[cspeck@repo-testing1]$ ./bin/repository reparse --message --change --publish d132c1b0b602d0a403d74629e120e25b91dade54
[                                                                  ]   0.0%[2021-09-14 16:53:19] EXCEPTION: (Exception) Can't parse an empty diff! at [<arcanist>/src/parser/ArcanistDiffParser.php:191]
arcanist(head=mim, ref.mim=4f70fcffa8a5), phabricator(head=mim, ref.mim=885d9fc25231, custom=11)
  #0 <#2> ArcanistDiffParser::parseDiff(string) called at [<phabricator>/src/applications/diffusion/herald/HeraldCommitAdapter.php:271]
  #1 <#2> HeraldCommitAdapter::loadCommitDiff() called at [<phabricator>/src/applications/diffusion/herald/HeraldCommitAdapter.php:286]
  #2 phlog(Exception) called at [<phabricator>/src/applications/diffusion/herald/HeraldCommitAdapter.php:289]
  #3 HeraldCommitAdapter::loadDiffContent(string) called at [<phabricator>/src/applications/diffusion/herald/DiffusionCommitDiffContentAddedHeraldField.php:17]
  #4 DiffusionCommitDiffContentAddedHeraldField::getHeraldFieldValue(PhabricatorRepositoryCommit) called at [<phabricator>/src/applications/herald/adapter/HeraldAdapter.php:143]
  #5 HeraldAdapter::getHeraldField(string) called at [<phabricator>/src/applications/herald/engine/HeraldEngine.php:650]
  #6 HeraldEngine::getObjectFieldValue(string) called at [<phabricator>/src/applications/herald/engine/HeraldEngine.php:622]
  #7 HeraldEngine::getProfiledObjectFieldValue(HeraldCommitAdapter, string) called at [<phabricator>/src/applications/herald/engine/HeraldEngine.php:506]
  #8 HeraldEngine::doesConditionMatch(HeraldRule, HeraldCondition, HeraldCommitAdapter) called at [<phabricator>/src/applications/herald/engine/HeraldEngine.php:421]
  #9 HeraldEngine::getRuleMatchResult(HeraldRule, HeraldCommitAdapter) called at [<phabricator>/src/applications/herald/engine/HeraldEngine.php:166]
  #10 HeraldEngine::applyRules(array, HeraldCommitAdapter) called at [<phabricator>/src/applications/herald/engine/HeraldEngine.php:52]
  #11 HeraldEngine::loadAndApplyRules(HeraldCommitAdapter) called at [<phabricator>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:3916]
  #12 PhabricatorApplicationTransactionEditor::applyHeraldRules(PhabricatorRepositoryCommit, array) called at [<phabricator>/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:1286]
  #13 PhabricatorApplicationTransactionEditor::applyTransactions(PhabricatorRepositoryCommit, array) called at [<phabricator>/src/applications/repository/worker/PhabricatorRepositoryCommitPublishWorker.php:124]
  #14 PhabricatorRepositoryCommitPublishWorker::applyTransactions(PhabricatorUser, PhabricatorRepository, PhabricatorRepositoryCommit) called at [<phabricator>/src/applications/repository/worker/PhabricatorRepositoryCommitPublishWorker.php:80]
  #15 PhabricatorRepositoryCommitPublishWorker::publishCommit(PhabricatorRepository, PhabricatorRepositoryCommit) called at [<phabricator>/src/applications/repository/worker/PhabricatorRepositoryCommitPublishWorker.php:20]
  #16 PhabricatorRepositoryCommitPublishWorker::parseCommit(PhabricatorRepository, PhabricatorRepositoryCommit) called at [<phabricator>/src/applications/repository/worker/PhabricatorRepositoryCommitParserWorker.php:72]
  #17 PhabricatorRepositoryCommitParserWorker::doWork() called at [<phabricator>/src/infrastructure/daemon/workers/PhabricatorWorker.php:124]
  #18 PhabricatorWorker::executeTask() called at [<phabricator>/src/infrastructure/daemon/workers/PhabricatorWorker.php:166]
  #19 PhabricatorWorker::scheduleTask(string, array, array) called at [<phabricator>/src/applications/repository/management/PhabricatorRepositoryManagementReparseWorkflow.php:263]
  #20 PhabricatorRepositoryManagementReparseWorkflow::execute(PhutilArgumentParser) called at [<arcanist>/src/parser/argument/PhutilArgumentParser.php:492]
  #21 PhutilArgumentParser::parseWorkflowsFull(array) called at [<arcanist>/src/parser/argument/PhutilArgumentParser.php:377]
  #22 PhutilArgumentParser::parseWorkflows(array) called at [<phabricator>/scripts/repository/manage_repositories.php:22]

Versions

arcanist (client)d246a06562593670f62951fed0541e2a894f9788(5 Sep 2021)master
arcanist (server)4f70fcffa8a5Jun 5 2021stable
phabricator885d9fc25231Jul 7 2021This is a branch off of 193798385bd3a7f72dca255e44f8112f4f8fc155 Jun 25 2021 stable branch with a very minor unrelated modification

Event Timeline

Browsing Revision

Reproduces in any VCS, fixed by D21760.

Running ./bin/repository reparse of the commit..

Reproduces in any VCS, fixed by D21761.

Browsing Diffusion (namely, loading a file while the published changeset is head, and trying to Skip past commit):

I couldn't immediately reproduce this; it's also probably a bit of a messy fix.

Arcanist (while running arc land):

(Didn't try reproducing this one since I'm missing a couple of bits locally.)

Browsing Diffusion (namely, loading a file while the published changeset is head, and trying to Skip past commit):

I couldn't immediately reproduce this; it's also probably a bit of a messy fix.

I'll plan to investigate further if possible. I believe in this case the repository was running in observed mode rather than hosted in case that might be a factor.