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

Side by Side Diff: testing_support/git_test_utils.py

Issue 1064933004: git-squash-branch: handle empty squashes and dirty trees (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « git_squash_branch.py ('k') | tests/git_cl_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2013 The Chromium Authors. All rights reserved. 1 # Copyright 2013 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 copy 7 import copy
8 import datetime 8 import datetime
9 import hashlib 9 import hashlib
10 import os 10 import os
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 val = commit_data[key] 342 val = commit_data[key]
343 else: 343 else:
344 if suffix == 'DATE': 344 if suffix == 'DATE':
345 val = self._date 345 val = self._date
346 self._date += datetime.timedelta(days=1) 346 self._date += datetime.timedelta(days=1)
347 else: 347 else:
348 val = getattr(self, 'DEFAULT_%s' % singleton) 348 val = getattr(self, 'DEFAULT_%s' % singleton)
349 env['GIT_%s' % singleton] = str(val) 349 env['GIT_%s' % singleton] = str(val)
350 return env 350 return env
351 351
352
353 def git(self, *args, **kwargs): 352 def git(self, *args, **kwargs):
354 """Runs a git command specified by |args| in this repo.""" 353 """Runs a git command specified by |args| in this repo."""
355 assert self.repo_path is not None 354 assert self.repo_path is not None
356 try: 355 try:
357 with open(os.devnull, 'wb') as devnull: 356 with open(os.devnull, 'wb') as devnull:
358 output = subprocess.check_output( 357 output = subprocess.check_output(
359 ('git',) + args, cwd=self.repo_path, stderr=devnull, **kwargs) 358 ('git',) + args, cwd=self.repo_path, stderr=devnull, **kwargs)
360 return self.COMMAND_OUTPUT(0, output) 359 return self.COMMAND_OUTPUT(0, output)
361 except subprocess.CalledProcessError as e: 360 except subprocess.CalledProcessError as e:
362 return self.COMMAND_OUTPUT(e.returncode, e.output) 361 return self.COMMAND_OUTPUT(e.returncode, e.output)
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 super(GitRepoReadWriteTestBase, self).setUp() 497 super(GitRepoReadWriteTestBase, self).setUp()
499 self.repo = self.r_schema.reify() 498 self.repo = self.r_schema.reify()
500 499
501 def tearDown(self): 500 def tearDown(self):
502 self.repo.nuke() 501 self.repo.nuke()
503 super(GitRepoReadWriteTestBase, self).tearDown() 502 super(GitRepoReadWriteTestBase, self).tearDown()
504 503
505 def assertSchema(self, schema_string): 504 def assertSchema(self, schema_string):
506 self.assertEqual(GitRepoSchema(schema_string).simple_graph(), 505 self.assertEqual(GitRepoSchema(schema_string).simple_graph(),
507 self.repo.to_schema().simple_graph()) 506 self.repo.to_schema().simple_graph())
OLDNEW
« no previous file with comments | « git_squash_branch.py ('k') | tests/git_cl_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698