| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Unit tests for git_cl.py.""" | 6 """Unit tests for git_cl.py.""" |
| 7 | 7 |
| 8 import os | 8 import os |
| 9 import StringIO | 9 import StringIO |
| 10 import stat | 10 import stat |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 ((['git', | 578 ((['git', |
| 579 'diff', '--no-ext-diff', '--stat', '--find-copies-harder', | 579 'diff', '--no-ext-diff', '--stat', '--find-copies-harder', |
| 580 '-l100000', '-C50', 'fake_ancestor_sha', 'HEAD'],), | 580 '-l100000', '-C50', 'fake_ancestor_sha', 'HEAD'],), |
| 581 '+dat'), | 581 '+dat'), |
| 582 ] | 582 ] |
| 583 | 583 |
| 584 @staticmethod | 584 @staticmethod |
| 585 def _gerrit_upload_calls(description, reviewers, squash, | 585 def _gerrit_upload_calls(description, reviewers, squash, |
| 586 expected_upstream_ref='origin/refs/heads/master'): | 586 expected_upstream_ref='origin/refs/heads/master'): |
| 587 calls = [ | 587 calls = [ |
| 588 ((['git', 'config', '--bool', 'gerrit.squash-uploads'],), 'false'), |
| 588 ((['git', 'log', '--pretty=format:%s\n\n%b', | 589 ((['git', 'log', '--pretty=format:%s\n\n%b', |
| 589 'fake_ancestor_sha..HEAD'],), | 590 'fake_ancestor_sha..HEAD'],), |
| 590 description) | 591 description) |
| 591 ] | 592 ] |
| 592 if git_cl.CHANGE_ID not in description: | 593 if git_cl.CHANGE_ID not in description: |
| 593 calls += [ | 594 calls += [ |
| 594 ((['git', 'log', '--pretty=format:%s\n\n%b', | 595 ((['git', 'log', '--pretty=format:%s\n\n%b', |
| 595 'fake_ancestor_sha..HEAD'],), | 596 'fake_ancestor_sha..HEAD'],), |
| 596 description), | 597 description), |
| 597 ((['git', 'commit', '--amend', '-m', description],), | 598 ((['git', 'commit', '--amend', '-m', description],), |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 self.calls += [ | 956 self.calls += [ |
| 956 ((['git', 'apply', '--index', '-p0', '--3way'],), '', | 957 ((['git', 'apply', '--index', '-p0', '--3way'],), '', |
| 957 subprocess2.CalledProcessError(1, '', '', '', '')), | 958 subprocess2.CalledProcessError(1, '', '', '', '')), |
| 958 ] | 959 ] |
| 959 self.assertNotEqual(git_cl.main(['patch', '123456']), 0) | 960 self.assertNotEqual(git_cl.main(['patch', '123456']), 0) |
| 960 | 961 |
| 961 if __name__ == '__main__': | 962 if __name__ == '__main__': |
| 962 git_cl.logging.basicConfig( | 963 git_cl.logging.basicConfig( |
| 963 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) | 964 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) |
| 964 unittest.main() | 965 unittest.main() |
| OLD | NEW |