parser.add_option('-T', '--thread', action='store_true', dest='thread', default=False, help='Create patches as a single thread') parser.usage += """ Create patches from commits in a branch, check them and email them as specified by tags you place in the commits. Use -n to do a dry run first.""" # Parse options twice: first to get the project and second to handle # defaults properly (which depends on project). (options, args) = parser.parse_args() settings.Setup(parser, options.project, '') (options, args) = parser.parse_args() if __name__ != "__main__": pass # Run our meagre tests elif options.test: import doctest import func_test sys.argv = [sys.argv[0]] result = unittest.TestResult() for module in (test.TestPatch, func_test.TestFunctional): suite = unittest.TestLoader().loadTestsFromTestCase(module) suite.run(result)
status.add_argument('-d', '--dest-branch', type=str, help='Name of branch to create with collected responses') status.add_argument('-f', '--force', action='store_true', help='Force overwriting an existing branch') # Parse options twice: first to get the project and second to handle # defaults properly (which depends on project) # Use parse_known_args() in case 'cmd' is omitted argv = sys.argv[1:] args, rest = parser.parse_known_args(argv) if hasattr(args, 'project'): settings.Setup(gitutil, parser, args.project, '') args, rest = parser.parse_known_args(argv) # If we have a command, it is safe to parse all arguments if args.cmd: args = parser.parse_args(argv) else: # No command, so insert it after the known arguments and before the ones # that presumably relate to the 'send' subcommand nargs = len(rest) argv = argv[:-nargs] + ['send'] + rest args = parser.parse_args(argv) if __name__ != "__main__": pass
help="Specify the SMTP server to 'git send-email'") parser.add_option('--test', action='store_true', dest='test', default=False, help='run tests') parser.usage += """ Create patches from commits in a branch, check them and email them as specified by tags you place in the commits. Use -n to do a dry run first.""" # Parse options twice: first to get the project and second to handle # defaults properly (which depends on project). (options, args) = parser.parse_args() settings.Setup(gitutil, parser, options.project, '') (options, args) = parser.parse_args() if __name__ != "__main__": pass # Run our meagre tests elif options.test: import doctest from patman import func_test sys.argv = [sys.argv[0]] result = unittest.TestResult() for module in (test_checkpatch.TestPatch, func_test.TestFunctional): suite = unittest.TestLoader().loadTestsFromTestCase(module) suite.run(result)
type=str, help='Name of branch to create with collected responses') status.add_argument('-f', '--force', action='store_true', help='Force overwriting an existing branch') AddCommonArgs(status) # Parse options twice: first to get the project and second to handle # defaults properly (which depends on project). argv = sys.argv[1:] if len(argv) < 1 or argv[0].startswith('-'): argv = ['send'] + argv args = parser.parse_args(argv) if hasattr(args, 'project'): settings.Setup(gitutil, send, args.project, '') args = parser.parse_args(argv) if __name__ != "__main__": pass if not args.debug: sys.tracebacklimit = 0 # Run our meagre tests if args.cmd == 'test': import doctest from patman import func_test sys.argv = [sys.argv[0]] result = unittest.TestResult()