

def run_generator(generator, arguments):
    try:
        gen = generator
        try_execute('generator handle arguments', '', gen.handle_arguments, arguments)
        try_execute('generator summarize', '', gen.summarize)
        if arguments.interactive:
            if (not maybe_continue('y')):
                error('Answered no to continue, aborting.', exit=True)
        try_execute('generator pre_modify', '', gen.pre_modify)
        for branch_args in generator.get_branching_arguments():
            parsed_branch_args = parse_branch_args(branch_args, arguments.interactive)
            (destination, source, interactive) = parsed_branch_args
            msg = summarize_branch_cmd(destination, source, interactive)
            try_execute('generator pre_branch', msg, gen.pre_branch, destination, source)
            try_execute('git-bloom-branch', msg, execute_branch, source, destination, source)
            try_execute('generator post_branch', msg, gen.post_branch, destination, source)
            try_execute('generator pre_export_patches', msg, gen.pre_export_patches, destination)
            try_execute('git-bloom-patch export', msg, export_patches)
            try_execute('generator post_export_patches', msg, gen.post_export_patches, destination)
            try_execute('generator pre_rebase', msg, gen.pre_rebase, destination)
            ret = try_execute('git-bloom-patch rebase', msg, rebase_patches)
            try_execute('generator post_rebase', msg, gen.post_rebase, destination)
            try_execute('generator pre_patch', msg, gen.pre_patch, destination)
            if (ret == 0):
                try_execute('git-bloom-patch import', msg, import_patches)
            elif (ret < 0):
                debug('Skipping patching because rebase did not run.')
            try_execute('generator post_patch', msg, gen.post_patch, destination)
    except CommandFailed as err:
        sys.exit((err.returncode or 1))

dataset/ETHPy150Open ros-infrastructure/bloom/bloom/commands/git/generate.py run_generator/VarMisuse@154/239 `interactive`->`source`