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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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', | 209 ((['git', |
210 'config', '--local', '--get-regexp', '^svn-remote\\.'],), | 210 'config', '--local', '--get-regexp', '^svn-remote\\..*\\.url'],), |
211 (('', None), 0)), | 211 (('svn-remote.mybranch.url svn://svn.chromium.org/chrome', None), 0)), |
212 ((['git', 'rev-parse', '--show-cdup'],), ''), | 212 ((['git', 'rev-parse', '--show-cdup'],), ''), |
213 ((['git', 'svn', 'info'],), ''), | 213 ((['git', 'svn', 'info'],), ''), |
214 ((['git', 'config', 'rietveld.project'],), ''), | 214 ((['git', 'config', 'rietveld.project'],), ''), |
215 ((['git', | 215 ((['git', |
216 'config', 'branch.master.rietveldissue', '1'],), ''), | 216 'config', 'branch.master.rietveldissue', '1'],), ''), |
217 ((['git', 'config', 'branch.master.rietveldserver', | 217 ((['git', 'config', 'branch.master.rietveldserver', |
218 'https://codereview.example.com'],), ''), | 218 'https://codereview.example.com'],), ''), |
219 ((['git', | 219 ((['git', |
220 'config', 'branch.master.rietveldpatchset', '2'],), ''), | 220 'config', 'branch.master.rietveldpatchset', '2'],), ''), |
221 ((['git', 'rev-parse', 'HEAD'],), 'hash'), | 221 ((['git', 'rev-parse', 'HEAD'],), 'hash'), |
(...skipping 24 matching lines...) Expand all Loading... |
246 ((['git', | 246 ((['git', |
247 'config', 'branch.%s.remote' % working_branch],), 'origin'), | 247 'config', 'branch.%s.remote' % working_branch],), 'origin'), |
248 ((['git', 'rev-list', '^' + fake_ancestor, | 248 ((['git', 'rev-list', '^' + fake_ancestor, |
249 'refs/remotes/origin/master'],), ''), | 249 'refs/remotes/origin/master'],), ''), |
250 ] | 250 ] |
251 | 251 |
252 @classmethod | 252 @classmethod |
253 def _dcommit_calls_1(cls): | 253 def _dcommit_calls_1(cls): |
254 return [ | 254 return [ |
255 ((['git', | 255 ((['git', |
256 'config', '--local', '--get-regexp', '^svn-remote\\.'],), | 256 'config', '--local', '--get-regexp', '^svn-remote\\..*\\.url'],), |
257 ((('svn-remote.svn.url svn://svn.chromium.org/chrome\n' | 257 ((('svn-remote.svn.url svn://svn.chromium.org/chrome\n' |
258 'svn-remote.svn.fetch trunk/src:refs/remotes/origin/master'), | 258 'svn-remote.svn.fetch trunk/src:refs/remotes/origin/master'), |
259 None), | 259 None), |
260 0)), | 260 0)), |
261 ((['git', 'config', 'rietveld.autoupdate'],), | 261 ((['git', 'config', 'rietveld.autoupdate'],), |
262 ''), | 262 ''), |
263 ((['git', | 263 ((['git', |
264 'config', 'rietveld.server'],), 'codereview.example.com'), | 264 'config', 'rietveld.server'],), 'codereview.example.com'), |
265 ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'), | 265 ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'), |
266 ((['git', 'config', '--int', '--get', | 266 ((['git', 'config', '--int', '--get', |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
768 | 768 |
769 self.calls = [ | 769 self.calls = [ |
770 ((['git', 'config', 'rietveld.autoupdate',],), | 770 ((['git', 'config', 'rietveld.autoupdate',],), |
771 ''), | 771 ''), |
772 ((['git', 'config', 'gerrit.host',],), | 772 ((['git', 'config', 'gerrit.host',],), |
773 ''), | 773 ''), |
774 ((['git', 'rev-parse', '--show-cdup',],), | 774 ((['git', 'rev-parse', '--show-cdup',],), |
775 ''), | 775 ''), |
776 ((['git', 'config', 'rietveld.private',],), | 776 ((['git', 'config', 'rietveld.private',],), |
777 ''), | 777 ''), |
778 ((['git', 'config', '--local', '--get-regexp', '^svn-remote\\.'],), | 778 ((['git', 'config', '--local', '--get-regexp', |
| 779 '^svn-remote\\..*\\.url',],), |
779 ''), | 780 ''), |
780 ((['git', 'config', 'rietveld.project',],), | 781 ((['git', 'config', 'rietveld.project',],), |
781 ''), | 782 ''), |
782 ((['git', 'rev-parse', 'HEAD',],), | 783 ((['git', 'rev-parse', 'HEAD',],), |
783 ''), | 784 ''), |
784 ] | 785 ] |
785 | 786 |
786 stored_description = [] | 787 stored_description = [] |
787 def check_upload(args): | 788 def check_upload(args): |
788 i = 0 | 789 i = 0 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 def AffectedFiles(self): | 863 def AffectedFiles(self): |
863 return [] | 864 return [] |
864 | 865 |
865 def LocalPaths(self): | 866 def LocalPaths(self): |
866 return None | 867 return None |
867 | 868 |
868 if __name__ == '__main__': | 869 if __name__ == '__main__': |
869 git_cl.logging.basicConfig( | 870 git_cl.logging.basicConfig( |
870 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) | 871 level=git_cl.logging.DEBUG if '-v' in sys.argv else git_cl.logging.ERROR) |
871 unittest.main() | 872 unittest.main() |
OLD | NEW |