GitRepository.push: Add 'tags' option
authorLingchaox Xin <lingchaox.xin@intel.com>
Wed, 7 Aug 2013 07:16:21 +0000 (15:16 +0800)
committerGuido Günther <agx@sigxcpu.org>
Tue, 10 Sep 2013 07:17:23 +0000 (09:17 +0200)
Signed-off-by: Lingchaox Xin <lingchaox.xin@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
gbp/git/repository.py
tests/test_GitRepository.py

index 6389d2858fdba513e39b5cae85f2b177090afa13..9a67abf18628f0d62117cc70105aa80da7b310a3 100644 (file)
@@ -1077,7 +1077,8 @@ class GitRepository(object):
         args += [ repo ] if repo else []
         self._git_command("pull", args)
 
-    def push(self, repo=None, src=None, dst=None, ff_only=True, force=False):
+    def push(self, repo=None, src=None, dst=None, ff_only=True, force=False,
+             tags=False):
         """
         Push changes to the remote repo
 
@@ -1092,10 +1093,13 @@ class GitRepository(object):
         @param force: force push, can cause the remote repository to lose
         commits; use it with care
         @type force: C{bool}
+        @param tags: push all refs under refs/tags, in addition to other refs
+        @type tags: C{bool}
         """
         args = GitArgs()
         args.add_cond(repo, repo)
         args.add_true(force, "-f")
+        args.add_true(tags, "--tags")
 
         # Allow for src == '' to delete dst on the remote
         if src != None:
index 791cf70b7b717512d7245488f6b3ec4f90c3a4ab..b12f8d41e949b1e53bdce10dccccef6fb259a0ba 100644 (file)
@@ -618,6 +618,8 @@ def test_fetch():
     >>> clone.push('origin', 'master', force=True)
     >>> clone.create_tag('tag3')
     >>> clone.push_tag('origin', 'tag3')
+    >>> clone.create_tag('tag4')
+    >>> clone.push('origin', 'master', tags=True)
     >>> clone.add_remote_repo('foo', repo_dir)
     >>> clone.fetch('foo')
     >>> clone.fetch('foo', tags=True)