|
26 | 26 | import lmdb |
27 | 27 | import requests |
28 | 28 | import rs_parsepatch |
29 | | -import tenacity |
30 | 29 | from tqdm import tqdm |
31 | 30 |
|
32 | 31 | from bugbug import db, rust_code_analysis_server, utils |
@@ -1520,36 +1519,29 @@ def clone( |
1520 | 1519 |
|
1521 | 1520 | def pull(repo_dir: str, branch: str, revision: str) -> None: |
1522 | 1521 | """Pull a revision from a branch of a remote repository into a local repository.""" |
1523 | | - |
1524 | | - @tenacity.retry( |
1525 | | - stop=tenacity.stop_after_attempt(2), |
1526 | | - reraise=True, |
1527 | | - after=tenacity.after_log(logger, logging.DEBUG), |
1528 | | - retry=tenacity.retry_if_exception_type(subprocess.TimeoutExpired), |
| 1522 | + cmd = _build_hg_cmd( |
| 1523 | + "robustcheckout", |
| 1524 | + f"https://hg.mozilla.org/{branch}/".encode("ascii"), |
| 1525 | + repo_dir, |
| 1526 | + purge=False, |
| 1527 | + sharebase=f"{repo_dir}-shared", |
| 1528 | + revision=revision.encode("ascii"), |
| 1529 | + noupdate=True, |
1529 | 1530 | ) |
1530 | | - def trigger_pull() -> None: |
1531 | | - cmd = _build_hg_cmd( |
1532 | | - "pull", |
1533 | | - f"https://hg.mozilla.org/{branch}/".encode("ascii"), |
1534 | | - r=revision.encode("ascii"), |
1535 | | - debug=True, |
1536 | | - ) |
1537 | | - |
1538 | | - p = subprocess.Popen(cmd, cwd=repo_dir) |
1539 | 1531 |
|
1540 | | - try: |
1541 | | - p.wait(timeout=180) |
1542 | | - except subprocess.TimeoutExpired: |
1543 | | - p.terminate() |
1544 | | - p.wait() |
1545 | | - raise |
| 1532 | + p = subprocess.Popen(cmd, cwd=repo_dir) |
1546 | 1533 |
|
1547 | | - if p.returncode != 0: |
1548 | | - raise RuntimeError( |
1549 | | - f"Error {p.returncode} when pulling {revision} from {branch}" |
1550 | | - ) |
| 1534 | + try: |
| 1535 | + p.wait(timeout=180) |
| 1536 | + except subprocess.TimeoutExpired: |
| 1537 | + p.terminate() |
| 1538 | + p.wait() |
| 1539 | + raise |
1551 | 1540 |
|
1552 | | - trigger_pull() |
| 1541 | + if p.returncode != 0: |
| 1542 | + raise RuntimeError( |
| 1543 | + f"Error {p.returncode} when pulling {revision} from {branch}" |
| 1544 | + ) |
1553 | 1545 |
|
1554 | 1546 |
|
1555 | 1547 | if __name__ == "__main__": |
|
0 commit comments