def CMDpresubmit(parser, args):
    'Runs presubmit tests on the current changelist.'
    parser.add_option('-u', '--upload', action='store_true', help='Run upload hook instead of the push/dcommit hook')
    parser.add_option('-f', '--force', action='store_true', help='Run checks even if tree is dirty')
    auth.add_auth_options(parser)
    (options, args) = parser.parse_args(args)
    auth_config = auth.extract_auth_config_from_options(options)
    if ((not options.force) and git_common.is_dirty_git_tree('presubmit')):
        print('use --force to check even if tree is dirty.')
        return 1
    cl = Changelist(auth_config=auth_config)
    if args:
        base_branch = args[0]
    else:
        base_branch = cl.GetCommonAncestorWithUpstream()
    cl.RunHook(committing=(not options.upload), may_prompt=False, verbose=options.verbose, change=cl.GetChange(base_branch, None))
    return 0
Runs presubmit tests on the current changelist.
def CMDpresubmit(parser, args):
    
    parser.add_option('-u', '--upload', action='store_true', help='Run upload hook instead of the push/dcommit hook')
    parser.add_option('-f', '--force', action='store_true', help='Run checks even if tree is dirty')
    auth.add_auth_options(parser)
    (options, args) = parser.parse_args(args)
    auth_config = auth.extract_auth_config_from_options(options)
    if ((not options.force) and git_common.is_dirty_git_tree('presubmit')):
        print('use --force to check even if tree is dirty.')
        return 1
    cl = Changelist(auth_config=auth_config)
    if args:
        base_branch = args[0]
    else:
        base_branch = cl.GetCommonAncestorWithUpstream()
    cl.RunHook(committing=(not options.upload), may_prompt=False, verbose=options.verbose, change=cl.GetChange(base_branch, None))
    return 0