From 5e18b605d39548f9811b9192dda6eec0b0743318 Mon Sep 17 00:00:00 2001 From: Josip Sokcevic Date: Thu, 23 Apr 2020 21:47:00 +0000 Subject: [PATCH] Fix git cl upload on Windows Use ISO8601 time format standard to avoid localized result and need to encode. R=ehmaldonado@chromium.org Bug: 1074002 Change-Id: I95c2ddd55a9661351f2b45601f7bba24c2951c31 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2163401 Reviewed-by: Edward Lesmes Commit-Queue: Josip Sokcevic --- git_cl.py | 5 +---- tests/git_cl_test.py | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/git_cl.py b/git_cl.py index 6c0c280f1..fc2ecad49 100755 --- a/git_cl.py +++ b/git_cl.py @@ -2029,10 +2029,7 @@ class Changelist(object): git_info_dir = tempfile.mkdtemp() git_info_zip = trace_name + '-git-info' - git_push_metadata['now'] = datetime_now().strftime('%c') - if sys.stdin.encoding and sys.stdin.encoding != 'utf-8': - git_push_metadata['now'] = git_push_metadata['now'].decode( - sys.stdin.encoding) + git_push_metadata['now'] = datetime_now().strftime('%Y-%m-%dT%H:%M:%S.%f') git_push_metadata['trace_name'] = trace_name gclient_utils.FileWrite( diff --git a/tests/git_cl_test.py b/tests/git_cl_test.py index 0ddc5a999..29c88d5d6 100755 --- a/tests/git_cl_test.py +++ b/tests/git_cl_test.py @@ -858,9 +858,6 @@ class TestGitCl(unittest.TestCase): final_description = final_description or post_amend_description.strip() - date_format = ('03/16/17 20:00:41' - if sys.platform == 'win32' and sys.version_info.major == 2 - else 'Thu Mar 16 20:00:41 2017') trace_name = os.path.join('TRACES_DIR', '20170316T200041.000000') # Trace-related calls @@ -877,7 +874,7 @@ class TestGitCl(unittest.TestCase): '1000\n' '0\n' '%(trace_name)s' % { - 'date': date_format, + 'date': '2017-03-16T20:00:41.000000', 'short_hostname': short_hostname, 'change_id': change_id, 'description': final_description,