sg: add an auto update mechanism
Created by: jhchabran
Introduces a new subcommand sg update auto enable to turn on automatic updates. It's turned off by default.
When turned on, sg will first check in its local copy of origin/main if there are new commits. If yes, it will execute sg update and restart itself with the same arguments, transparently running the given arguments to the freshly updated sg and requiring no action from the user.
Fixes #29619 (closed)
Test plan
- Replaced the update check with
maininstead oforigin/main - Manually compiled
sgwith my changes - Ran
sg update auto enable - Ran
sg ci preview- Got an update triggered
- Still got the output with from
sg ci preview
See the gif in the above description.
