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

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

Issue 539553002: Removed dependency on pytz (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 | « no previous file | 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
10 import shutil 9 import shutil
11 import subprocess 10 import subprocess
12 import sys 11 import sys
13 import tempfile 12 import tempfile
14 13
15 14
16 from testing_support.git.schema import GitRepoSchema 15 from testing_support.git.schema import GitRepoSchema
17 16
18 17
19 class GitRepo(object): 18 class GitRepo(object):
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 """Makes new GitRepo. 60 """Makes new GitRepo.
62 61
63 Automatically creates a temp folder under GitRepo.BASE_TEMP_DIR. It's 62 Automatically creates a temp folder under GitRepo.BASE_TEMP_DIR. It's
64 recommended that you clean this repo up by calling nuke() on it, but if not, 63 recommended that you clean this repo up by calling nuke() on it, but if not,
65 GitRepo will automatically clean up all allocated repos at the exit of the 64 GitRepo will automatically clean up all allocated repos at the exit of the
66 program (assuming a normal exit like with sys.exit) 65 program (assuming a normal exit like with sys.exit)
67 66
68 Args: 67 Args:
69 schema - An instance of GitRepoSchema 68 schema - An instance of GitRepoSchema
70 """ 69 """
70 class UTC(datetime.tzinfo):
71 def utcoffset(self, dt): return datetime.timedelta(0)
72
71 self.repo_path = tempfile.mkdtemp(dir=self.BASE_TEMP_DIR) 73 self.repo_path = tempfile.mkdtemp(dir=self.BASE_TEMP_DIR)
72 self.commit_map = {} 74 self.commit_map = {}
73 self._date = datetime.datetime(1970, 1, 1, tzinfo=pytz.utc) 75 self._date = datetime.datetime(1970, 1, 1, tzinfo=UTC())
74 76
75 self.to_schema_refs = ['--branches'] 77 self.to_schema_refs = ['--branches']
76 78
77 self.git('init') 79 self.git('init')
78 self.git('config', 'user.name', 'testcase') 80 self.git('config', 'user.name', 'testcase')
79 self.git('config', 'user.email', 'testcase@example.com') 81 self.git('config', 'user.email', 'testcase@example.com')
80 for commit in schema.walk(): 82 for commit in schema.walk():
81 self._add_schema_commit(commit, schema.data_for(commit.name)) 83 self._add_schema_commit(commit, schema.data_for(commit.name))
82 self.last_commit = self[commit.name] 84 self.last_commit = self[commit.name]
83 if schema.master: 85 if schema.master:
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 else: 232 else:
231 assert current is not None 233 assert current is not None
232 hash_to_msg[current] = line 234 hash_to_msg[current] = line
233 ret.add_partial(line) 235 ret.add_partial(line)
234 for parent in parents: 236 for parent in parents:
235 ret.add_partial(line, hash_to_msg[parent]) 237 ret.add_partial(line, hash_to_msg[parent])
236 current = None 238 current = None
237 parents = [] 239 parents = []
238 assert current is None 240 assert current is None
239 return ret 241 return ret
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698