Arc diff in newly created repository throws exception ‘hg: parse error: empty query’

Arc diff in newly created repository throws exception ‘hg: parse error: empty query’

我在新创建的 Mercurial 存储库中使用 arc diff 时遇到异常。

首先,我通过自托管的 phabricator 服务器创建了一个新的 Mercurial 存储库。然后,我将空项目克隆到本地计算机 (macOS Mojave 10.14.2)。在我的项目中,我根据 the doc 创建了一个包含以下内容的 .arcconfig 文件(为了说明,将实际 uri 替换为虚拟 link):

{
    "phabricator.uri": "http://example.com"
}

然后我使用 hg add 和 运行 暂存新文件 arc diff --trace:

 ARGV  '/usr/local/arcanist/bin/../scripts/arcanist.php' 'diff' '--trace'
 LOAD  Loaded "phutil" from "/usr/local/libphutil/src".
 LOAD  Loaded "arcanist" from "/usr/local/arcanist/src".
Config: Reading user configuration file "/Users/Desmond/.arcrc"...
Config: Did not find system configuration at "/etc/arcconfig".
Working Copy: Reading .arcconfig from "/Users/Desmond/repo/free-banking/.arcconfig".
Working Copy: Path "/Users/Desmond/repo/free-banking" is part of `hg` working copy "/Users/Desmond/repo
/free-banking".
Working Copy: Project root is at "/Users/Desmond/repo/free-banking".
Config: Did not find local configuration at "/Users/Desmond/repo/free-banking/.hg/arc/config".
>>> [0] (+0) <http> http://example.com/api/user.whoami
<<< [0] (+458) <http> 458,418 us
>>> [1] (+468) <exec> $ HGPLAIN=1 hg status
<<< [1] (+646) <exec> 177,231 us
>>> [2] (+648) <event> diff.didCollectChanges <listeners = 0>
<<< [2] (+648) <event> 77 us
>>> [3] (+648) <exec> $ HGPLAIN=1 hg help phase
<<< [3] (+824) <exec> 175,359 us
>>> [4] (+824) <exec> $ HGPLAIN=1 hg branch
<<< [4] (+982) <exec> 158,102 us
>>> [5] (+982) <exec> $ HGPLAIN=1 hg log --branch 'default' -r 'draft()' --style default
<<< [5] (+1,172) <exec> 189,968 us
>>> [6] (+1,173) <exec> $ HGPLAIN=1 hg parents --style default --rev '.'
<<< [6] (+1,355) <exec> 182,676 us
>>> [7] (+1,356) <exec> $ HGPLAIN=1 hg log --template '{node}<...binary data...>' --rev '('\''null'\'':
:. - '\''null'\'')' --branch 'default' --
<<< [7] (+1,546) <exec> 190,555 us
>>> [8] (+1,548) <exec> $ HGPLAIN=1 hg log --template '{node}<...binary data...>{date|rfc822date}<...bi
nary data...>' --rev '('\''null'\''::. - '\''null'\'')' --branch 'default' --
<<< [8] (+1,737) <exec> 188,794 us
>>> [9] (+1,738) <exec> $ HGPLAIN=1 hg parents --template '{node}\n' --rev 'f99429f0ddebf4f95ec92955388
b5894f39441d1'
<<< [9] (+1,920) <exec> 181,403 us
>>> [10] (+1,920) <http> http://example.com/api/differential.query
<<< [10] (+2,177) <http> 256,608 us
You have a saved revision message in '.hg/arc/create-message'.
Message begins:

       Set phabricator.uri for arc

You can use this message, or discard it.

    Do you want to use this message? [Y/n] Y

>>> [11] (+6,926) <http> http://example.com/api/differential.parsecommitmessage
<<< [11] (+8,948) <http> 2,021,984 us                                                         [19/1018]
>>> [12] (+8,948) <event> diff.willBuildMessage <listeners = 0>
<<< [12] (+8,948) <event> 65 us
>>> [13] (+8,952) <exec> $ /usr/local/bin/nvim '/var/folders/0l/4ljx33fs0c72wgdm37h_mjyh0000gn/T/edit.6
tvs38o3zoo4o0w4/new-commit'
<<< [13] (+14,046) <exec> 5,094,156 us
>>> [14] (+14,051) <http> http://example.com/api/differential.parsecommitmessage
<<< [14] (+15,520) <http> 1,469,613 us
>>> [15] (+15,520) <event> diff.didBuildMessage <listeners = 0>
<<< [15] (+15,520) <event> 65 us
Linting...
No lint engine configured for this project.
Running unit tests...
>>> [16] (+15,525) <exec> $ HGPLAIN=1 hg log -l 1 --template '{node}' -r 'ancestor('\''null'\'',.)' --
<<< [16] (+15,908) <exec> 382,545 us
>>> [17] (+15,908) <exec> $ HGPLAIN=1 hg status --rev '' --rev tip
<<< [17] (+16,071) <exec> 162,973 us

[2019-02-12 03:05:17] EXCEPTION: (CommandException) Command failed with error #255!
COMMAND
HGPLAIN=1 hg status --rev '' --rev tip

STDOUT
(empty)

STDERR
hg: parse error: empty query
 at [<phutil>/src/future/exec/ExecFuture.php:380]
arcanist(head=master, ref.master=25c2381959ac), phutil(head=master, ref.master=f430af3cd431)
  #0 ExecFuture::resolvex() called at [<arcanist>/src/repository/api/ArcanistRepositoryAPI.php:406]
  #1 ArcanistRepositoryAPI::execxLocal(string, string) called at [<arcanist>/src/repository/api/ArcanistMercurialAPI.php:377]
  #2 ArcanistMercurialAPI::buildCommitRangeStatus() called at [<arcanist>/src/repository/api/ArcanistRepositoryAPI.php:230]
  #3 ArcanistRepositoryAPI::getCommitRangeStatus() called at [<arcanist>/src/repository/api/ArcanistRepositoryAPI.php:249]
  #4 ArcanistRepositoryAPI::getWorkingCopyStatus() called at [<arcanist>/src/workflow/ArcanistWorkflow.php:1460]
  #5 ArcanistWorkflow::selectPathsForWorkflow(array, string) called at [<arcanist>/src/workflow/ArcanistUnitWorkflow.php:148]
  #6 ArcanistUnitWorkflow::run() called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:1324]
  #7 ArcanistDiffWorkflow::runUnit() called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:1212]
  #8 ArcanistDiffWorkflow::runLintUnit() called at [<arcanist>/src/workflow/ArcanistDiffWorkflow.php:483]
  #9 ArcanistDiffWorkflow::run() called at [<arcanist>/scripts/arcanist.php:394]

所以是 hg status --rev '' --rev tip 导致了异常,看起来它是一个带有无效参数的命令。我不确定为什么会这样。我的同事也在他的 OSX 机器上重现了这个问题。

原来这个错误是在项目为空的时候发生的。它在我使用 hg push.

将内容推送到存储库后起作用