I’m facing an exception when using arc diff in a newly created Mercurial repository.
First, I created a new Mercurial repository via my self-hosted phabricator server. Then, I cloned the empty project to my local machine (macOS Mojave 10.14.2). Inside my project, I created a .arcconfig
file with the following content according to the doc (replaced actual uri with dummy link just for illustration):
{
"phabricator.uri": "http://example.com"
}
Then I staged the new file using hg add
and run 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]
So it is hg status --rev '' --rev tip
causing the exception and looks like it's a command with invalid argument. I'm not sure why is this happening. My colleague has also reproduced this issue on his OSX machine.
It turns out this error happens when the project is empty. It works after I pushed something to the repository using hg push
.