From e3336e4da76ada192a2ba1a8297761a7e95969b8 Mon Sep 17 00:00:00 2001 From: Zhang Qiang Date: Tue, 3 Sep 2013 13:45:20 +0800 Subject: [PATCH] track upstream/pristine-tar branch automatically This enable tarball generation from upstream/pristine-tar branch and patch generation if upstream/pristine-tar branches exist in remote branch. Fixes: #1230 Change-Id: I9b846d1ae670e31bc5c0b429a0cabf641281fe7a --- gitbuildsys/cmd_export.py | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/gitbuildsys/cmd_export.py b/gitbuildsys/cmd_export.py index 446580d..cbb7565 100644 --- a/gitbuildsys/cmd_export.py +++ b/gitbuildsys/cmd_export.py @@ -74,28 +74,19 @@ def check_export_branches(repo, args): give warning if pristine-tar/upstream branch exist in remote but have not been checkout to local ''' - remote_branches = [branch.split('/')[-1] for branch in \ - repo.get_remote_branches()] + remote_branches = {} + for branch in repo.get_remote_branches(): + remote_branches[branch.split('/')[-1]] = branch if args.upstream_branch: upstream_branch = args.upstream_branch else: upstream_branch = configmgr.get('upstream_branch', 'general') - # upstream exist, but pristine-tar not exist - if repo.has_branch(upstream_branch) and \ - not repo.has_branch('pristine-tar') and \ - 'pristine-tar' in remote_branches: - log.warning('pristine-tar branch exist in remote branches, ' - 'you can checkout it to enable exporting upstrean ' - 'tarball from pristine-tar branch') - - # all upstream and pristine-tar are not exist - if not repo.has_branch(upstream_branch) and \ - not repo.has_branch('pristine-tar') and \ - 'pristine-tar' in remote_branches and upstream_branch in remote_branches: - log.warning('pristine-tar and %s branches exist in remote branches, ' - 'you can checkout them to enable upstream tarball and ' - 'patch-generation ' % upstream_branch) + # track upstream/pristine-tar branch + for br in [upstream_branch, 'pristine-tar']: + if not repo.has_branch(br) and br in remote_branches: + log.info('tracking branch: %s -> %s' % (remote_branches[br], br)) + repo.create_branch(br, remote_branches[br]) def create_gbp_export_args(repo, commit, export_dir, tmp_dir, spec, args, force_native=False, create_tarball=True): -- 2.7.4