diff options
author | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-02-12 15:11:30 +0200 |
---|---|---|
committer | Markus Lehtonen <markus.lehtonen@linux.intel.com> | 2014-11-14 14:47:19 +0200 |
commit | 57d8ddc329e57d4e5d91ae77f87f307db35cfa98 (patch) | |
tree | 34f5a00853eeb9370368394085f0f63ebfa1b4b8 /gbp | |
parent | 1fe0501df0521c0657d59006e5a0bfd71f58491c (diff) | |
download | git-buildpackage-57d8ddc329e57d4e5d91ae77f87f307db35cfa98.tar.gz git-buildpackage-57d8ddc329e57d4e5d91ae77f87f307db35cfa98.tar.bz2 git-buildpackage-57d8ddc329e57d4e5d91ae77f87f307db35cfa98.zip |
import-orig-rpm: implement --create-missing-branches option
Create the upstream branch if it does not exist. Use the same option
name that import-srpm has.
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp')
-rwxr-xr-x | gbp/scripts/import_orig_rpm.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/gbp/scripts/import_orig_rpm.py b/gbp/scripts/import_orig_rpm.py index 8eacfb2b..a8f874c6 100755 --- a/gbp/scripts/import_orig_rpm.py +++ b/gbp/scripts/import_orig_rpm.py @@ -159,6 +159,9 @@ def parse_args(argv): help="Upstream VCS tag add to the merge commit") branch_group.add_boolean_config_file_option(option_name="merge", dest="merge") branch_group.add_config_file_option(option_name="packaging-dir", dest="packaging_dir") + branch_group.add_boolean_config_file_option( + option_name="create-missing-branches", + dest="create_missing_branches") tag_group.add_boolean_config_file_option(option_name="sign-tags", dest="sign_tags") @@ -214,9 +217,14 @@ def main(argv): initial_branch = repo.get_branch() is_empty = False if initial_branch else True - if not repo.has_branch(options.upstream_branch) and not is_empty: - gbp.log.err(no_upstream_branch_msg % options.upstream_branch) - raise GbpError + if not repo.has_branch(options.upstream_branch): + if options.create_missing_branches: + gbp.log.info("Will create missing branch '%s'" % + options.upstream_branch) + elif is_empty: + options.create_missing_branches = True + else: + raise GbpError(no_upstream_branch_msg % options.upstream_branch) (sourcepackage, version) = detect_name_and_version(repo, source, options) @@ -262,11 +270,10 @@ def main(argv): parents = None commit = repo.commit_dir(unpacked_orig, - msg=msg, - branch=options.upstream_branch, - other_parents=parents, - create_missing_branch=True, - ) + msg=msg, + branch=options.upstream_branch, + other_parents=parents, + create_missing_branch=options.create_missing_branches) if options.pristine_tar and pristine_orig: gbp.log.info("Pristine-tar: commiting %s" % pristine_orig) repo.pristine_tar.commit(pristine_orig, options.upstream_branch) |