From f8c4001e35a91b902b38c3eee89875e9c7aaeb7b Mon Sep 17 00:00:00 2001 From: Alexander Schepanovski Date: Fri, 31 Jan 2020 00:03:41 +0700 Subject: [PATCH] scm: add git pull/push to Git --- dvc/scm/git/__init__.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dvc/scm/git/__init__.py b/dvc/scm/git/__init__.py index 90c648bc5f..167177ad0e 100644 --- a/dvc/scm/git/__init__.py +++ b/dvc/scm/git/__init__.py @@ -215,8 +215,15 @@ def checkout(self, branch, create_new=False): else: self.repo.git.checkout(branch) + def pull(self): + info, = self.repo.remote().pull() + if info.flags & info.ERROR: + raise SCMError("pull failed: {}".format(info.note)) + def push(self): - self.repo.remote().push() + info, = self.repo.remote().push() + if info.flags & info.ERROR: + raise SCMError("push failed: {}".format(info.summary)) def branch(self, branch): self.repo.git.branch(branch)