diff --git a/gclient_utils.py b/gclient_utils.py index 7558b4266..cf2cedec5 100644 --- a/gclient_utils.py +++ b/gclient_utils.py @@ -27,13 +27,19 @@ import xml.dom.minidom import xml.parsers.expat -class CheckCallError(OSError): +class Error(Exception): + """gclient exception class.""" + pass + + +class CheckCallError(OSError, Error): """CheckCall() returned non-0.""" - def __init__(self, command, cwd, retcode, stdout, stderr=None): - OSError.__init__(self, command, cwd, retcode, stdout, stderr) + def __init__(self, command, cwd, returncode, stdout, stderr=None): + OSError.__init__(self, command, cwd, returncode, stdout, stderr) + Error.__init__(self) self.command = command self.cwd = cwd - self.retcode = retcode + self.returncode = returncode self.stdout = stdout self.stderr = stderr @@ -111,12 +117,6 @@ def GetNodeNamedAttributeText(node, node_name, attribute_name): return child_nodes[0].getAttribute(attribute_name) -class Error(Exception): - """gclient exception class.""" - # TODO(maruel): Merge with CheckCallError. - pass - - def SyntaxErrorToError(filename, e): """Raises a gclient_utils.Error exception with the human readable message""" try: diff --git a/tests/fake_repos.py b/tests/fake_repos.py index a797e64fc..aa07dfa58 100755 --- a/tests/fake_repos.py +++ b/tests/fake_repos.py @@ -596,7 +596,7 @@ class FakeReposTestBase(unittest.TestCase): self.assertEquals(expected, result, msg) def check(self, expected, results): - """Checks stdout, stderr, retcode.""" + """Checks stdout, stderr, returncode.""" self.checkString(expected[0], results[0]) self.checkString(expected[1], results[1]) self.assertEquals(expected[2], results[2]) diff --git a/tests/gclient_utils_test.py b/tests/gclient_utils_test.py index 43c5dd911..4b230cb21 100755 --- a/tests/gclient_utils_test.py +++ b/tests/gclient_utils_test.py @@ -65,7 +65,7 @@ class CheckCallTestCase(GclientUtilBase): except gclient_utils.CheckCallError, e: self.assertEqual(e.command, args) self.assertEqual(e.cwd, None) - self.assertEqual(e.retcode, 42) + self.assertEqual(e.returncode, 42) self.assertEqual(e.stdout, 'bleh') self.assertEqual(e.stderr, 'foo') diff --git a/trychange.py b/trychange.py index 7cd90b9b0..f1ea12ddc 100755 --- a/trychange.py +++ b/trychange.py @@ -430,10 +430,10 @@ def GuessVCS(options, path): real_path) return GIT(options, path) except gclient_utils.CheckCallError, e: - if e.retcode != errno.ENOENT and e.retcode != 128: + if e.returncode != errno.ENOENT and e.returncode != 128: # ENOENT == 2 = they don't have git installed. # 128 = git error code when not in a repo. - logging.warn(e.retcode) + logging.warn(e.returncode) raise raise NoTryServerAccess("Could not guess version control system. " "Are you in a working copy directory?")