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

Side by Side Diff: Tools/Scripts/webkitpy/common/checkout/scm/scm_unittest.py

Issue 397383002: Fix webkitpy scm_unittests so that they pass again. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: patch for review Created 6 years, 5 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
OLDNEW
1 # Copyright (C) 2009 Google Inc. All rights reserved. 1 # Copyright (C) 2009 Google Inc. All rights reserved.
2 # Copyright (C) 2009 Apple Inc. All rights reserved. 2 # Copyright (C) 2009 Apple Inc. All rights reserved.
3 # Copyright (C) 2011 Daniel Bates (dbates@intudata.com). All rights reserved. 3 # Copyright (C) 2011 Daniel Bates (dbates@intudata.com). All rights reserved.
4 # 4 #
5 # Redistribution and use in source and binary forms, with or without 5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are 6 # modification, are permitted provided that the following conditions are
7 # met: 7 # met:
8 # 8 #
9 # * Redistributions of source code must retain the above copyright 9 # * Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer. 10 # notice, this list of conditions and the following disclaimer.
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 def tearDown(self): 373 def tearDown(self):
374 super(GitSVNTest, self).tearDown() 374 super(GitSVNTest, self).tearDown()
375 self._tear_down_svn_checkout() 375 self._tear_down_svn_checkout()
376 self._tear_down_gitsvn_checkout() 376 self._tear_down_gitsvn_checkout()
377 377
378 def _set_up_gitsvn_checkout(self): 378 def _set_up_gitsvn_checkout(self):
379 self.git_checkout_path = self._mkdtemp(suffix="git_test_checkout") 379 self.git_checkout_path = self._mkdtemp(suffix="git_test_checkout")
380 # --quiet doesn't make git svn silent 380 # --quiet doesn't make git svn silent
381 self._run_silent(['git', 'svn', 'clone', '-T', 'trunk', self.svn_repo_ur l, self.git_checkout_path]) 381 self._run_silent(['git', 'svn', 'clone', '-T', 'trunk', self.svn_repo_ur l, self.git_checkout_path])
382 self._chdir(self.git_checkout_path) 382 self._chdir(self.git_checkout_path)
383 self.git_v2 = self._run(['git', '--version']).startswith('git version 2' )
384 if self.git_v2:
385 # The semantics of 'git svn clone -T' changed in v2 (apparently), so the branch names are different.
386 # This works around it, for compatibility w/ v1.
387 self._run_silent(['git', 'branch', 'trunk', 'origin/trunk'])
383 388
384 def _tear_down_gitsvn_checkout(self): 389 def _tear_down_gitsvn_checkout(self):
385 self._rmtree(self.git_checkout_path) 390 self._rmtree(self.git_checkout_path)
386 391
387 def test_detection(self): 392 def test_detection(self):
388 self.assertEqual(self.scm.display_name(), "git") 393 self.assertEqual(self.scm.display_name(), "git")
389 self.assertEqual(self.scm.supports_local_commits(), True) 394 self.assertEqual(self.scm.supports_local_commits(), True)
390 395
391 def test_read_git_config(self): 396 def test_read_git_config(self):
392 key = 'test.git-config' 397 key = 'test.git-config'
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 self._write_text_file('test_file', 'changed test content') 484 self._write_text_file('test_file', 'changed test content')
480 self.assertTrue(self.scm.has_working_directory_changes()) 485 self.assertTrue(self.scm.has_working_directory_changes())
481 self.assertRaises(ScriptError, self.scm.commit_locally_with_message, 'no working copy changes', False) 486 self.assertRaises(ScriptError, self.scm.commit_locally_with_message, 'no working copy changes', False)
482 487
483 def _test_upstream_branch(self): 488 def _test_upstream_branch(self):
484 self._run(['git', 'checkout', '-t', '-b', 'my-branch']) 489 self._run(['git', 'checkout', '-t', '-b', 'my-branch'])
485 self._run(['git', 'checkout', '-t', '-b', 'my-second-branch']) 490 self._run(['git', 'checkout', '-t', '-b', 'my-second-branch'])
486 self.assertEqual(self.scm._upstream_branch(), 'my-branch') 491 self.assertEqual(self.scm._upstream_branch(), 'my-branch')
487 492
488 def test_remote_branch_ref(self): 493 def test_remote_branch_ref(self):
489 self.assertEqual(self.scm._remote_branch_ref(), 'refs/remotes/trunk') 494 remote_branch_ref = self.scm._remote_branch_ref()
495 if self.git_v2:
496 self.assertEqual(remote_branch_ref, 'refs/remotes/origin/trunk')
497 else:
498 self.assertEqual(remote_branch_ref, 'refs/remotes/trunk')
490 499
491 def test_create_patch_local_plus_working_copy(self): 500 def test_create_patch_local_plus_working_copy(self):
492 self._one_local_commit_plus_working_copy_changes() 501 self._one_local_commit_plus_working_copy_changes()
493 patch = self.scm.create_patch() 502 patch = self.scm.create_patch()
494 self.assertRegexpMatches(patch, r'test_file_commit1') 503 self.assertRegexpMatches(patch, r'test_file_commit1')
495 self.assertRegexpMatches(patch, r'test_file_commit2') 504 self.assertRegexpMatches(patch, r'test_file_commit2')
496 505
497 def test_create_patch(self): 506 def test_create_patch(self):
498 self._one_local_commit_plus_working_copy_changes() 507 self._one_local_commit_plus_working_copy_changes()
499 patch = self.scm.create_patch() 508 patch = self.scm.create_patch()
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 scm = self.make_scm() 694 scm = self.make_scm()
686 scm.find_checkout_root = lambda path: '' 695 scm.find_checkout_root = lambda path: ''
687 scm._run_git = lambda args: 'Date: 2013-02-08 08:05:49 +0000' 696 scm._run_git = lambda args: 'Date: 2013-02-08 08:05:49 +0000'
688 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013- 02-08T08:05:49Z') 697 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013- 02-08T08:05:49Z')
689 698
690 scm._run_git = lambda args: 'Date: 2013-02-08 01:02:03 +0130' 699 scm._run_git = lambda args: 'Date: 2013-02-08 01:02:03 +0130'
691 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013- 02-07T23:32:03Z') 700 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013- 02-07T23:32:03Z')
692 701
693 scm._run_git = lambda args: 'Date: 2013-02-08 01:55:21 -0800' 702 scm._run_git = lambda args: 'Date: 2013-02-08 01:55:21 -0800'
694 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013- 02-08T09:55:21Z') 703 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013- 02-08T09:55:21Z')
OLDNEW
« no previous file with comments | « Tools/Scripts/webkitpy/common/checkout/scm/scm.py ('k') | Tools/Scripts/webkitpy/common/checkout/scm/svn.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698