Commit 940e6780 authored by Michal Čihař's avatar Michal Čihař

Support for pushing

Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 13a6316f
......@@ -46,6 +46,10 @@ class VCSGitTest(RepoTestCase):
repo.last_remote_revision
)
def test_remote_update(self):
def test_update_remote(self):
repo = GitRepository.clone(self.repo_path, self._tempdir)
repo.update_remote()
def test_push(self):
repo = GitRepository.clone(self.repo_path, self._tempdir)
repo.push('master')
......@@ -40,6 +40,7 @@ class Repository(object):
_cmd_last_remote_revision = None
_cmd_clone = 'clone'
_cmd_update_remote = None
_cmd_push = None
def __init__(self, path):
self.path = path
......@@ -91,10 +92,16 @@ class Repository(object):
def update_remote(self):
"""
Updates remote branch.
Updates remote repository.
"""
self._execute(self._cmd_update_remote)
def push(self, branch):
"""
Pushes given branch to remote repository.
"""
self._execute(self._cmd_push + [branch])
class GitRepository(Repository):
"""
......@@ -108,3 +115,4 @@ class GitRepository(Repository):
'log', '-n', '1', '--format=format:%H', '@{upstream}'
]
_cmd_update_remote = ['remote', 'update', 'origin']
_cmd_push = ['push', 'origin']
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