diff options
author | Lingchaox Xin <lingchaox.xin@intel.com> | 2013-07-05 17:09:50 +0800 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2013-09-10 09:16:23 +0200 |
commit | 68baa9a3934a22339f164499a75cf771489c9781 (patch) | |
tree | f1c948aa5e97673dcd80aeb0d40a086c09261c7b /gbp/git/repository.py | |
parent | b9b9eeaa6b5b8d4974826f33eedb1ba5d65843de (diff) |
GitRepository.push: Add 'force' option
Signed-off-by: Lingchaox Xin <lingchaox.xin@intel.com>
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Diffstat (limited to 'gbp/git/repository.py')
-rw-r--r-- | gbp/git/repository.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gbp/git/repository.py b/gbp/git/repository.py index 7d52216..6389d28 100644 --- a/gbp/git/repository.py +++ b/gbp/git/repository.py @@ -1077,7 +1077,7 @@ 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): + def push(self, repo=None, src=None, dst=None, ff_only=True, force=False): """ Push changes to the remote repo @@ -1089,9 +1089,13 @@ class GitRepository(object): @type dst: C{str} @param ff_only: only push if it's a fast forward update @type ff_only: C{bool} + @param force: force push, can cause the remote repository to lose + commits; use it with care + @type force: C{bool} """ args = GitArgs() args.add_cond(repo, repo) + args.add_true(force, "-f") # Allow for src == '' to delete dst on the remote if src != None: @@ -1101,6 +1105,7 @@ class GitRepository(object): if not ff_only: refspec = '+%s' % refspec args.add(refspec) + self._git_command("push", args.args) def push_tag(self, repo, tag): |