Closed Bug 1798751 Opened 3 months ago Closed 2 months ago

`moz-phab self-update` no longer displays any output


(Conduit :: moz-phab, defect)



(Not tracked)



(Reporter: sheehan, Assigned: sheehan)





(3 files)

Previously when running moz-phab self-update, moz-phab would spew the output from pip to the screen for users. After bug 1703872 we now silence pip by calling it with --quiet. This has the unintended effect of making moz-phab self-update print no output to the screen when updating.

moz-phab prints it's own output to the screen with a spinner notifying users of the update when the self-updater is run as a regular check (ie as a check on moz-phab submit). We should tweak the update checking code and make moz-phab self-update use this code path so the user can tell their moz-phab is being updated.

Re-work check_for_updates to allow re-using the logging
logic in moz-phab self-update. Control running the self
update from the update checker via a function argument instead
of a config knob so we can always force the update when
running the update command explicitly. Move the restarting
of moz-phab to its own function outside of the updating
logic so it is only run when doing an update check outside
of moz-phab self-update. Update mocks of check_for_updates
to be a lambda: None instead of a MagicMock, which also
removes requiring them as function arguments in tests.

While here, reverse the if logic in check_for_updates
to exit if the update conditions aren't met, allowing the
entire function to be de-dented a level.

When an update is available we now have some logging. However when
no update is available, there is still no command output. Add
a log message that states there is nothing for moz-phab to do.

Now that we gate self_upgrade behind check_for_updates we require
check_for_updates to always return the latest version. The info
key in the PyPI API response only contains the latest full release,
meaning the updater code will never upgrade to a pre-release version
since it will be unaware of it's existance. Add a code path to parse
the latest pre-release version from the entire set of releases.

Closed: 2 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.