diff options
-rw-r--r-- | subcmds/sync.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index 3b4c23c5..3eab2fcf 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -132,8 +132,8 @@ from the user's .netrc file. | |||
132 | if the manifest server specified in the manifest file already includes | 132 | if the manifest server specified in the manifest file already includes |
133 | credentials. | 133 | credentials. |
134 | 134 | ||
135 | The -f/--force-broken option can be used to proceed with syncing | 135 | By default, all projects will be synced. The --fail-fast option can be used |
136 | other projects if a project sync fails. | 136 | to halt syncing as soon as possible when the the first project fails to sync. |
137 | 137 | ||
138 | The --force-sync option can be used to overwrite existing git | 138 | The --force-sync option can be used to overwrite existing git |
139 | directories if they have previously been linked to a different | 139 | directories if they have previously been linked to a different |
@@ -199,8 +199,10 @@ later is required to fix a server side protocol bug. | |||
199 | self.jobs = 1 | 199 | self.jobs = 1 |
200 | 200 | ||
201 | p.add_option('-f', '--force-broken', | 201 | p.add_option('-f', '--force-broken', |
202 | dest='force_broken', action='store_true', | 202 | help='obsolete option (to be deleted in the future)') |
203 | help="continue sync even if a project fails to sync") | 203 | p.add_option('--fail-fast', |
204 | dest='fail_fast', action='store_true', | ||
205 | help='stop syncing after first error is hit') | ||
204 | p.add_option('--force-sync', | 206 | p.add_option('--force-sync', |
205 | dest='force_sync', action='store_true', | 207 | dest='force_sync', action='store_true', |
206 | help="overwrite an existing git directory if it needs to " | 208 | help="overwrite an existing git directory if it needs to " |
@@ -284,7 +286,7 @@ later is required to fix a server side protocol bug. | |||
284 | try: | 286 | try: |
285 | for project in projects: | 287 | for project in projects: |
286 | success = self._FetchHelper(opt, project, *args, **kwargs) | 288 | success = self._FetchHelper(opt, project, *args, **kwargs) |
287 | if not success and not opt.force_broken: | 289 | if not success and opt.fail_fast: |
288 | break | 290 | break |
289 | finally: | 291 | finally: |
290 | sem.release() | 292 | sem.release() |
@@ -343,10 +345,7 @@ later is required to fix a server side protocol bug. | |||
343 | print('error: Cannot fetch %s from %s' | 345 | print('error: Cannot fetch %s from %s' |
344 | % (project.name, project.remote.url), | 346 | % (project.name, project.remote.url), |
345 | file=sys.stderr) | 347 | file=sys.stderr) |
346 | if opt.force_broken: | 348 | if opt.fail_fast: |
347 | print('warn: --force-broken, continuing to sync', | ||
348 | file=sys.stderr) | ||
349 | else: | ||
350 | raise _FetchError() | 349 | raise _FetchError() |
351 | 350 | ||
352 | fetched.add(project.gitdir) | 351 | fetched.add(project.gitdir) |
@@ -384,7 +383,7 @@ later is required to fix a server side protocol bug. | |||
384 | for project_list in objdir_project_map.values(): | 383 | for project_list in objdir_project_map.values(): |
385 | # Check for any errors before running any more tasks. | 384 | # Check for any errors before running any more tasks. |
386 | # ...we'll let existing threads finish, though. | 385 | # ...we'll let existing threads finish, though. |
387 | if err_event.isSet() and not opt.force_broken: | 386 | if err_event.isSet() and opt.fail_fast: |
388 | break | 387 | break |
389 | 388 | ||
390 | sem.acquire() | 389 | sem.acquire() |
@@ -410,7 +409,7 @@ later is required to fix a server side protocol bug. | |||
410 | t.join() | 409 | t.join() |
411 | 410 | ||
412 | # If we saw an error, exit with code 1 so that other scripts can check. | 411 | # If we saw an error, exit with code 1 so that other scripts can check. |
413 | if err_event.isSet() and not opt.force_broken: | 412 | if err_event.isSet() and opt.fail_fast: |
414 | print('\nerror: Exited sync due to fetch errors', file=sys.stderr) | 413 | print('\nerror: Exited sync due to fetch errors', file=sys.stderr) |
415 | sys.exit(1) | 414 | sys.exit(1) |
416 | 415 | ||
@@ -532,7 +531,7 @@ later is required to fix a server side protocol bug. | |||
532 | for project in all_projects: | 531 | for project in all_projects: |
533 | # Check for any errors before running any more tasks. | 532 | # Check for any errors before running any more tasks. |
534 | # ...we'll let existing threads finish, though. | 533 | # ...we'll let existing threads finish, though. |
535 | if err_event.isSet() and not opt.force_broken: | 534 | if err_event.isSet() and opt.fail_fast: |
536 | break | 535 | break |
537 | 536 | ||
538 | sem.acquire() | 537 | sem.acquire() |
@@ -746,6 +745,9 @@ later is required to fix a server side protocol bug. | |||
746 | soft_limit, _ = _rlimit_nofile() | 745 | soft_limit, _ = _rlimit_nofile() |
747 | self.jobs = min(self.jobs, (soft_limit - 5) // 3) | 746 | self.jobs = min(self.jobs, (soft_limit - 5) // 3) |
748 | 747 | ||
748 | if opt.force_broken: | ||
749 | print('warning: -f/--force-broken is now the default behavior, and the ' | ||
750 | 'options are deprecated', file=sys.stderr) | ||
749 | if opt.network_only and opt.detach_head: | 751 | if opt.network_only and opt.detach_head: |
750 | print('error: cannot combine -n and -d', file=sys.stderr) | 752 | print('error: cannot combine -n and -d', file=sys.stderr) |
751 | sys.exit(1) | 753 | sys.exit(1) |