mach: Report an error instead of running try with a dirty working directory (#34349)

Signed-off-by: L Ashwin B <lashwinib@gmail.com>
Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
chickenleaf 2025-01-14 22:46:51 +05:30 committed by GitHub
parent 0e616e0c5d
commit d503fd0fbc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -842,6 +842,11 @@ tests/wpt/mozilla/tests for Servo-only tests""" % reference_path)
@CommandArgument('try_strings', default=["full"], nargs='...',
help="A list of try strings specifying what kind of job to run.")
def try_command(self, remote: str, try_strings: list[str]):
if subprocess.check_output(["git", "diff", "--cached", "--name-only"]).strip():
print("Cannot run `try` with staged and uncommited changes. ")
print("Please either commit or stash them before running `try`.")
return 1
remote_url = subprocess.check_output(["git", "config", "--get", f"remote.{remote}.url"]).decode().strip()
if "github.com" not in remote_url:
print(f"The remote provided ({remote_url}) isn't a GitHub remote.")