Adds the branch parser to the given subparsers object.
(subparsers, _)
| 15 | |
| 16 | |
| 17 | def parser(subparsers, _): |
| 18 | """Adds the branch parser to the given subparsers object.""" |
| 19 | desc = 'list, create, delete, or edit branches' |
| 20 | branch_parser = subparsers.add_parser( |
| 21 | 'branch', help=desc, description=desc.capitalize()) |
| 22 | |
| 23 | list_group = branch_parser.add_argument_group('list branches') |
| 24 | list_group.add_argument( |
| 25 | '-r', '--remote', |
| 26 | help='list remote branches in addition to local branches', |
| 27 | action='store_true') |
| 28 | list_group.add_argument( |
| 29 | '-v', '--verbose', help='be verbose, will output the head of each branch', |
| 30 | action='store_true') |
| 31 | |
| 32 | create_group = branch_parser.add_argument_group('create branches') |
| 33 | create_group.add_argument( |
| 34 | '-c', '--create', nargs='+', help='create branch(es)', dest='create_b', |
| 35 | metavar='branch') |
| 36 | create_group.add_argument( |
| 37 | '-dp', '--divergent-point', |
| 38 | help='the commit from where to \'branch out\' (only relevant if a new ' |
| 39 | 'branch is created; defaults to HEAD)', dest='dp') |
| 40 | |
| 41 | delete_group = branch_parser.add_argument_group('delete branches') |
| 42 | delete_group.add_argument( |
| 43 | '-d', '--delete', nargs='+', help='delete branch(es)', dest='delete_b', |
| 44 | metavar='branch') |
| 45 | |
| 46 | edit_group = branch_parser.add_argument_group('edit the current branch') |
| 47 | edit_group.add_argument( |
| 48 | '-sh', '--set-head', help='set the head of the current branch', |
| 49 | dest='new_head', metavar='commit_id') |
| 50 | edit_group.add_argument( |
| 51 | '-su', '--set-upstream', |
| 52 | help='set the upstream branch of the current branch', |
| 53 | dest='upstream_b', metavar='branch') |
| 54 | edit_group.add_argument( |
| 55 | '-uu', '--unset-upstream', |
| 56 | help='unset the upstream branch of the current branch', |
| 57 | action='store_true') |
| 58 | |
| 59 | branch_parser.set_defaults(func=main) |
| 60 | |
| 61 | |
| 62 | def main(args, repo): |
nothing calls this directly
no outgoing calls
no test coverage detected