Rollup merge of #89929 - yuvaldolev:handle-submodule-checkout-more-gracefully, r=Mark-Simulacrum
Handling submodule update failures more gracefully from x.py Addresses #80498 Handling the case where x.py can't check out the right commit of a submodule, because the submodule has local edits that would be overwritten by the checkout, more gracefully. The error is printed in detail, with some hints on how to revert the local changes to the submodule.
This commit is contained in:
commit
b7be4fc99f
1 changed files with 9 additions and 1 deletions
|
@ -1026,7 +1026,15 @@ class RustBuild(object):
|
|||
if self.git_version >= distutils.version.LooseVersion("2.11.0"):
|
||||
update_args.append("--progress")
|
||||
update_args.append(module)
|
||||
run(update_args, cwd=self.rust_root, verbose=self.verbose, exception=True)
|
||||
try:
|
||||
run(update_args, cwd=self.rust_root, verbose=self.verbose, exception=True)
|
||||
except RuntimeError:
|
||||
print("Failed updating submodule. This is probably due to uncommitted local changes.")
|
||||
print('Either stash the changes by running "git stash" within the submodule\'s')
|
||||
print('directory, reset them by running "git reset --hard", or commit them.')
|
||||
print("To reset all submodules' changes run", end=" ")
|
||||
print('"git submodule foreach --recursive git reset --hard".')
|
||||
raise SystemExit(1)
|
||||
|
||||
run(["git", "reset", "-q", "--hard"],
|
||||
cwd=module_path, verbose=self.verbose)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue