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 747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 @classmethod | 758 @classmethod |
759 def _gerrit_upload_calls(cls, description, reviewers, squash, | 759 def _gerrit_upload_calls(cls, description, reviewers, squash, |
760 expected_upstream_ref='origin/refs/heads/master', | 760 expected_upstream_ref='origin/refs/heads/master', |
761 ref_suffix='', notify=False, | 761 ref_suffix='', notify=False, |
762 post_amend_description=None, issue=None): | 762 post_amend_description=None, issue=None): |
763 if post_amend_description is None: | 763 if post_amend_description is None: |
764 post_amend_description = description | 764 post_amend_description = description |
765 | 765 |
766 calls = [ | 766 calls = [ |
767 ((['git', 'config', '--bool', 'gerrit.squash-uploads'],), 'false'), | 767 ((['git', 'config', '--bool', 'gerrit.squash-uploads'],), 'false'), |
768 ((['git', 'config', '--bool', 'gerrit.squash-uploads'],), 'false'), | |
769 ] | 768 ] |
770 # If issue is given, then description is fetched from Gerrit instead. | 769 # If issue is given, then description is fetched from Gerrit instead. |
771 if issue is None: | 770 if issue is None: |
772 if squash: | 771 if squash: |
773 calls += [ | 772 calls += [ |
774 ((['git', 'show', '--format=%B', '-s', | 773 ((['git', 'show', '--format=%B', '-s', |
775 'refs/heads/git_cl_uploads/master'],), '')] | 774 'refs/heads/git_cl_uploads/master'],), '')] |
776 calls += [ | 775 calls += [ |
777 ((['git', 'log', '--pretty=format:%s\n\n%b', | 776 ((['git', 'log', '--pretty=format:%s\n\n%b', |
778 'fake_ancestor_sha..HEAD'],), | 777 'fake_ancestor_sha..HEAD'],), |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1629 ((['rm_file_or_tree', '/abs/git_repo_root/.git/hooks/commit-msg'],), | 1628 ((['rm_file_or_tree', '/abs/git_repo_root/.git/hooks/commit-msg'],), |
1630 ''), | 1629 ''), |
1631 ] | 1630 ] |
1632 cl._codereview_impl._GerritCommitMsgHookCheck(offer_removal=True) | 1631 cl._codereview_impl._GerritCommitMsgHookCheck(offer_removal=True) |
1633 | 1632 |
1634 | 1633 |
1635 if __name__ == '__main__': | 1634 if __name__ == '__main__': |
1636 git_cl.logging.basicConfig( | 1635 git_cl.logging.basicConfig( |
1637 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) | 1636 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) |
1638 unittest.main() | 1637 unittest.main() |
OLD | NEW |