Running moz-phab with an invalid command results in a confusing error
Categories
(Conduit :: moz-phab, defect, P3)
Tracking
(Not tracked)
People
(Reporter: jwatt, Assigned: grammar)
References
Details
(Keywords: conduit-triaged, good-first-bug)
Attachments
(1 file)
I'm setting up a fresh Windows 10 machine. In addition to bug 1740167, I've now encountered an issue with moz-phab.
$ moz-phab patch -a here --no-bookmark D99811
Starting up..
Phabricator Error: You don't have credentials needed to access Phabricator.
Please run the following command to configure moz-phab:
moz-phab install-certificate
Checking connection to Phabricator. -Phabricator Error: You don't have credentials needed to access Phabricator.
Please run the following command to configure moz-phab:
moz-phab install-certificate
Failed to use Conduit API
I had already copied .hgrc over from my Mac to the Windows machine, and I then copied .moz-phab-config and .arcrc over. In other words, .arcrc should now have had a key. I still got the above failure though.
Anyway, I tried to run moz-phab install-certificates and got:
$ moz-phab install-certificates --trace
DEBUG 2021-11-09 02:44:30,296 MozPhab (0.1.99)
DEBUG 2021-11-09 02:44:30,296 found hg repo in c:\Users\jwatt\mozilla-source\mozilla-unified
DEBUG 2021-11-09 02:44:30,515 $ hg config
DEBUG 2021-11-09 02:44:30,530 hg extensions: absorb, amend, blackbox, children, clang-format, evolve, extdiff, firefoxtree, fsmonitor, histedit, journal, js-format, progress, purge, push-to-try
, rebase, share, shelve, show, strip, transplant
DEBUG 2021-11-09 02:44:30,530 $ hg log -T '{node}\n' -r install-certificates --pager never
DEBUG 2021-11-09 02:44:30,843 abort: unknown revision 'install'!
ERROR 2021-11-09 02:44:30,843 Traceback (most recent call last):
File "c:\mozilla-build\python3\lib\site-packages\mozphab\mozphab.py", line 75, in main
repo = repo_from_args(args)
File "c:\mozilla-build\python3\lib\site-packages\mozphab\detect_repository.py", line 57, in repo_from_args
repo.set_args(args)
File "c:\mozilla-build\python3\lib\site-packages\mozphab\mercurial.py", line 403, in set_args
start = self.hg_log(start_rev)[0]
File "c:\mozilla-build\python3\lib\site-packages\mozphab\mercurial.py", line 211, in hg_log
return self.hg_out(["log", "-T", "{%s}\n" % select, "-r", revset], split=split)
File "c:\mozilla-build\python3\lib\site-packages\mozphab\mercurial.py", line 191, in hg_out
out = self.repository.rawcommand(command, eh=error_handler)
File "c:\mozilla-build\python3\lib\site-packages\hglib\client.py", line 265, in rawcommand
return eh(ret, out, err)
File "c:\mozilla-build\python3\lib\site-packages\mozphab\mercurial.py", line 183, in error_handler
exit_code,
mozphab.exceptions.CommandError: command 'log' failed to complete successfully
Very bizarrely, when I ssh'ed into the machine, invoked \mozilla-build\start-shell.bat and then ran moz-phab install-certificates, the command then successfully ran and moz-phab subsequently worked.
Comment 1•4 years ago
|
||
Not sure if this is the cause of the problem, but the command you should be using is moz-phab install-certificate (singular), not moz-phab install-certificates, which is what you used in the example above.
Comment 2•4 years ago
|
||
Having said that, I agree that the error output that you provided is nonsensical, and it should instead just inform you that you provided an invalid command. We should probably reword this bug to provide better error output.
| Reporter | ||
Comment 3•4 years ago
|
||
Hmm, I noticed that and fixed it, and I think I was still getting the error (if true, I just copied and pasted the wrong chunk from scrollback). But maybe I got confused and I didn't notice until I was trying over SSH. That certainly seems like the most plausible explanation!
abort: unknown revision 'install'!
What's going on is because a valid command wasn't provided moz-phab defaults to the submit command, treating the first argument as a revset.
This generated the abort: unknown revision 'install'! error you see in the error output.
We should probably detect when we've fallen back to submit and provide a clear error message if an invalid revset is provided.
| Reporter | ||
Comment 5•4 years ago
|
||
Yeah, I can't repro now after moving my .arcrc, so I must have misremembered when I noticed it wasn't supposed to be plural.
It would be great if moz-phab could be fixed to report unrecognized commands. (I guess allowing 'submit' to be optional makes it a bit less straightforward, but presumably if the first argument (ignoring flags) doesn't start with "D" then the check-for-known-command logic could be invoked.) If so please feel free to use this bug for that. If not, I guess it can be closed.
Updated•4 years ago
|
| Assignee | ||
Updated•3 years ago
|
| Assignee | ||
Comment 6•3 years ago
|
||
| Assignee | ||
Updated•3 years ago
|
Description
•