diff options
Diffstat (limited to 'subcmds/sync.py')
| -rw-r--r-- | subcmds/sync.py | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index 82056f33..ef023274 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
| @@ -64,6 +64,7 @@ try: | |||
| 64 | except ImportError: | 64 | except ImportError: |
| 65 | multiprocessing = None | 65 | multiprocessing = None |
| 66 | 66 | ||
| 67 | import event_log | ||
| 67 | from git_command import GIT, git_require | 68 | from git_command import GIT, git_require |
| 68 | from git_config import GetUrlCookieFile | 69 | from git_config import GetUrlCookieFile |
| 69 | from git_refs import R_HEADS, HEAD | 70 | from git_refs import R_HEADS, HEAD |
| @@ -304,9 +305,10 @@ later is required to fix a server side protocol bug. | |||
| 304 | # - We always set err_event in the case of an exception. | 305 | # - We always set err_event in the case of an exception. |
| 305 | # - We always make sure we call sem.release(). | 306 | # - We always make sure we call sem.release(). |
| 306 | # - We always make sure we unlock the lock if we locked it. | 307 | # - We always make sure we unlock the lock if we locked it. |
| 308 | start = time.time() | ||
| 309 | success = False | ||
| 307 | try: | 310 | try: |
| 308 | try: | 311 | try: |
| 309 | start = time.time() | ||
| 310 | success = project.Sync_NetworkHalf( | 312 | success = project.Sync_NetworkHalf( |
| 311 | quiet=opt.quiet, | 313 | quiet=opt.quiet, |
| 312 | current_branch_only=opt.current_branch_only, | 314 | current_branch_only=opt.current_branch_only, |
| @@ -345,6 +347,9 @@ later is required to fix a server side protocol bug. | |||
| 345 | finally: | 347 | finally: |
| 346 | if did_lock: | 348 | if did_lock: |
| 347 | lock.release() | 349 | lock.release() |
| 350 | finish = time.time() | ||
| 351 | self.event_log.AddSync(project, event_log.TASK_SYNC_NETWORK, | ||
| 352 | start, finish, success) | ||
| 348 | 353 | ||
| 349 | return success | 354 | return success |
| 350 | 355 | ||
| @@ -720,16 +725,24 @@ later is required to fix a server side protocol bug. | |||
| 720 | _PostRepoUpgrade(self.manifest, quiet=opt.quiet) | 725 | _PostRepoUpgrade(self.manifest, quiet=opt.quiet) |
| 721 | 726 | ||
| 722 | if not opt.local_only: | 727 | if not opt.local_only: |
| 723 | mp.Sync_NetworkHalf(quiet=opt.quiet, | 728 | start = time.time() |
| 724 | current_branch_only=opt.current_branch_only, | 729 | success = mp.Sync_NetworkHalf(quiet=opt.quiet, |
| 725 | no_tags=opt.no_tags, | 730 | current_branch_only=opt.current_branch_only, |
| 726 | optimized_fetch=opt.optimized_fetch, | 731 | no_tags=opt.no_tags, |
| 727 | submodules=self.manifest.HasSubmodules) | 732 | optimized_fetch=opt.optimized_fetch, |
| 733 | submodules=self.manifest.HasSubmodules) | ||
| 734 | finish = time.time() | ||
| 735 | self.event_log.AddSync(mp, event_log.TASK_SYNC_NETWORK, | ||
| 736 | start, finish, success) | ||
| 728 | 737 | ||
| 729 | if mp.HasChanges: | 738 | if mp.HasChanges: |
| 730 | syncbuf = SyncBuffer(mp.config) | 739 | syncbuf = SyncBuffer(mp.config) |
| 740 | start = time.time() | ||
| 731 | mp.Sync_LocalHalf(syncbuf, submodules=self.manifest.HasSubmodules) | 741 | mp.Sync_LocalHalf(syncbuf, submodules=self.manifest.HasSubmodules) |
| 732 | if not syncbuf.Finish(): | 742 | clean = syncbuf.Finish() |
| 743 | self.event_log.AddSync(mp, event_log.TASK_SYNC_LOCAL, | ||
| 744 | start, time.time(), clean) | ||
| 745 | if not clean: | ||
| 733 | sys.exit(1) | 746 | sys.exit(1) |
| 734 | self._ReloadManifest(manifest_name) | 747 | self._ReloadManifest(manifest_name) |
| 735 | if opt.jobs is None: | 748 | if opt.jobs is None: |
| @@ -823,7 +836,10 @@ later is required to fix a server side protocol bug. | |||
| 823 | for project in all_projects: | 836 | for project in all_projects: |
| 824 | pm.update() | 837 | pm.update() |
| 825 | if project.worktree: | 838 | if project.worktree: |
| 839 | start = time.time() | ||
| 826 | project.Sync_LocalHalf(syncbuf, force_sync=opt.force_sync) | 840 | project.Sync_LocalHalf(syncbuf, force_sync=opt.force_sync) |
| 841 | self.event_log.AddSync(project, event_log.TASK_SYNC_LOCAL, | ||
| 842 | start, time.time(), syncbuf.Recently()) | ||
| 827 | pm.end() | 843 | pm.end() |
| 828 | print(file=sys.stderr) | 844 | print(file=sys.stderr) |
| 829 | if not syncbuf.Finish(): | 845 | if not syncbuf.Finish(): |
| @@ -907,6 +923,7 @@ def _VerifyTag(project): | |||
| 907 | return False | 923 | return False |
| 908 | return True | 924 | return True |
| 909 | 925 | ||
| 926 | |||
| 910 | class _FetchTimes(object): | 927 | class _FetchTimes(object): |
| 911 | _ALPHA = 0.5 | 928 | _ALPHA = 0.5 |
| 912 | 929 | ||
