aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2016-06-28 16:58:31 +0200
committerGuido Günther <agx@sigxcpu.org>2016-06-28 17:07:43 +0200
commit0f1426faaa6386ef9d3c8cabab6b45c47eb0e063 (patch)
tree70cd8a794fc922dce76e8f1d874c41d9ef2aa2ab
parentdb077c97e9b42abf34d9b4e492383dc43a5e03d3 (diff)
import_orig: Simplify the import_branch vs upstream_branch logic
We don't need both if we don't insist on the first branch in a repo being master.
-rw-r--r--gbp/scripts/import_orig.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/gbp/scripts/import_orig.py b/gbp/scripts/import_orig.py
index 6bcde54..733465c 100644
--- a/gbp/scripts/import_orig.py
+++ b/gbp/scripts/import_orig.py
@@ -356,6 +356,7 @@ def main(argv):
tmpdir = ''
pristine_orig = None
linked = False
+ repo = None
(options, args) = parse_args(argv)
if not options:
@@ -417,26 +418,26 @@ def main(argv):
pass
try:
- upstream_branch = [ options.upstream_branch, 'master' ][is_empty]
+ import_branch = options.upstream_branch
filter_msg = ["", " (filtering out %s)"
% options.filters][len(options.filters) > 0]
gbp.log.info("Importing '%s' to branch '%s'%s..." % (source.path,
- upstream_branch,
+ import_branch,
filter_msg))
gbp.log.info("Source package is %s" % sourcepackage)
gbp.log.info("Upstream version is %s" % version)
- import_branch = [ options.upstream_branch, None ][is_empty]
msg = upstream_import_commit_msg(options, version)
commit = repo.commit_dir(source.unpacked,
msg=msg,
branch=import_branch,
other_parents=repo.vcs_tag_parent(options.vcs_tag, version),
+ create_missing_branch=is_empty,
)
if options.pristine_tar:
if pristine_orig:
- repo.pristine_tar.commit(pristine_orig, upstream_branch)
+ repo.pristine_tar.commit(pristine_orig, import_branch)
else:
gbp.log.warn("'%s' not an archive, skipping pristine-tar" % source.path)
@@ -446,10 +447,8 @@ def main(argv):
sign=options.sign_tags,
keyid=options.keyid)
if is_empty:
- repo.create_branch(options.upstream_branch, rev=commit)
- repo.force_head(options.upstream_branch, hard=True)
- if options.debian_branch != 'master':
- repo.rename_branch('master', options.debian_branch)
+ repo.create_branch(branch=options.debian_branch, rev=commit)
+ repo.force_head(options.debian_branch, hard=True)
elif options.merge:
debian_branch_merge(repo, tag, version, options)