diff options
author | Guido Günther <agx@sigxcpu.org> | 2012-01-10 14:47:23 +0100 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2012-01-10 16:09:49 +0100 |
commit | 205854df1f005bf8c8732f6b32492ede3a130c28 (patch) | |
tree | 74d6193a1e55ddd5236208b1b040dd01a1e8b703 /gbp/git | |
parent | 3ad38b7ba4d52ee36339a1dab608c8ff8c2ec96c (diff) |
GitRepository: add push() and push_tag()
Diffstat (limited to 'gbp/git')
-rw-r--r-- | gbp/git/repository.py | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py index df49b1db..e8692c0d 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -673,6 +673,44 @@ 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): + """ + Push changes to the remote repo + + @param repo: repository to push to + @type repo: C{str} + @param src: the source ref to push + @type src: C{str} + @param dst: the name of the destination ref to push to + @type dst: C{str} + @param ff_only: only push if it's a fast forward update + @type ff_only: C{bool} + """ + args = GitArgs() + args.add_cond(repo, repo) + + # Allow for src == '' to delete dst on the remote + if src != None: + refspec = src + if dst: + refspec += ':%s' % dst + if not ff_only: + refspec = '+%s' % refspec + args.add(refspec) + self._git_command("push", args.args) + + def push_tag(self, repo, tag): + """ + Push a tag to the remote repo + + @param repo: repository to push to + @type repo: C{str} + @param tag: the name of the tag + @type tag: C{str} + """ + args = GitArgs(repo, 'tag', tag) + self._git_command("push", args.args) + #{ Files def add_files(self, paths, force=False, index_file=None, work_tree=None): |