`moz-phab` fails with `FileNotFoundError` when `jj` is not installed
Categories
(Conduit :: moz-phab, defect)
Tracking
(Not tracked)
People
(Reporter: sheehan, Assigned: sheehan)
References
(Regression)
Details
(Keywords: regression)
Attachments
(5 files)
When running moz-phab with the latest commits on main from bug 1956345, I can see the following fatal error when running moz-phab patch:
❯ jj version
zsh: jj: command not found...
❯ moz-phab patch D247659 --trace
DEBUG 2025-07-02 13:07:12,166 MozPhab (1.11.1.dev7+g7aca92a)
DEBUG 2025-07-02 13:07:12,166 Forced update check: False.
DEBUG 2025-07-02 13:07:12,166 Time since last check is 28 seconds, skipping check for new versions.
DEBUG 2025-07-02 13:07:12,167 Not checking for updates.
DEBUG 2025-07-02 13:07:12,167 $ jj version
ERROR 2025-07-02 13:07:12,170 Traceback (most recent call last):
File "/home/sheehan/conduit/review/mozphab/mozphab.py", line 121, in main
repo = repo_from_args(args)
File "/home/sheehan/conduit/review/mozphab/detect_repository.py", line 75, in repo_from_args
repo = probe_repo(path, avoid_jj_vcs)
File "/home/sheehan/conduit/review/mozphab/detect_repository.py", line 40, in probe_repo
return Jujutsu(path)
File "/home/sheehan/conduit/review/mozphab/jujutsu.py", line 43, in __init__
self.vcs_version = Jujutsu.__check_and_get_version()
File "/home/sheehan/conduit/review/mozphab/jujutsu.py", line 99, in __check_and_get_version
jj_version_output = check_output(["jj", "version"], split=False)
File "/home/sheehan/conduit/review/mozphab/subprocess_wrapper.py", line 95, in check_output
output = subprocess.check_output(command, **kwargs)
File "/home/sheehan/.pyenv/versions/3.9.18/lib/python3.9/subprocess.py", line 424, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/home/sheehan/.pyenv/versions/3.9.18/lib/python3.9/subprocess.py", line 505, in run
with Popen(*popenargs, **kwargs) as process:
File "/home/sheehan/.pyenv/versions/3.9.18/lib/python3.9/subprocess.py", line 951, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/home/sheehan/.pyenv/versions/3.9.18/lib/python3.9/subprocess.py", line 1837, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'jj'
Failure to run jj commands should result in a non-fatal error, and continue looking for a different candidate VCS to use.
| Assignee | ||
Updated•1 year ago
|
| Assignee | ||
Comment 1•1 year ago
|
||
If jj isn't installed on the user's system, running
jj version will throw a FileNotFoundError that is
uncaught, causing commands to fail. Catch the FileNotFoundError
and convert it to an Error so probe_repo will catch
it.
| Assignee | ||
Comment 2•1 year ago
|
||
This causes the constructor to return earlier when the directory
isn't a jj repo.
| Assignee | ||
Comment 3•1 year ago
|
||
| Assignee | ||
Comment 4•1 year ago
|
||
My LSP is complaining about improper method overriding due to the
type hint missing in the Repository base class.
| Assignee | ||
Comment 5•1 year ago
|
||
Updated•1 year ago
|
Comment 6•1 year ago
|
||
Authored by https://github.com/cgsheeh
https://github.com/mozilla-conduit/review/commit/c694c2c10618cd281480d5bc7b60bab6cd9963ae
[main] jj: account for missing executable during version check (Bug 1975260) r=ErichDonGubler
Authored by https://github.com/cgsheeh
https://github.com/mozilla-conduit/review/commit/b810bf475271e644171aecfd82d8d006a787e991
[main] jj: move check for .jj directory to start of __init__ (Bug 1975260) r=ErichDonGubler
Authored by https://github.com/cgsheeh
https://github.com/mozilla-conduit/review/commit/c7afba2e5012b9be97eb87cbd8d04aa49f8ce608
[main] jj: make check_and_get_version an instance method, move to later (Bug 1975260) r=ErichDonGubler
Authored by https://github.com/cgsheeh
https://github.com/mozilla-conduit/review/commit/8d1789fd5e38f653b6591c2c014d2b4e126b94db
[main] repo: add type hint to is_worktree_clean (Bug 1975260) r=ErichDonGubler
Authored by https://github.com/cgsheeh
https://github.com/mozilla-conduit/review/commit/d4e31cb1c3d43e9dbbcadc890710739788b0fef9
[main] hg: remove unused keep_ends kwarg (Bug 1975260) r=ErichDonGubler
Description
•