diff options
Diffstat (limited to 'repo')
-rwxr-xr-x | repo | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -265,9 +265,12 @@ def GetParser(gitc_init=False): | |||
265 | 265 | ||
266 | # Logging. | 266 | # Logging. |
267 | group = parser.add_option_group('Logging options') | 267 | group = parser.add_option_group('Logging options') |
268 | group.add_option('-v', '--verbose', | ||
269 | dest='output_mode', action='store_true', | ||
270 | help='show all output') | ||
268 | group.add_option('-q', '--quiet', | 271 | group.add_option('-q', '--quiet', |
269 | action='store_true', default=False, | 272 | dest='output_mode', action='store_false', |
270 | help='be quiet') | 273 | help='only show errors') |
271 | 274 | ||
272 | # Manifest. | 275 | # Manifest. |
273 | group = parser.add_option_group('Manifest options') | 276 | group = parser.add_option_group('Manifest options') |
@@ -468,6 +471,8 @@ def _Init(args, gitc_init=False): | |||
468 | if args: | 471 | if args: |
469 | parser.print_usage() | 472 | parser.print_usage() |
470 | sys.exit(1) | 473 | sys.exit(1) |
474 | opt.quiet = opt.output_mode is False | ||
475 | opt.verbose = opt.output_mode is True | ||
471 | 476 | ||
472 | url = opt.repo_url | 477 | url = opt.repo_url |
473 | if not url: | 478 | if not url: |
@@ -527,7 +532,7 @@ def _Init(args, gitc_init=False): | |||
527 | do_verify = True | 532 | do_verify = True |
528 | 533 | ||
529 | dst = os.path.abspath(os.path.join(repodir, S_repo)) | 534 | dst = os.path.abspath(os.path.join(repodir, S_repo)) |
530 | _Clone(url, dst, opt.quiet, opt.clone_bundle) | 535 | _Clone(url, dst, opt.clone_bundle, opt.quiet, opt.verbose) |
531 | 536 | ||
532 | if do_verify: | 537 | if do_verify: |
533 | rev = _Verify(dst, branch, opt.quiet) | 538 | rev = _Verify(dst, branch, opt.quiet) |
@@ -746,7 +751,7 @@ def _InitHttp(): | |||
746 | urllib.request.install_opener(urllib.request.build_opener(*handlers)) | 751 | urllib.request.install_opener(urllib.request.build_opener(*handlers)) |
747 | 752 | ||
748 | 753 | ||
749 | def _Fetch(url, cwd, src, quiet): | 754 | def _Fetch(url, cwd, src, quiet, verbose): |
750 | if not quiet: | 755 | if not quiet: |
751 | print('Get %s' % url, file=sys.stderr) | 756 | print('Get %s' % url, file=sys.stderr) |
752 | 757 | ||
@@ -762,7 +767,7 @@ def _Fetch(url, cwd, src, quiet): | |||
762 | run_git(*cmd, stderr=err, cwd=cwd) | 767 | run_git(*cmd, stderr=err, cwd=cwd) |
763 | 768 | ||
764 | 769 | ||
765 | def _DownloadBundle(url, cwd, quiet): | 770 | def _DownloadBundle(url, cwd, quiet, verbose): |
766 | if not url.endswith('/'): | 771 | if not url.endswith('/'): |
767 | url += '/' | 772 | url += '/' |
768 | url += 'clone.bundle' | 773 | url += 'clone.bundle' |
@@ -812,12 +817,12 @@ def _DownloadBundle(url, cwd, quiet): | |||
812 | def _ImportBundle(cwd): | 817 | def _ImportBundle(cwd): |
813 | path = os.path.join(cwd, '.git', 'clone.bundle') | 818 | path = os.path.join(cwd, '.git', 'clone.bundle') |
814 | try: | 819 | try: |
815 | _Fetch(cwd, cwd, path, True) | 820 | _Fetch(cwd, cwd, path, True, False) |
816 | finally: | 821 | finally: |
817 | os.remove(path) | 822 | os.remove(path) |
818 | 823 | ||
819 | 824 | ||
820 | def _Clone(url, cwd, quiet, clone_bundle): | 825 | def _Clone(url, cwd, clone_bundle, quiet, verbose): |
821 | """Clones a git repository to a new subdirectory of repodir | 826 | """Clones a git repository to a new subdirectory of repodir |
822 | """ | 827 | """ |
823 | try: | 828 | try: |
@@ -834,9 +839,9 @@ def _Clone(url, cwd, quiet, clone_bundle): | |||
834 | _SetConfig(cwd, | 839 | _SetConfig(cwd, |
835 | 'remote.origin.fetch', | 840 | 'remote.origin.fetch', |
836 | '+refs/heads/*:refs/remotes/origin/*') | 841 | '+refs/heads/*:refs/remotes/origin/*') |
837 | if clone_bundle and _DownloadBundle(url, cwd, quiet): | 842 | if clone_bundle and _DownloadBundle(url, cwd, quiet, verbose): |
838 | _ImportBundle(cwd) | 843 | _ImportBundle(cwd) |
839 | _Fetch(url, cwd, 'origin', quiet) | 844 | _Fetch(url, cwd, 'origin', quiet, verbose) |
840 | 845 | ||
841 | 846 | ||
842 | def _Verify(cwd, branch, quiet): | 847 | def _Verify(cwd, branch, quiet): |