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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 private_call = [] | 199 private_call = [] |
200 else: | 200 else: |
201 cc_call = [((['git', 'config', 'rietveld.cc'],), '')] | 201 cc_call = [((['git', 'config', 'rietveld.cc'],), '')] |
202 private_call = [ | 202 private_call = [ |
203 ((['git', 'config', 'rietveld.private'],), '')] | 203 ((['git', 'config', 'rietveld.private'],), '')] |
204 | 204 |
205 return [ | 205 return [ |
206 ((['git', 'config', 'core.editor'],), ''), | 206 ((['git', 'config', 'core.editor'],), ''), |
207 ] + cc_call + private_call + [ | 207 ] + cc_call + private_call + [ |
208 ((['git', 'config', 'branch.master.base-url'],), ''), | 208 ((['git', 'config', 'branch.master.base-url'],), ''), |
| 209 ((['git', 'config', 'rietveld.pending-ref-prefix'],), ''), |
209 ((['git', | 210 ((['git', |
210 'config', '--local', '--get-regexp', '^svn-remote\\.'],), | 211 'config', '--local', '--get-regexp', '^svn-remote\\.'],), |
211 (('', None), 0)), | 212 (('', None), 0)), |
212 ((['git', 'rev-parse', '--show-cdup'],), ''), | 213 ((['git', 'rev-parse', '--show-cdup'],), ''), |
213 ((['git', 'svn', 'info'],), ''), | 214 ((['git', 'svn', 'info'],), ''), |
214 ((['git', 'config', 'rietveld.project'],), ''), | 215 ((['git', 'config', 'rietveld.project'],), ''), |
215 ((['git', | 216 ((['git', |
216 'config', 'branch.master.rietveldissue', '1'],), ''), | 217 'config', 'branch.master.rietveldissue', '1'],), ''), |
217 ((['git', 'config', 'branch.master.rietveldserver', | 218 ((['git', 'config', 'branch.master.rietveldserver', |
218 'https://codereview.example.com'],), ''), | 219 'https://codereview.example.com'],), ''), |
(...skipping 26 matching lines...) Expand all Loading... |
245 'refs/heads/master'), | 246 'refs/heads/master'), |
246 ((['git', | 247 ((['git', |
247 'config', 'branch.%s.remote' % working_branch],), 'origin'), | 248 'config', 'branch.%s.remote' % working_branch],), 'origin'), |
248 ((['git', 'rev-list', '^' + fake_ancestor, | 249 ((['git', 'rev-list', '^' + fake_ancestor, |
249 'refs/remotes/origin/master'],), ''), | 250 'refs/remotes/origin/master'],), ''), |
250 ] | 251 ] |
251 | 252 |
252 @classmethod | 253 @classmethod |
253 def _dcommit_calls_1(cls): | 254 def _dcommit_calls_1(cls): |
254 return [ | 255 return [ |
| 256 ((['git', 'config', 'rietveld.autoupdate'],), |
| 257 ''), |
| 258 ((['git', 'config', 'rietveld.pending-ref-prefix'],), |
| 259 ''), |
255 ((['git', | 260 ((['git', |
256 'config', '--local', '--get-regexp', '^svn-remote\\.'],), | 261 'config', '--local', '--get-regexp', '^svn-remote\\.'],), |
257 ((('svn-remote.svn.url svn://svn.chromium.org/chrome\n' | 262 ((('svn-remote.svn.url svn://svn.chromium.org/chrome\n' |
258 'svn-remote.svn.fetch trunk/src:refs/remotes/origin/master'), | 263 'svn-remote.svn.fetch trunk/src:refs/remotes/origin/master'), |
259 None), | 264 None), |
260 0)), | 265 0)), |
261 ((['git', 'config', 'rietveld.autoupdate'],), | |
262 ''), | |
263 ((['git', | 266 ((['git', |
264 'config', 'rietveld.server'],), 'codereview.example.com'), | 267 'config', 'rietveld.server'],), 'codereview.example.com'), |
265 ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'), | 268 ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'), |
266 ((['git', 'config', '--int', '--get', | 269 ((['git', 'config', '--int', '--get', |
267 'branch.working.git-cl-similarity'],), ''), | 270 'branch.working.git-cl-similarity'],), ''), |
268 ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'), | 271 ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'), |
269 ((['git', 'config', '--int', '--get', | 272 ((['git', 'config', '--int', '--get', |
270 'branch.working.git-find-copies'],), ''), | 273 'branch.working.git-find-copies'],), ''), |
271 ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'), | 274 ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'), |
272 ((['git', | 275 ((['git', |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 ((['git', 'config', '--unset-all', | 685 ((['git', 'config', '--unset-all', |
683 'rietveld.viewvc-url'],), ''), | 686 'rietveld.viewvc-url'],), ''), |
684 ((['git', 'config', '--unset-all', | 687 ((['git', 'config', '--unset-all', |
685 'rietveld.bug-prefix'],), ''), | 688 'rietveld.bug-prefix'],), ''), |
686 ((['git', 'config', '--unset-all', | 689 ((['git', 'config', '--unset-all', |
687 'rietveld.cpplint-regex'],), ''), | 690 'rietveld.cpplint-regex'],), ''), |
688 ((['git', 'config', '--unset-all', | 691 ((['git', 'config', '--unset-all', |
689 'rietveld.cpplint-ignore-regex'],), ''), | 692 'rietveld.cpplint-ignore-regex'],), ''), |
690 ((['git', 'config', '--unset-all', | 693 ((['git', 'config', '--unset-all', |
691 'rietveld.project'],), ''), | 694 'rietveld.project'],), ''), |
| 695 ((['git', 'config', '--unset-all', |
| 696 'rietveld.pending-ref-prefix'],), ''), |
692 ((['git', 'config', 'gerrit.host', | 697 ((['git', 'config', 'gerrit.host', |
693 'gerrit.chromium.org'],), ''), | 698 'gerrit.chromium.org'],), ''), |
694 # DownloadHooks(False) | 699 # DownloadHooks(False) |
695 ((['git', 'config', 'gerrit.host'],), | 700 ((['git', 'config', 'gerrit.host'],), |
696 'gerrit.chromium.org'), | 701 'gerrit.chromium.org'), |
697 ((['git', 'rev-parse', '--show-cdup'],), ''), | 702 ((['git', 'rev-parse', '--show-cdup'],), ''), |
698 ((commit_msg_path, os.X_OK,), False), | 703 ((commit_msg_path, os.X_OK,), False), |
699 (('https://gerrit-review.googlesource.com/tools/hooks/commit-msg', | 704 (('https://gerrit-review.googlesource.com/tools/hooks/commit-msg', |
700 commit_msg_path,), ''), | 705 commit_msg_path,), ''), |
701 ((commit_msg_path,), True), | 706 ((commit_msg_path,), True), |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 | 772 |
768 self.calls = [ | 773 self.calls = [ |
769 ((['git', 'config', 'rietveld.autoupdate',],), | 774 ((['git', 'config', 'rietveld.autoupdate',],), |
770 ''), | 775 ''), |
771 ((['git', 'config', 'gerrit.host',],), | 776 ((['git', 'config', 'gerrit.host',],), |
772 ''), | 777 ''), |
773 ((['git', 'rev-parse', '--show-cdup',],), | 778 ((['git', 'rev-parse', '--show-cdup',],), |
774 ''), | 779 ''), |
775 ((['git', 'config', 'rietveld.private',],), | 780 ((['git', 'config', 'rietveld.private',],), |
776 ''), | 781 ''), |
| 782 ((['git', 'config', 'rietveld.pending-ref-prefix',],), |
| 783 ''), |
777 ((['git', 'config', '--local', '--get-regexp', '^svn-remote\\.'],), | 784 ((['git', 'config', '--local', '--get-regexp', '^svn-remote\\.'],), |
778 ''), | 785 ''), |
779 ((['git', 'config', 'rietveld.project',],), | 786 ((['git', 'config', 'rietveld.project',],), |
780 ''), | 787 ''), |
781 ((['git', 'rev-parse', 'HEAD',],), | 788 ((['git', 'rev-parse', 'HEAD',],), |
782 ''), | 789 ''), |
783 ] | 790 ] |
784 | 791 |
785 stored_description = [] | 792 stored_description = [] |
786 def check_upload(args): | 793 def check_upload(args): |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 def AffectedFiles(self): | 868 def AffectedFiles(self): |
862 return [] | 869 return [] |
863 | 870 |
864 def LocalPaths(self): | 871 def LocalPaths(self): |
865 return None | 872 return None |
866 | 873 |
867 if __name__ == '__main__': | 874 if __name__ == '__main__': |
868 git_cl.logging.basicConfig( | 875 git_cl.logging.basicConfig( |
869 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) | 876 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) |
870 unittest.main() | 877 unittest.main() |
OLD | NEW |