Consider submodules while commit and PR checkout (#7500)

This fix includes a few updates for infra/repo_manager.py:

* Add step for updating submodules while commit checkout
* Add step for updating submodules while PR checkout

Fixes #7493
This commit is contained in:
Yaroslav Lobankov 2022-04-05 18:14:39 +03:00 committed by GitHub
parent 909a0d7ed3
commit e71b32c79c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -202,6 +202,8 @@ class RepoManager:
self.fetch_unshallow() self.fetch_unshallow()
self.git(['fetch', 'origin', pr_ref], check_result=True) self.git(['fetch', 'origin', pr_ref], check_result=True)
self.git(['checkout', '-f', 'FETCH_HEAD'], check_result=True) self.git(['checkout', '-f', 'FETCH_HEAD'], check_result=True)
self.git(['submodule', 'update', '-f', '--init', '--recursive'],
check_result=True)
def checkout_commit(self, commit, clean=True): def checkout_commit(self, commit, clean=True):
"""Checks out a specific commit from the repo. """Checks out a specific commit from the repo.
@ -217,6 +219,8 @@ class RepoManager:
if not self.commit_exists(commit): if not self.commit_exists(commit):
raise ValueError('Commit %s does not exist in current branch' % commit) raise ValueError('Commit %s does not exist in current branch' % commit)
self.git(['checkout', '-f', commit], check_result=True) self.git(['checkout', '-f', commit], check_result=True)
self.git(['submodule', 'update', '-f', '--init', '--recursive'],
check_result=True)
if clean: if clean:
self.git(['clean', '-fxd'], check_result=True) self.git(['clean', '-fxd'], check_result=True)
if self.get_current_commit() != commit: if self.get_current_commit() != commit: