Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: testing_support/git/repo.py

Issue 533213002: Added timezone info for the start date for the fake commits. (Closed) Base URL: https://chromium.googlesource.com/infra/testing/testing_support@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « testing_support/__init__.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import atexit 5 import atexit
6 import collections 6 import collections
7 import datetime 7 import datetime
8 import os 8 import os
9 import pytz
iannucci 2014/09/03 15:28:33 there's not pytz dep for testing_support... why no
9 import shutil 10 import shutil
10 import subprocess 11 import subprocess
11 import sys 12 import sys
12 import tempfile 13 import tempfile
13 14
14 15
15 from testing_support.git.schema import GitRepoSchema 16 from testing_support.git.schema import GitRepoSchema
16 17
17 18
18 class GitRepo(object): 19 class GitRepo(object):
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 Automatically creates a temp folder under GitRepo.BASE_TEMP_DIR. It's 63 Automatically creates a temp folder under GitRepo.BASE_TEMP_DIR. It's
63 recommended that you clean this repo up by calling nuke() on it, but if not, 64 recommended that you clean this repo up by calling nuke() on it, but if not,
64 GitRepo will automatically clean up all allocated repos at the exit of the 65 GitRepo will automatically clean up all allocated repos at the exit of the
65 program (assuming a normal exit like with sys.exit) 66 program (assuming a normal exit like with sys.exit)
66 67
67 Args: 68 Args:
68 schema - An instance of GitRepoSchema 69 schema - An instance of GitRepoSchema
69 """ 70 """
70 self.repo_path = tempfile.mkdtemp(dir=self.BASE_TEMP_DIR) 71 self.repo_path = tempfile.mkdtemp(dir=self.BASE_TEMP_DIR)
71 self.commit_map = {} 72 self.commit_map = {}
72 self._date = datetime.datetime(1970, 1, 1) 73 self._date = datetime.datetime(1970, 1, 1, tzinfo=pytz.utc)
73 74
74 self.to_schema_refs = ['--branches'] 75 self.to_schema_refs = ['--branches']
75 76
76 self.git('init') 77 self.git('init')
77 self.git('config', 'user.name', 'testcase') 78 self.git('config', 'user.name', 'testcase')
78 self.git('config', 'user.email', 'testcase@example.com') 79 self.git('config', 'user.email', 'testcase@example.com')
79 for commit in schema.walk(): 80 for commit in schema.walk():
80 self._add_schema_commit(commit, schema.data_for(commit.name)) 81 self._add_schema_commit(commit, schema.data_for(commit.name))
81 self.last_commit = self[commit.name] 82 self.last_commit = self[commit.name]
82 if schema.master: 83 if schema.master:
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 else: 230 else:
230 assert current is not None 231 assert current is not None
231 hash_to_msg[current] = line 232 hash_to_msg[current] = line
232 ret.add_partial(line) 233 ret.add_partial(line)
233 for parent in parents: 234 for parent in parents:
234 ret.add_partial(line, hash_to_msg[parent]) 235 ret.add_partial(line, hash_to_msg[parent])
235 current = None 236 current = None
236 parents = [] 237 parents = []
237 assert current is None 238 assert current is None
238 return ret 239 return ret
OLDNEW
« no previous file with comments | « testing_support/__init__.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698