diff options
Diffstat (limited to 'subcmds/sync.py')
| -rw-r--r-- | subcmds/sync.py | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index 3eab2fcf..5655a1e6 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
| @@ -738,36 +738,30 @@ later is required to fix a server side protocol bug. | |||
| 738 | fd.close() | 738 | fd.close() |
| 739 | return 0 | 739 | return 0 |
| 740 | 740 | ||
| 741 | def Execute(self, opt, args): | 741 | def ValidateOptions(self, opt, args): |
| 742 | if opt.jobs: | ||
| 743 | self.jobs = opt.jobs | ||
| 744 | if self.jobs > 1: | ||
| 745 | soft_limit, _ = _rlimit_nofile() | ||
| 746 | self.jobs = min(self.jobs, (soft_limit - 5) // 3) | ||
| 747 | |||
| 748 | if opt.force_broken: | 742 | if opt.force_broken: |
| 749 | print('warning: -f/--force-broken is now the default behavior, and the ' | 743 | print('warning: -f/--force-broken is now the default behavior, and the ' |
| 750 | 'options are deprecated', file=sys.stderr) | 744 | 'options are deprecated', file=sys.stderr) |
| 751 | if opt.network_only and opt.detach_head: | 745 | if opt.network_only and opt.detach_head: |
| 752 | print('error: cannot combine -n and -d', file=sys.stderr) | 746 | self.OptionParser.error('cannot combine -n and -d') |
| 753 | sys.exit(1) | ||
| 754 | if opt.network_only and opt.local_only: | 747 | if opt.network_only and opt.local_only: |
| 755 | print('error: cannot combine -n and -l', file=sys.stderr) | 748 | self.OptionParser.error('cannot combine -n and -l') |
| 756 | sys.exit(1) | ||
| 757 | if opt.manifest_name and opt.smart_sync: | 749 | if opt.manifest_name and opt.smart_sync: |
| 758 | print('error: cannot combine -m and -s', file=sys.stderr) | 750 | self.OptionParser.error('cannot combine -m and -s') |
| 759 | sys.exit(1) | ||
| 760 | if opt.manifest_name and opt.smart_tag: | 751 | if opt.manifest_name and opt.smart_tag: |
| 761 | print('error: cannot combine -m and -t', file=sys.stderr) | 752 | self.OptionParser.error('cannot combine -m and -t') |
| 762 | sys.exit(1) | ||
| 763 | if opt.manifest_server_username or opt.manifest_server_password: | 753 | if opt.manifest_server_username or opt.manifest_server_password: |
| 764 | if not (opt.smart_sync or opt.smart_tag): | 754 | if not (opt.smart_sync or opt.smart_tag): |
| 765 | print('error: -u and -p may only be combined with -s or -t', | 755 | self.OptionParser.error('-u and -p may only be combined with -s or -t') |
| 766 | file=sys.stderr) | ||
| 767 | sys.exit(1) | ||
| 768 | if None in [opt.manifest_server_username, opt.manifest_server_password]: | 756 | if None in [opt.manifest_server_username, opt.manifest_server_password]: |
| 769 | print('error: both -u and -p must be given', file=sys.stderr) | 757 | self.OptionParser.error('both -u and -p must be given') |
| 770 | sys.exit(1) | 758 | |
| 759 | def Execute(self, opt, args): | ||
| 760 | if opt.jobs: | ||
| 761 | self.jobs = opt.jobs | ||
| 762 | if self.jobs > 1: | ||
| 763 | soft_limit, _ = _rlimit_nofile() | ||
| 764 | self.jobs = min(self.jobs, (soft_limit - 5) // 3) | ||
| 771 | 765 | ||
| 772 | if opt.manifest_name: | 766 | if opt.manifest_name: |
| 773 | self.manifest.Override(opt.manifest_name) | 767 | self.manifest.Override(opt.manifest_name) |
