Commit 62e01023 authored by Guido Günther's avatar Guido Günther

push: Allow to skip upstream and debian branch and tag push

Push of tag and or branch can be skipped by setting
--{upstream,debian}-{branch,tag}='' .

Closes: #899234
parent 29b9f2ce
......@@ -104,7 +104,7 @@
<listitem>
<para>
The branch in the Git repository the Debian package is being
developed on.
developed on. If set to the empty value the branch will not be pushed.
</para>
</listitem>
</varlistentry>
......@@ -114,6 +114,7 @@
<para>
Use this tag format when looking for tags corresponding to a &debian;
version. Default is <replaceable>debian/%(version)s</replaceable>.
If set to the empty value the tag will not be pushed.
</para>
</listitem>
</varlistentry>
......@@ -122,7 +123,7 @@
<listitem>
<para>
The branch in the &git; repository the upstream sources are put
onto.
onto. If set to the empty value the branch will not be pushed.
</para>
</listitem>
</varlistentry>
......@@ -133,6 +134,7 @@
Use this tag format when looking for tags of upstream
versions. Default
is <replaceable>upstream/%(version)s</replaceable>.
If set to the empty value the tag will not be pushed.
</para>
</listitem>
</varlistentry>
......
......@@ -143,18 +143,23 @@ def main(argv):
if not dest:
dest = get_remote(repo, branch)
dtag = repo.version_to_tag(options.debian_tag, source.version)
if repo.has_tag(dtag):
to_push['tags'].append(dtag)
if source.is_releasable() and branch:
ref = 'refs/heads/%s' % branch
to_push['refs'][ref] = get_push_src(repo, ref, dtag)
if options.debian_tag != '':
dtag = repo.version_to_tag(options.debian_tag, source.version)
if repo.has_tag(dtag):
to_push['tags'].append(dtag)
if source.is_releasable() and branch:
ref = 'refs/heads/%s' % branch
to_push['refs'][ref] = get_push_src(repo, ref, dtag)
if not source.is_native():
utag = repo.version_to_tag(options.upstream_tag,
source.upstream_version)
if repo.has_tag(utag):
to_push['tags'].append(utag)
if options.upstream_tag != '':
utag = repo.version_to_tag(options.upstream_tag,
source.upstream_version)
if repo.has_tag(utag):
to_push['tags'].append(utag)
if options.upstream_branch != '':
ref = 'refs/heads/%s' % options.upstream_branch
to_push['refs'][ref] = get_push_src(repo, ref, utag)
......
......@@ -73,6 +73,15 @@ class TestPush(ComponentTestBase):
['upstream'],
tags=['debian/2.8-1', 'upstream/2.8'])
@RepoFixtures.quilt30()
def test_push_skip_upstream(self, repo):
repo.add_remote_repo('origin', self.target.path)
self.assertEquals(push(['argv0', '--upstream-branch=']), 0)
self._check_repo_state(self.target, 'master',
['master'],
tags=['debian/2.8-1', 'upstream/2.8'])
self.assertEquals(repo.head, self.target.head)
@RepoFixtures.native()
def test_push_tag_ne_branch(self, repo):
repo.add_remote_repo('origin', self.target.path)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment