def parser(cls, parser, loggers=None): output_args = arguments.LoggingGroup( parser, loggers=loggers, help='{} amount of logging and commit information displayed') output_args.add_argument( '--json', '-j', help='Convert the commit to a machine-readable JSON object', action='store_true', dest='json', default=False, ) output_args.add_argument( '--log', '--no-log', help='Include the commit message for the requested commit', action=arguments.NoAction, dest='include_log', default=True, ) parser.add_argument( 'argument', nargs=1, type=str, default=None, help='String representation of a commit or branch to be normalized', )
def main(args=None, path=None, loggers=None, contributors=None, identifier_template=None, subversion=None): logging.basicConfig(level=logging.WARNING) loggers = [logging.getLogger(), webkitcorepy_log, log] + (loggers or []) parser = argparse.ArgumentParser( description= 'Custom git tooling from the WebKit team to interact with a ' + 'repository using identifers', ) arguments.LoggingGroup(parser) group = parser.add_argument_group('Repository') group.add_argument( '--path', '-p', '-C', dest='repository', default=path or os.getcwd(), help='Set the repository path or URL to be used', action='store', ) subparsers = parser.add_subparsers(help='sub-command help') programs = [Find, Info, Checkout, Canonicalize, Pull, Clean] if subversion: programs.append(SetupGitSvn) for program in programs: subparser = subparsers.add_parser(program.name, help=program.help) subparser.set_defaults(main=program.main) program.parser(subparser, loggers=loggers) parsed = parser.parse_args(args=args) if parsed.repository.startswith(('https://', 'http://')): repository = remote.Scm.from_url(parsed.repository, contributors=contributors) else: repository = local.Scm.from_path(path=parsed.repository, contributors=contributors) if not getattr(parsed, 'main', None): parser.print_help() return -1 return parsed.main( args=parsed, repository=repository, identifier_template=identifier_template, subversion=subversion, )
def parser(cls, parser, loggers=None): arguments.LoggingGroup( parser, loggers=loggers, help='{} amount of logging and commit information displayed') parser.add_argument( 'argument', nargs=1, type=str, default=None, help='String representation of a commit or branch to be normalized', )
def parser(cls, parser, loggers=None): output_args = arguments.LoggingGroup( parser, loggers=loggers, help='{} amount of logging and `git rebase` information displayed' ) output_args.add_argument( '--identifier', '--no-identifier', help='Add in the identifier to commit messages, true by default', action=arguments.NoAction, dest='identifier', default=True, ) output_args.add_argument( '--remote', help='Compare against a different remote', dest='remote', default='origin', )
def main(args=None, path=None, loggers=None, contributors=None): logging.basicConfig(level=logging.WARNING) loggers = [logging.getLogger(), webkitcorepy_log, log] + (loggers or []) parser = argparse.ArgumentParser( description= 'Custom git tooling from the WebKit team to interact with a ' + 'repository using identifers', ) arguments.LoggingGroup(parser) group = parser.add_argument_group('Repository') group.add_argument( '--path', '-p', '-C', dest='repository', default=path or os.getcwd(), help='Set the repository path or URL to be used', action='store', ) subparsers = parser.add_subparsers(help='sub-command help') for program in [Find, Checkout]: subparser = subparsers.add_parser(program.name, help=program.help) subparser.set_defaults(main=program.main) program.parser(subparser, loggers=loggers) parsed = parser.parse_args(args=args) if parsed.repository.startswith(('https://', 'http://')): repository = remote.Scm.from_url(parsed.repository, contributors=contributors) else: repository = local.Scm.from_path(path=parsed.repository, contributors=contributors) return parsed.main(args=parsed, repository=repository)