From 7af6c4dc8092362d609338fec88141b3ef8fda51 Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Mon, 26 Sep 2011 21:04:18 +0000 Subject: [PATCH] Use universal EOL conversion when calling the text editor in gcl. This was causing issues for windows user with notepad2. Fix trychange.py on python2.5. R=dpranke@chromium.org BUG= TEST= Review URL: http://codereview.chromium.org/8038028 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@102797 0039d316-1c4b-4281-b951-d872f2087c98 --- gcl.py | 4 ++-- presubmit_support.py | 4 ++-- tests/gcl_unittest.py | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gcl.py b/gcl.py index 0c8fbb61ef..dffc566330 100755 --- a/gcl.py +++ b/gcl.py @@ -532,7 +532,7 @@ class ChangeInfo(object): if fail_on_not_found: ErrorExit("Changelist " + changename + " not found.") return ChangeInfo(changename, 0, 0, '', None, local_root, None, False) - content = gclient_utils.FileRead(info_file, 'r') + content = gclient_utils.FileRead(info_file) save = False try: values = ChangeInfo._LoadNewFormat(content) @@ -1137,7 +1137,7 @@ def CMDchange(args): subprocess2.check_call(cmd, shell=True) except subprocess2.CalledProcessError, e: ErrorExit('Editor returned %d' % e.returncode) - result = gclient_utils.FileRead(filename, 'r') + result = gclient_utils.FileRead(filename) finally: os.remove(filename) diff --git a/presubmit_support.py b/presubmit_support.py index fa2261a7ff..85b3a3f70c 100755 --- a/presubmit_support.py +++ b/presubmit_support.py @@ -897,9 +897,9 @@ class GetTrySlavesExecuter(object): if function_name in context: get_preferred_try_slaves = context[function_name] function_info = inspect.getargspec(get_preferred_try_slaves) - if len(function_info.args) == 1: + if len(function_info[0]) == 1: result = get_preferred_try_slaves(project) - elif len(function_info.args) == 2: + elif len(function_info[0]) == 2: result = get_preferred_try_slaves(project, change) else: result = get_preferred_try_slaves() diff --git a/tests/gcl_unittest.py b/tests/gcl_unittest.py index 2cccc60dae..e013df2e24 100755 --- a/tests/gcl_unittest.py +++ b/tests/gcl_unittest.py @@ -216,7 +216,7 @@ class ChangeInfoUnittest(GclTestsBase): description = ["This is some description.", "force an extra separator."] gcl.GetChangelistInfoFile('bleh').AndReturn('bleeeh') gcl.os.path.exists('bleeeh').AndReturn(True) - gcl.gclient_utils.FileRead('bleeeh', 'r').AndReturn( + gcl.gclient_utils.FileRead('bleeeh').AndReturn( gcl.ChangeInfo._SEPARATOR.join(["42, 53", "G b.cc"] + description)) gcl.GetCodeReviewSetting('CODE_REVIEW_SERVER').AndReturn('foo') # Does an upgrade. @@ -236,7 +236,7 @@ class ChangeInfoUnittest(GclTestsBase): self.mox.StubOutWithMock(gcl, 'GetCodeReviewSetting') gcl.GetChangelistInfoFile('bleh').AndReturn('bleeeh') gcl.os.path.exists('bleeeh').AndReturn(True) - gcl.gclient_utils.FileRead('bleeeh', 'r').AndReturn( + gcl.gclient_utils.FileRead('bleeeh').AndReturn( gcl.ChangeInfo._SEPARATOR.join(["", "", ""])) gcl.GetCodeReviewSetting('CODE_REVIEW_SERVER').AndReturn('foo') # Does an upgrade.