From 460d10262dae14b54123ff45e7548d872ff63983 Mon Sep 17 00:00:00 2001 From: Sverre Rabbelier Date: Sat, 16 Jul 2011 15:03:31 +0200 Subject: git-remote-testgit: fix error handling If fast-export did not complete successfully the error handling code itself would error out. This was broken in commit 23b093ee0 (Brandon Casey, Wed Jun 9 2010, Remove python 2.5'isms). Revert that commit an introduce our own copy of check_call in util.py instead. Tested by changing 'if retcode' to 'if not retcode' temporarily. Signed-off-by: Sverre Rabbelier Acked-by: Jeff King Signed-off-by: Junio C Hamano --- git_remote_helpers/git/non_local.py | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'git_remote_helpers/git/non_local.py') diff --git a/git_remote_helpers/git/non_local.py b/git_remote_helpers/git/non_local.py index c53e07445a..e70025095d 100644 --- a/git_remote_helpers/git/non_local.py +++ b/git_remote_helpers/git/non_local.py @@ -1,7 +1,7 @@ import os import subprocess -from git_remote_helpers.util import die, warn +from git_remote_helpers.util import check_call, die, warn class NonLocalGit(object): @@ -29,9 +29,7 @@ class NonLocalGit(object): os.makedirs(path) args = ["git", "clone", "--bare", "--quiet", self.repo.gitpath, path] - child = subprocess.Popen(args) - if child.wait() != 0: - raise CalledProcessError + check_call(args) return path @@ -45,14 +43,10 @@ class NonLocalGit(object): die("could not find repo at %s", path) args = ["git", "--git-dir=" + path, "fetch", "--quiet", self.repo.gitpath] - child = subprocess.Popen(args) - if child.wait() != 0: - raise CalledProcessError + check_call(args) args = ["git", "--git-dir=" + path, "update-ref", "refs/heads/master", "FETCH_HEAD"] - child = subprocess.Popen(args) - if child.wait() != 0: - raise CalledProcessError + child = check_call(args) def push(self, base): """Pushes from the non-local repo to base. @@ -64,6 +58,4 @@ class NonLocalGit(object): die("could not find repo at %s", path) args = ["git", "--git-dir=" + path, "push", "--quiet", self.repo.gitpath, "--all"] - child = subprocess.Popen(args) - if child.wait() != 0: - raise CalledProcessError + child = check_call(args) -- cgit v1.2.1