diff options
author | Gavin Mak <gavinmak@google.com> | 2023-05-24 21:28:28 +0000 |
---|---|---|
committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2023-05-25 17:26:22 +0000 |
commit | 04cba4add52b11a27d09d73c2cbfebcd67a1f2cc (patch) | |
tree | 309e74c574545d6dcb269a8bd37ac3232ac3c6af /subcmds | |
parent | 3eacfdf3090a961ada4ebeb8e28f0782eac4c9d8 (diff) | |
download | git-repo-04cba4add52b11a27d09d73c2cbfebcd67a1f2cc.tar.gz |
sync: Show number of running fetch jobsv2.34
Last of the recent `repo sync` UX changes. Show number of fetch jobs eg:
"Fetching: 3% (8/251) 0:03 | 8 jobs | 0:01 chromiumos/overlays/chrom.."
Bug: https://crbug.com/gerrit/11293
Change-Id: I1b3dcf3e56ae6731c6c6cb73cfce069b2f374b69
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/374920
Reviewed-by: Josip Sokcevic <sokcevic@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
Tested-by: Gavin Mak <gavinmak@google.com>
Reviewed-by: Joanna Wang <jojwang@google.com>
Diffstat (limited to 'subcmds')
-rw-r--r-- | subcmds/sync.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index da9918b9..a44ed5b4 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -66,7 +66,7 @@ from command import ( | |||
66 | from error import RepoChangedException, GitError | 66 | from error import RepoChangedException, GitError |
67 | import platform_utils | 67 | import platform_utils |
68 | from project import SyncBuffer | 68 | from project import SyncBuffer |
69 | from progress import Progress, elapsed_str | 69 | from progress import Progress, elapsed_str, jobs_str |
70 | from repo_trace import Trace | 70 | from repo_trace import Trace |
71 | import ssh | 71 | import ssh |
72 | from wrapper import Wrapper | 72 | from wrapper import Wrapper |
@@ -673,7 +673,7 @@ later is required to fix a server side protocol bug. | |||
673 | def _FetchInitChild(cls, ssh_proxy): | 673 | def _FetchInitChild(cls, ssh_proxy): |
674 | cls.ssh_proxy = ssh_proxy | 674 | cls.ssh_proxy = ssh_proxy |
675 | 675 | ||
676 | def _GetLongestSyncMessage(self): | 676 | def _GetSyncProgressMessage(self): |
677 | if len(self._sync_dict) == 0: | 677 | if len(self._sync_dict) == 0: |
678 | return None | 678 | return None |
679 | 679 | ||
@@ -685,7 +685,8 @@ later is required to fix a server side protocol bug. | |||
685 | earliest_proj = project | 685 | earliest_proj = project |
686 | 686 | ||
687 | elapsed = time.time() - earliest_time | 687 | elapsed = time.time() - earliest_time |
688 | return f"{elapsed_str(elapsed)} {earliest_proj}" | 688 | jobs = jobs_str(len(self._sync_dict)) |
689 | return f"{jobs} | {elapsed_str(elapsed)} {earliest_proj}" | ||
689 | 690 | ||
690 | def _Fetch(self, projects, opt, err_event, ssh_proxy): | 691 | def _Fetch(self, projects, opt, err_event, ssh_proxy): |
691 | ret = True | 692 | ret = True |
@@ -707,7 +708,7 @@ later is required to fix a server side protocol bug. | |||
707 | 708 | ||
708 | def _MonitorSyncLoop(): | 709 | def _MonitorSyncLoop(): |
709 | while True: | 710 | while True: |
710 | pm.update(inc=0, msg=self._GetLongestSyncMessage()) | 711 | pm.update(inc=0, msg=self._GetSyncProgressMessage()) |
711 | if sync_event.wait(timeout=1): | 712 | if sync_event.wait(timeout=1): |
712 | return | 713 | return |
713 | 714 | ||