(self, retries=10, retry_seconds=60)
| 455 | raise e |
| 456 | |
| 457 | def Fetch(self, retries=10, retry_seconds=60): |
| 458 | for retry in range(retries): |
| 459 | try: |
| 460 | command_output(['git', 'fetch', 'origin'], self.repo_dir) |
| 461 | # if we get here, we didn't raise an error, and we're done |
| 462 | return |
| 463 | except RuntimeError as e: |
| 464 | print("Error fetching on iteration {}/{}: {}".format(retry + 1, retries, e)) |
| 465 | if retry + 1 < retries: |
| 466 | if retry_seconds > 0: |
| 467 | print("Waiting {} seconds before trying again".format(retry_seconds)) |
| 468 | time.sleep(retry_seconds) |
| 469 | continue |
| 470 | |
| 471 | # If we get here, we've exhausted our retries. |
| 472 | print("Failed to fetch {} on all retries.".format(self.url)) |
| 473 | raise e |
| 474 | |
| 475 | def Checkout(self): |
| 476 | if VERBOSE: |
no test coverage detected