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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 return [ | 139 return [ |
140 ((['git', 'config', '--get-regexp', '^svn-remote\\.'],), | 140 ((['git', 'config', '--get-regexp', '^svn-remote\\.'],), |
141 ((('svn-remote.svn.url svn://svn.chromium.org/chrome\n' | 141 ((('svn-remote.svn.url svn://svn.chromium.org/chrome\n' |
142 'svn-remote.svn.fetch trunk/src:refs/remotes/origin/master'), | 142 'svn-remote.svn.fetch trunk/src:refs/remotes/origin/master'), |
143 None), | 143 None), |
144 0)), | 144 0)), |
145 ((['git', 'config', 'rietveld.server'],), 'codereview.example.com'), | 145 ((['git', 'config', 'rietveld.server'],), 'codereview.example.com'), |
146 ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'), | 146 ((['git', 'symbolic-ref', 'HEAD'],), 'refs/heads/working'), |
147 ((['git', 'config', 'branch.working.merge'],), 'refs/heads/master'), | 147 ((['git', 'config', 'branch.working.merge'],), 'refs/heads/master'), |
148 ((['git', 'config', 'branch.working.remote'],), 'origin'), | 148 ((['git', 'config', 'branch.working.remote'],), 'origin'), |
| 149 ((['git', 'rev-list', '--merges', |
| 150 '--grep="^SVN changes up to revision [0-9]*$"', |
| 151 'refs/remotes/origin/master^!'],), ''), |
149 ((['git', 'update-index', '--refresh', '-q'],), ''), | 152 ((['git', 'update-index', '--refresh', '-q'],), ''), |
150 ((['git', 'diff-index', 'HEAD'],), ''), | 153 ((['git', 'diff-index', 'HEAD'],), ''), |
151 ((['git', 'rev-list', '^refs/heads/working', | 154 ((['git', 'rev-list', '^refs/heads/working', |
152 'refs/remotes/origin/master'],), | 155 'refs/remotes/origin/master'],), |
153 ''), | 156 ''), |
154 ((['git', 'log', '--grep=^git-svn-id:', '-1', '--pretty=format:%H'],), | 157 ((['git', 'log', '--grep=^git-svn-id:', '-1', '--pretty=format:%H'],), |
155 '3fc18b62c4966193eb435baabe2d18a3810ec82e'), | 158 '3fc18b62c4966193eb435baabe2d18a3810ec82e'), |
156 ((['git', 'rev-list', '^3fc18b62c4966193eb435baabe2d18a3810ec82e', | 159 ((['git', 'rev-list', '^3fc18b62c4966193eb435baabe2d18a3810ec82e', |
157 'refs/remotes/origin/master'],), ''), | 160 'refs/remotes/origin/master'],), ''), |
158 ] | 161 ] |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 return [ | 193 return [ |
191 ((['git', 'diff', '--stat', 'refs/remotes/origin/master', | 194 ((['git', 'diff', '--stat', 'refs/remotes/origin/master', |
192 'refs/heads/working'],), | 195 'refs/heads/working'],), |
193 (' PRESUBMIT.py | 2 +-\n' | 196 (' PRESUBMIT.py | 2 +-\n' |
194 ' 1 files changed, 1 insertions(+), 1 deletions(-)\n')), | 197 ' 1 files changed, 1 insertions(+), 1 deletions(-)\n')), |
195 (('About to commit; enter to confirm.',), None), | 198 (('About to commit; enter to confirm.',), None), |
196 ((['git', 'show-ref', '--quiet', '--verify', | 199 ((['git', 'show-ref', '--quiet', '--verify', |
197 'refs/heads/git-cl-commit'],), | 200 'refs/heads/git-cl-commit'],), |
198 (('', None), 0)), | 201 (('', None), 0)), |
199 ((['git', 'branch', '-D', 'git-cl-commit'],), ''), | 202 ((['git', 'branch', '-D', 'git-cl-commit'],), ''), |
| 203 ((['git', 'show-ref', '--quiet', '--verify', |
| 204 'refs/heads/git-cl-cherry-pick'],), ''), |
200 ((['git', 'rev-parse', '--show-cdup'],), '\n'), | 205 ((['git', 'rev-parse', '--show-cdup'],), '\n'), |
201 ((['git', 'checkout', '-q', '-b', 'git-cl-commit'],), ''), | 206 ((['git', 'checkout', '-q', '-b', 'git-cl-commit'],), ''), |
202 ((['git', 'reset', '--soft', 'refs/remotes/origin/master'],), ''), | 207 ((['git', 'reset', '--soft', 'refs/remotes/origin/master'],), ''), |
203 ((['git', 'commit', '-m', | 208 ((['git', 'commit', '-m', |
204 'Issue: 12345\n\nReview URL: https://codereview.example.com/12345'],), | 209 'Issue: 12345\n\nReview URL: https://codereview.example.com/12345'],), |
205 ''), | 210 ''), |
206 ((['git', 'svn', 'dcommit', '--no-rebase', '--rmdir'],), (('', None), 0)), | 211 ((['git', 'svn', 'dcommit', '--no-rebase', '--rmdir'],), (('', None), 0)), |
207 ((['git', 'checkout', '-q', 'working'],), ''), | 212 ((['git', 'checkout', '-q', 'working'],), ''), |
208 ((['git', 'branch', '-D', 'git-cl-commit'],), ''), | 213 ((['git', 'branch', '-D', 'git-cl-commit'],), ''), |
209 ] | 214 ] |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 ((['git', 'config', 'rietveld.viewvc-url'],), ''), | 456 ((['git', 'config', 'rietveld.viewvc-url'],), ''), |
452 (('ViewVC URL:',), ''), | 457 (('ViewVC URL:',), ''), |
453 # DownloadHooks(True) | 458 # DownloadHooks(True) |
454 ((commit_msg_path, os.X_OK,), True), | 459 ((commit_msg_path, os.X_OK,), True), |
455 ] | 460 ] |
456 git_cl.main(['config']) | 461 git_cl.main(['config']) |
457 | 462 |
458 | 463 |
459 if __name__ == '__main__': | 464 if __name__ == '__main__': |
460 unittest.main() | 465 unittest.main() |
OLD | NEW |