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
@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:
if not ff_only:
refspec = '+%s' % refspec
args.add(refspec)
+
self._git_command("push", args.args)
def push_tag(self, repo, tag):
>>> clone.push()
>>> clone.push('origin')
>>> clone.push('origin', 'master')
+ >>> clone.push('origin', 'master', force=True)
>>> clone.create_tag('tag3')
>>> clone.push_tag('origin', 'tag3')
>>> clone.add_remote_repo('foo', repo_dir)