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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 ((['git', 'config', 'branch.master.merge'],), 'master'), | 107 ((['git', 'config', 'branch.master.merge'],), 'master'), |
108 ((['git', 'config', 'branch.master.remote'],), 'origin'), | 108 ((['git', 'config', 'branch.master.remote'],), 'origin'), |
109 ((['git', 'rev-parse', '--show-cdup'],), ''), | 109 ((['git', 'rev-parse', '--show-cdup'],), ''), |
110 ((['git', 'rev-parse', 'HEAD'],), '12345'), | 110 ((['git', 'rev-parse', 'HEAD'],), '12345'), |
111 ((['git', 'diff', '--name-status', '-r', 'master...', '.'],), | 111 ((['git', 'diff', '--name-status', '-r', 'master...', '.'],), |
112 'M\t.gitignore\n'), | 112 'M\t.gitignore\n'), |
113 ((['git', 'config', 'branch.master.rietveldissue'],), ''), | 113 ((['git', 'config', 'branch.master.rietveldissue'],), ''), |
114 ((['git', 'config', 'branch.master.rietveldpatchset'],), ''), | 114 ((['git', 'config', 'branch.master.rietveldpatchset'],), ''), |
115 ((['git', 'log', '--pretty=format:%s%n%n%b', 'master...'],), 'foo'), | 115 ((['git', 'log', '--pretty=format:%s%n%n%b', 'master...'],), 'foo'), |
116 ((['git', 'config', 'user.email'],), 'me@example.com'), | 116 ((['git', 'config', 'user.email'],), 'me@example.com'), |
117 ((['git', 'diff', '--no-ext-diff', '--stat', '-M', 'master...'],), | 117 ((['git', 'diff', '--no-ext-diff', '--stat', '--find-copies-harder', |
| 118 'master...'],), |
118 '+dat'), | 119 '+dat'), |
119 ((['git', 'log', '--pretty=format:%s\n\n%b', 'master..'],), 'desc\n'), | 120 ((['git', 'log', '--pretty=format:%s\n\n%b', 'master..'],), 'desc\n'), |
120 ] | 121 ] |
121 | 122 |
122 @staticmethod | 123 @staticmethod |
123 def _git_upload_calls(): | 124 def _git_upload_calls(): |
124 return [ | 125 return [ |
125 ((['git', 'config', 'rietveld.cc'],), ''), | 126 ((['git', 'config', 'rietveld.cc'],), ''), |
126 ((['git', 'config', 'branch.master.base-url'],), ''), | 127 ((['git', 'config', 'branch.master.base-url'],), ''), |
127 ((['git', 'config', '--get-regexp', '^svn-remote\\.'],), | 128 ((['git', 'config', '--get-regexp', '^svn-remote\\.'],), |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 ((['git', 'config', 'branch.master.merge'],), 'master'), | 341 ((['git', 'config', 'branch.master.merge'],), 'master'), |
341 ((['git', 'config', 'branch.master.remote'],), 'origin'), | 342 ((['git', 'config', 'branch.master.remote'],), 'origin'), |
342 ((['git', 'rev-parse', '--show-cdup'],), ''), | 343 ((['git', 'rev-parse', '--show-cdup'],), ''), |
343 ((['git', 'rev-parse', 'HEAD'],), '12345'), | 344 ((['git', 'rev-parse', 'HEAD'],), '12345'), |
344 ((['git', 'diff', '--name-status', '-r', 'master...', '.'],), | 345 ((['git', 'diff', '--name-status', '-r', 'master...', '.'],), |
345 'M\t.gitignore\n'), | 346 'M\t.gitignore\n'), |
346 ((['git', 'config', 'branch.master.rietveldissue'],), ''), | 347 ((['git', 'config', 'branch.master.rietveldissue'],), ''), |
347 ((['git', 'config', 'branch.master.rietveldpatchset'],), ''), | 348 ((['git', 'config', 'branch.master.rietveldpatchset'],), ''), |
348 ((['git', 'log', '--pretty=format:%s%n%n%b', 'master...'],), 'foo'), | 349 ((['git', 'log', '--pretty=format:%s%n%n%b', 'master...'],), 'foo'), |
349 ((['git', 'config', 'user.email'],), 'me@example.com'), | 350 ((['git', 'config', 'user.email'],), 'me@example.com'), |
350 ((['git', 'diff', '--no-ext-diff', '--stat', '-M', 'master...'],), | 351 ((['git', 'diff', '--no-ext-diff', '--stat', '--find-copies-harder', |
| 352 'master...'],), |
351 '+dat'), | 353 '+dat'), |
352 ] | 354 ] |
353 | 355 |
354 @staticmethod | 356 @staticmethod |
355 def _gerrit_upload_calls(description, reviewers): | 357 def _gerrit_upload_calls(description, reviewers): |
356 calls = [ | 358 calls = [ |
357 ((['git', 'log', '--pretty=format:%s\n\n%b', 'master..'],), | 359 ((['git', 'log', '--pretty=format:%s\n\n%b', 'master..'],), |
358 description), | 360 description), |
359 ((['git', 'config', 'rietveld.cc'],), '') | 361 ((['git', 'config', 'rietveld.cc'],), '') |
360 ] | 362 ] |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 ((['git', 'config', 'rietveld.viewvc-url'],), ''), | 453 ((['git', 'config', 'rietveld.viewvc-url'],), ''), |
452 (('ViewVC URL:',), ''), | 454 (('ViewVC URL:',), ''), |
453 # DownloadHooks(True) | 455 # DownloadHooks(True) |
454 ((commit_msg_path, os.X_OK,), True), | 456 ((commit_msg_path, os.X_OK,), True), |
455 ] | 457 ] |
456 git_cl.main(['config']) | 458 git_cl.main(['config']) |
457 | 459 |
458 | 460 |
459 if __name__ == '__main__': | 461 if __name__ == '__main__': |
460 unittest.main() | 462 unittest.main() |
OLD | NEW |