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 777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
788 elif squash_mode in ('override_squash', 'override_nosquash'): | 788 elif squash_mode in ('override_squash', 'override_nosquash'): |
789 calls.extend([ | 789 calls.extend([ |
790 ((['git', 'config', '--bool', 'gerrit.override-squash-uploads'],), | 790 ((['git', 'config', '--bool', 'gerrit.override-squash-uploads'],), |
791 'true' if squash_mode == 'override_squash' else 'false'), | 791 'true' if squash_mode == 'override_squash' else 'false'), |
792 ]) | 792 ]) |
793 else: | 793 else: |
794 assert squash_mode in ('squash', 'nosquash') | 794 assert squash_mode in ('squash', 'nosquash') |
795 | 795 |
796 # If issue is given, then description is fetched from Gerrit instead. | 796 # If issue is given, then description is fetched from Gerrit instead. |
797 if issue is None: | 797 if issue is None: |
798 if squash: | |
799 calls += [ | |
800 ((['git', 'show', '--format=%B', '-s', | |
801 'refs/heads/git_cl_uploads/master'],), '')] | |
802 calls += [ | 798 calls += [ |
803 ((['git', 'log', '--pretty=format:%s\n\n%b', | 799 ((['git', 'log', '--pretty=format:%s\n\n%b', |
804 'fake_ancestor_sha..HEAD'],), | 800 'fake_ancestor_sha..HEAD'],), |
805 description)] | 801 description)] |
806 if not git_footers.get_footer_change_id(description) and not squash: | 802 if not git_footers.get_footer_change_id(description) and not squash: |
807 calls += [ | 803 calls += [ |
808 # DownloadGerritHook(False) | 804 # DownloadGerritHook(False) |
809 ((False, ), | 805 ((False, ), |
810 ''), | 806 ''), |
811 # Amending of commit message to get the Change-Id. | 807 # Amending of commit message to get the Change-Id. |
(...skipping 883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1695 ((['rm_file_or_tree', '/abs/git_repo_root/.git/hooks/commit-msg'],), | 1691 ((['rm_file_or_tree', '/abs/git_repo_root/.git/hooks/commit-msg'],), |
1696 ''), | 1692 ''), |
1697 ] | 1693 ] |
1698 cl._codereview_impl._GerritCommitMsgHookCheck(offer_removal=True) | 1694 cl._codereview_impl._GerritCommitMsgHookCheck(offer_removal=True) |
1699 | 1695 |
1700 | 1696 |
1701 if __name__ == '__main__': | 1697 if __name__ == '__main__': |
1702 git_cl.logging.basicConfig( | 1698 git_cl.logging.basicConfig( |
1703 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) | 1699 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) |
1704 unittest.main() | 1700 unittest.main() |
OLD | NEW |