tot.py
def main(args):
    """This is the main entrypoint for fromupstream.

    Args:
        args: sys.argv[1:]

    Returns:
        An int return code.
    """
    parser = argparse.ArgumentParser()

    parser.add_argument('target', 
                        help='tot name or change id. tot names are '
                        'atf, blob, coreboot, depthcharge, ec, debug, kernel '
                        'and vboot. tot group name is fw.')
    parser.add_argument('-d', '--board', default="corsola",
                        help='board name, {cherry, default=corsola}')
    parser.add_argument('-b', '--branch', 
                        help="custom branch postfix. default is timestamp.")
    parser.add_argument('-p', '--pick', action="store_true",
                        help='change action from checkout to cherry-pick. '
                        'only available when target is change id.')
    parser.add_argument('-v', '--revision', 
                        help="checkout specific patchset. default is latest.")

    args = parser.parse_args(args)

    #  print('target', args.target)

    #  print('board', args.board)
    if args.board == 'cherry':
        BOARD = CHERRY
    elif args.board == 'corsola':
        BOARD = CORSOLA
    else:
        print('Error: unknown board name:', args.board)
        exit()

    pick = args.pick
    if pick:
        print(f'cherry-pick {args.target}...')
    else:
        print(f'checkout {args.target}...')

    branch_postfix = args.branch

    patchset = 9999
    if args.revision:
        patchset = int(args.revision)
        print(f'checkout patchset {patchset}...')

    change_id = 0
    tot_name = None
    try: 
        change_id = int(args.target)
        if pick:
            pick_target(change_id, patchset)
        else:
            checkout_target(change_id, branch_postfix, patchset)
    except ValueError:
        if pick:
            print('Error: cannot use --pick with tot name')
            exit()

        tot_name = args.target
        if tot_name not in BOARD and tot_name != 'fw':
            print('Error: Unknown tot name', tot_name)
            exit()

        if tot_name == 'fw':
            for name in FW_TOTS:
                print('\n>>>> checkout', name)
                change_id = BOARD[name]['change_id']

                git_path = f'{CROS_PATH}{BOARD[name]["path"]}'
                os.chdir(git_path)

                #  checkout_target(change_id, branch_postfix, patchset)
                checkout_main()
        else:
            change_id = BOARD[tot_name]['change_id']

            git_path = f'{CROS_PATH}{BOARD[tot_name]["path"]}'
            os.chdir(git_path)

            # append branch name to easily identify it
            if branch_postfix == None:
                branch_postfix = tot_name

            checkout_target(change_id, branch_postfix, patchset)
This is the main entrypoint for fromupstream.

    Args:
        args: sys.argv[1:]

    Returns:
        An int return code.
    
This is the main entrypoint for fromupstream.
This is the main entrypoint for fromupstream .
def main(args):
    parser = argparse.ArgumentParser()
    parser.add_argument('target', 
                        help='tot name or change id. tot names are '
                        'atf, blob, coreboot, depthcharge, ec, debug, kernel '
                        'and vboot. tot group name is fw.')
    parser.add_argument('-d', '--board', default="corsola",
                        help='board name, {cherry, default=corsola}')
    parser.add_argument('-b', '--branch', 
                        help="custom branch postfix. default is timestamp.")
    parser.add_argument('-p', '--pick', action="store_true",
                        help='change action from checkout to cherry-pick. '
                        'only available when target is change id.')
    parser.add_argument('-v', '--revision', 
                        help="checkout specific patchset. default is latest.")
    args = parser.parse_args(args)
    if args.board == 'cherry':
        BOARD = CHERRY
    elif args.board == 'corsola':
        BOARD = CORSOLA
    else:
        print('Error: unknown board name:', args.board)
        exit()
    pick = args.pick
    if pick:
        print(f'cherry-pick {args.target}...')
    else:
        print(f'checkout {args.target}...')
    branch_postfix = args.branch
    patchset = 9999
    if args.revision:
        patchset = int(args.revision)
        print(f'checkout patchset {patchset}...')
    change_id = 0
    tot_name = None
    try: 
        change_id = int(args.target)
        if pick:
            pick_target(change_id, patchset)
        else:
            checkout_target(change_id, branch_postfix, patchset)
    except ValueError:
        if pick:
            print('Error: cannot use --pick with tot name')
            exit()
        tot_name = args.target
        if tot_name not in BOARD and tot_name != 'fw':
            print('Error: Unknown tot name', tot_name)
            exit()
        if tot_name == 'fw':
            for name in FW_TOTS:
                print('\n>>>> checkout', name)
                change_id = BOARD[name]['change_id']
                git_path = f'{CROS_PATH}{BOARD[name]["path"]}'
                os.chdir(git_path)
                checkout_main()
        else:
            change_id = BOARD[tot_name]['change_id']
            git_path = f'{CROS_PATH}{BOARD[tot_name]["path"]}'
            os.chdir(git_path)
            if branch_postfix == None:
                branch_postfix = tot_name
            checkout_target(change_id, branch_postfix, patchset)
def main ( args ) : parser = argparse . ArgumentParser ( ) parser . add_argument ( 'target' , help = 'tot name or change id. tot names are ' 'atf, blob, coreboot, depthcharge, ec, debug, kernel ' 'and vboot. tot group name is fw.' ) parser . add_argument ( '-d' , '--board' , default = "corsola" , help = 'board name, {cherry, default=corsola}' ) parser . add_argument ( '-b' , '--branch' , help = "custom branch postfix. default is timestamp." ) parser . add_argument ( '-p' , '--pick' , action = "store_true" , help = 'change action from checkout to cherry-pick. ' 'only available when target is change id.' ) parser . add_argument ( '-v' , '--revision' , help = "checkout specific patchset. default is latest." ) args = parser . parse_args ( args ) if args . board == 'cherry' : BOARD = CHERRY elif args . board == 'corsola' : BOARD = CORSOLA else : print ( 'Error: unknown board name:' , args . board ) exit ( ) pick = args . pick if pick : print ( f'cherry-pick {args.target}...' ) else : print ( f'checkout {args.target}...' ) branch_postfix = args . branch patchset = 9999 if args . revision : patchset = int ( args . revision ) print ( f'checkout patchset {patchset}...' ) change_id = 0 tot_name = None try : change_id = int ( args . target ) if pick : pick_target ( change_id , patchset ) else : checkout_target ( change_id , branch_postfix , patchset ) except ValueError : if pick : print ( 'Error: cannot use --pick with tot name' ) exit ( ) tot_name = args . target if tot_name not in BOARD and tot_name != 'fw' : print ( 'Error: Unknown tot name' , tot_name ) exit ( ) if tot_name == 'fw' : for name in FW_TOTS : print ( '\n>>>> checkout' , name ) change_id = BOARD [ name ] [ 'change_id' ] git_path = f'{CROS_PATH}{BOARD[name]["path"]}' os . chdir ( git_path ) checkout_main ( ) else : change_id = BOARD [ tot_name ] [ 'change_id' ] git_path = f'{CROS_PATH}{BOARD[tot_name]["path"]}' os . chdir ( git_path ) if branch_postfix == None : branch_postfix = tot_name checkout_target ( change_id , branch_postfix , patchset )
This is the main entrypoint for fromupstream.
This is the main entrypoint for fromupstream .
"""This is the main entrypoint for fromupstream.

    Args:
        args: sys.argv[1:]

    Returns:
        An int return code.
    """ #  print('target', args.target) #  print('board', args.board) #  checkout_target(change_id, branch_postfix, patchset) # append branch name to easily identify it
An int return code.
An int return code .
args
None