diff options
author | Guido Günther <agx@sigxcpu.org> | 2022-01-26 08:57:12 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2022-02-11 14:21:14 +0100 |
commit | caf64cb15e794fc7e13974fab19ce932cf6f563c (patch) | |
tree | c4c992b65e5184211a1128e009247103572dfb23 /gbp/scripts/push.py | |
parent | 63ce4ed556815d0ff9650f1b70b8b11c8e313111 (diff) |
push: Make --debian-tag='' match the documentation
An empty Debian tag indicates "don't care" about the packaging branch.
Don't fail in that case but rather push out up to the branch tip:
Currently we'd fail like
$ gbp push --debian-tag='' guido
Traceback (most recent call last):
File "/usr/bin/gbp", line 149, in <module>
sys.exit(supercommand())
File "/usr/bin/gbp", line 145, in supercommand
return module.main(args)
File "/usr/lib/python3/dist-packages/gbp/scripts/push.py", line 153, in main
to_push['refs'].append((ref, get_push_src(repo, ref, dtag)))
UnboundLocalError: local variable 'dtag' referenced before assignment
this make it simple to push the current development work via
gbp push --debian-tag='' <remote>
Diffstat (limited to 'gbp/scripts/push.py')
-rwxr-xr-x | gbp/scripts/push.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gbp/scripts/push.py b/gbp/scripts/push.py index 8233ace8..d6876e26 100755 --- a/gbp/scripts/push.py +++ b/gbp/scripts/push.py @@ -133,6 +133,8 @@ def main(argv): try: source = DebianSource(repo.path) branch = repo.branch + dtag = None + if not options.ignore_branch: if branch != options.debian_branch: gbp.log.err("You are not on branch '%s' but %s" % @@ -148,9 +150,13 @@ def main(argv): if repo.has_tag(dtag): to_push['tags'].append(dtag) - if source.is_releasable() and branch: + if branch: ref = 'refs/heads/%s' % branch - to_push['refs'].append((ref, get_push_src(repo, ref, dtag))) + if source.is_releasable() and dtag: + to_push['refs'].append((ref, get_push_src(repo, ref, dtag))) + elif not dtag: + # --debian-tag='': Push branch up to tip + to_push['refs'].append((ref, get_push_src(repo, ref, ref))) if not source.is_native(): if options.upstream_tag != '': |