| OLD | NEW |
| 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 333 |
| 334 def _tear_down_git_checkouts(self): | 334 def _tear_down_git_checkouts(self): |
| 335 self._run(['rm', '-rf', self.tracking_git_checkout_path]) | 335 self._run(['rm', '-rf', self.tracking_git_checkout_path]) |
| 336 self._run(['rm', '-rf', self.untracking_checkout_path]) | 336 self._run(['rm', '-rf', self.untracking_checkout_path]) |
| 337 | 337 |
| 338 def test_remote_branch_ref(self): | 338 def test_remote_branch_ref(self): |
| 339 self.assertEqual(self.tracking_scm._remote_branch_ref(), 'refs/remotes/o
rigin/master') | 339 self.assertEqual(self.tracking_scm._remote_branch_ref(), 'refs/remotes/o
rigin/master') |
| 340 self._chdir(self.untracking_checkout_path) | 340 self._chdir(self.untracking_checkout_path) |
| 341 self.assertRaises(ScriptError, self.untracking_scm._remote_branch_ref) | 341 self.assertRaises(ScriptError, self.untracking_scm._remote_branch_ref) |
| 342 | 342 |
| 343 def test_multiple_remotes(self): | |
| 344 self._run(['git', 'config', '--add', 'svn-remote.svn.fetch', 'trunk:remo
te1']) | |
| 345 self._run(['git', 'config', '--add', 'svn-remote.svn.fetch', 'trunk:remo
te2']) | |
| 346 self.assertEqual(self.tracking_scm._remote_branch_ref(), 'remote1') | |
| 347 | |
| 348 def test_create_patch(self): | 343 def test_create_patch(self): |
| 349 self._write_text_file('test_file_commit1', 'contents') | 344 self._write_text_file('test_file_commit1', 'contents') |
| 350 self._run(['git', 'add', 'test_file_commit1']) | 345 self._run(['git', 'add', 'test_file_commit1']) |
| 351 scm = self.tracking_scm | 346 scm = self.tracking_scm |
| 352 scm.commit_locally_with_message('message') | 347 scm.commit_locally_with_message('message') |
| 353 | 348 |
| 354 patch = scm.create_patch() | 349 patch = scm.create_patch() |
| 355 self.assertNotRegexpMatches(patch, r'Subversion Revision:') | 350 self.assertNotRegexpMatches(patch, r'Subversion Revision:') |
| 356 | 351 |
| 357 def test_exists(self): | 352 def test_exists(self): |
| 358 scm = self.untracking_scm | 353 scm = self.untracking_scm |
| 359 self._shared_test_exists(scm, scm.commit_locally_with_message) | 354 self._shared_test_exists(scm, scm.commit_locally_with_message) |
| 360 | 355 |
| 361 def test_rename_files(self): | 356 def test_rename_files(self): |
| 362 scm = self.tracking_scm | 357 scm = self.tracking_scm |
| 363 scm.move('foo_file', 'bar_file') | 358 scm.move('foo_file', 'bar_file') |
| 364 scm.commit_locally_with_message('message') | 359 scm.commit_locally_with_message('message') |
| 365 | 360 |
| 361 def test_commit_position_from_git_log(self): |
| 362 git_log = """ |
| 363 commit 624c3081c0 |
| 364 Author: foobarbaz1 <foobarbaz1@chromium.org> |
| 365 Date: Mon Sep 28 19:10:30 2015 -0700 |
| 366 |
| 367 Test foo bar baz qux 123. |
| 368 |
| 369 BUG=000000 |
| 370 |
| 371 Review URL: https://codereview.chromium.org/999999999 |
| 372 |
| 373 Cr-Commit-Position: refs/heads/master@{#1234567} |
| 374 """ |
| 375 scm = self.tracking_scm |
| 376 self.assertEqual(scm._commit_position_from_git_log(git_log), 1234567) |
| 377 |
| 366 | 378 |
| 367 class GitSVNTest(SCMTestBase): | 379 class GitSVNTest(SCMTestBase): |
| 368 def setUp(self): | 380 def setUp(self): |
| 369 super(GitSVNTest, self).setUp() | 381 super(GitSVNTest, self).setUp() |
| 370 self._set_up_svn_checkout() | 382 self._set_up_svn_checkout() |
| 371 self._set_up_gitsvn_checkout() | 383 self._set_up_gitsvn_checkout() |
| 372 self.scm = detect_scm_system(self.git_checkout_path) | 384 self.scm = detect_scm_system(self.git_checkout_path) |
| 373 self.scm.svn_server_realm = None | 385 self.scm.svn_server_realm = None |
| 374 | 386 |
| 375 def tearDown(self): | 387 def tearDown(self): |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 696 scm = self.make_scm() | 708 scm = self.make_scm() |
| 697 scm.find_checkout_root = lambda path: '' | 709 scm.find_checkout_root = lambda path: '' |
| 698 scm._run_git = lambda args: 'Date: 2013-02-08 08:05:49 +0000' | 710 scm._run_git = lambda args: 'Date: 2013-02-08 08:05:49 +0000' |
| 699 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013-
02-08T08:05:49Z') | 711 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013-
02-08T08:05:49Z') |
| 700 | 712 |
| 701 scm._run_git = lambda args: 'Date: 2013-02-08 01:02:03 +0130' | 713 scm._run_git = lambda args: 'Date: 2013-02-08 01:02:03 +0130' |
| 702 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013-
02-07T23:32:03Z') | 714 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013-
02-07T23:32:03Z') |
| 703 | 715 |
| 704 scm._run_git = lambda args: 'Date: 2013-02-08 01:55:21 -0800' | 716 scm._run_git = lambda args: 'Date: 2013-02-08 01:55:21 -0800' |
| 705 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013-
02-08T09:55:21Z') | 717 self.assertEqual(scm.timestamp_of_revision('some-path', '12345'), '2013-
02-08T09:55:21Z') |
| OLD | NEW |