def update_cache_objects(gittree, objdir, input): env = make_proxy_env(input) if not os.path.isdir(objdir): git.clone(gittree, objdir, options=['--bare'], env=env) else: git.set_origin(gittree, objdir) git.remote_update(objdir, env=env)
branches = [ r.strip() for r in config.get(tree, 'branches').split(',') ] update_cache_objects(input, kernelobjdir, input=True) wgitref = os.path.join(cachedir, 'backport-' + tree) update_cache_objects(output, wgitref, input=False) for branch in branches: with tempdir.tempdir() as branch_tmpdir: wgitdir = os.path.join(branch_tmpdir, 'work.git') git.clone(output, wgitdir, [ '--reference', wgitref, '--bare', '--single-branch', '--branch', branch ]) git.remove_config('core.bare', tree=wgitdir) git.set_origin(output, wgitdir) env = make_proxy_env(True) kernel_head = git.ls_remote(branch, tree=kernelobjdir, env=env) backport_author_env = { 'GIT_AUTHOR_NAME': SCRIPT_GIT_NAME, 'GIT_AUTHOR_EMAIL': SCRIPT_GIT_EMAIL, } old_data = {}
defconfig = None if config.has_option(tree, 'defconfig'): defconfig = config.get(tree, 'defconfig') branches = [r.strip() for r in config.get(tree, 'branches').split(',')] update_cache_objects(input, kernelobjdir, input=True) wgitref = os.path.join(cachedir, 'backport-' + tree) update_cache_objects(output, wgitref, input=False) for branch in branches: with tempdir.tempdir() as branch_tmpdir: wgitdir = os.path.join(branch_tmpdir, 'work.git') git.clone(output, wgitdir, ['--reference', wgitref, '--bare', '--single-branch', '--branch', branch]) git.remove_config('core.bare', tree=wgitdir) git.set_origin(output, wgitdir) env = make_proxy_env(True) kernel_head = git.ls_remote(branch, tree=kernelobjdir, env=env) backport_author_env = { 'GIT_AUTHOR_NAME': SCRIPT_GIT_NAME, 'GIT_AUTHOR_EMAIL': SCRIPT_GIT_EMAIL, } old_data = {} try: msg = git.commit_message('HEAD', wgitdir) for line in msg.split('\n'):
def update_cache_objects(gittree, objdir): if not os.path.isdir(objdir): git.clone(gittree, objdir, options=['--bare']) else: git.set_origin(gittree, objdir) git.remote_update(objdir)