init: organize command line options a bit

We've grown a lot of options in here and it's hard to make sense of
them.  Add more groups to try and make it easier to pick things out.

Change-Id: I6b9dc0e83f96137f974baf82d3fb86992b857bd2
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/302803
Reviewed-by: Raman Tenneti <rtenneti@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
Mike Frysinger 2021-04-08 23:04:36 -04:00
parent 65af2602b5
commit a1051d8baa

46
repo
View File

@ -298,6 +298,20 @@ def InitParser(parser, gitc_init=False):
help='manifest branch or revision (use HEAD for default)') help='manifest branch or revision (use HEAD for default)')
group.add_option('-m', '--manifest-name', group.add_option('-m', '--manifest-name',
help='initial manifest file', metavar='NAME.xml') help='initial manifest file', metavar='NAME.xml')
group.add_option('-g', '--groups', default='default',
help='restrict manifest projects to ones with specified '
'group(s) [default|all|G1,G2,G3|G4,-G5,-G6]',
metavar='GROUP')
group.add_option('-p', '--platform', default='auto',
help='restrict manifest projects to ones with a specified '
'platform group [auto|all|none|linux|darwin|...]',
metavar='PLATFORM')
group.add_option('--submodules', action='store_true',
help='sync any submodules associated with the manifest repo')
# Options that only affect manifest project, and not any of the projects
# specified in the manifest itself.
group = parser.add_option_group('Manifest (only) checkout options')
cbr_opts = ['--current-branch'] cbr_opts = ['--current-branch']
# The gitc-init subcommand allocates -c itself, but a lot of init users # The gitc-init subcommand allocates -c itself, but a lot of init users
# want -c, so try to satisfy both as best we can. # want -c, so try to satisfy both as best we can.
@ -306,9 +320,23 @@ def InitParser(parser, gitc_init=False):
group.add_option(*cbr_opts, group.add_option(*cbr_opts,
dest='current_branch_only', action='store_true', dest='current_branch_only', action='store_true',
help='fetch only current manifest branch from server') help='fetch only current manifest branch from server')
group.add_option('--no-tags',
dest='tags', default=True, action='store_false',
help="don't fetch tags in the manifest")
# These are fundamentally different ways of structuring the checkout.
group = parser.add_option_group('Checkout modes')
group.add_option('--mirror', action='store_true', group.add_option('--mirror', action='store_true',
help='create a replica of the remote repositories ' help='create a replica of the remote repositories '
'rather than a client working directory') 'rather than a client working directory')
group.add_option('--archive', action='store_true',
help='checkout an archive instead of a git repository for '
'each project. See git archive.')
group.add_option('--worktree', action='store_true',
help='use git-worktree to manage projects')
# These are fundamentally different ways of structuring the checkout.
group = parser.add_option_group('Project checkout optimizations')
group.add_option('--reference', group.add_option('--reference',
help='location of mirror directory', metavar='DIR') help='location of mirror directory', metavar='DIR')
group.add_option('--dissociate', action='store_true', group.add_option('--dissociate', action='store_true',
@ -325,35 +353,17 @@ def InitParser(parser, gitc_init=False):
group.add_option('--clone-filter', action='store', default='blob:none', group.add_option('--clone-filter', action='store', default='blob:none',
help='filter for use with --partial-clone ' help='filter for use with --partial-clone '
'[default: %default]') '[default: %default]')
group.add_option('--worktree', action='store_true',
help='use git-worktree to manage projects')
group.add_option('--archive', action='store_true',
help='checkout an archive instead of a git repository for '
'each project. See git archive.')
group.add_option('--submodules', action='store_true',
help='sync any submodules associated with the manifest repo')
group.add_option('--use-superproject', action='store_true', default=None, group.add_option('--use-superproject', action='store_true', default=None,
help='use the manifest superproject to sync projects') help='use the manifest superproject to sync projects')
group.add_option('--no-use-superproject', action='store_false', group.add_option('--no-use-superproject', action='store_false',
dest='use_superproject', dest='use_superproject',
help='disable use of manifest superprojects') help='disable use of manifest superprojects')
group.add_option('-g', '--groups', default='default',
help='restrict manifest projects to ones with specified '
'group(s) [default|all|G1,G2,G3|G4,-G5,-G6]',
metavar='GROUP')
group.add_option('-p', '--platform', default='auto',
help='restrict manifest projects to ones with a specified '
'platform group [auto|all|none|linux|darwin|...]',
metavar='PLATFORM')
group.add_option('--clone-bundle', action='store_true', group.add_option('--clone-bundle', action='store_true',
help='enable use of /clone.bundle on HTTP/HTTPS ' help='enable use of /clone.bundle on HTTP/HTTPS '
'(default if not --partial-clone)') '(default if not --partial-clone)')
group.add_option('--no-clone-bundle', group.add_option('--no-clone-bundle',
dest='clone_bundle', action='store_false', dest='clone_bundle', action='store_false',
help='disable use of /clone.bundle on HTTP/HTTPS (default if --partial-clone)') help='disable use of /clone.bundle on HTTP/HTTPS (default if --partial-clone)')
group.add_option('--no-tags',
dest='tags', default=True, action='store_false',
help="don't fetch tags in the manifest")
# Tool. # Tool.
group = parser.add_option_group('repo Version options') group = parser.add_option_group('repo Version options')