| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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_rebase_update.py""" | 6 """Unit tests for git_rebase_update.py""" |
| 7 | 7 |
| 8 import os | 8 import os |
| 9 import sys | 9 import sys |
| 10 | 10 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 self.assertIn('branch_L up-to-date', output) | 145 self.assertIn('branch_L up-to-date', output) |
| 146 self.assertIn('foobar up-to-date', output) | 146 self.assertIn('foobar up-to-date', output) |
| 147 self.assertIn('sub_K up-to-date', output) | 147 self.assertIn('sub_K up-to-date', output) |
| 148 | 148 |
| 149 with self.repo.open('bob') as f: | 149 with self.repo.open('bob') as f: |
| 150 self.assertEquals('testing auto-freeze/thaw', f.read()) | 150 self.assertEquals('testing auto-freeze/thaw', f.read()) |
| 151 | 151 |
| 152 self.assertEqual(self.repo.git('status', '--porcelain').stdout, '?? bob\n') | 152 self.assertEqual(self.repo.git('status', '--porcelain').stdout, '?? bob\n') |
| 153 | 153 |
| 154 self.repo.git('checkout', 'origin/master') | 154 self.repo.git('checkout', 'origin/master') |
| 155 _, err = self.repo.capture_stdio(self.rp.main, []) |
| 156 self.assertIn('Must specify new parent somehow', err) |
| 155 _, err = self.repo.capture_stdio(self.rp.main, ['foobar']) | 157 _, err = self.repo.capture_stdio(self.rp.main, ['foobar']) |
| 156 self.assertIn('Must be on the branch', err) | 158 self.assertIn('Must be on the branch', err) |
| 157 | 159 |
| 158 self.repo.git('checkout', 'branch_K') | 160 self.repo.git('checkout', 'branch_K') |
| 159 _, err = self.repo.capture_stdio(self.rp.main, ['origin/master']) | 161 _, err = self.repo.capture_stdio(self.rp.main, ['origin/master']) |
| 160 self.assertIn('Cannot reparent a branch to its existing parent', err) | 162 self.assertIn('Cannot reparent a branch to its existing parent', err) |
| 161 output, _ = self.repo.capture_stdio(self.rp.main, ['foobar']) | 163 output, _ = self.repo.capture_stdio(self.rp.main, ['foobar']) |
| 162 self.assertIn('Rebasing: branch_K', output) | 164 self.assertIn('Rebasing: branch_K', output) |
| 163 self.assertIn('Rebasing: sub_K', output) | 165 self.assertIn('Rebasing: sub_K', output) |
| 164 self.assertIn('Rebasing: branch_L', output) | 166 self.assertIn('Rebasing: branch_L', output) |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 """) | 336 """) |
| 335 | 337 |
| 336 | 338 |
| 337 if __name__ == '__main__': | 339 if __name__ == '__main__': |
| 338 sys.exit(coverage_utils.covered_main(( | 340 sys.exit(coverage_utils.covered_main(( |
| 339 os.path.join(DEPOT_TOOLS_ROOT, 'git_rebase_update.py'), | 341 os.path.join(DEPOT_TOOLS_ROOT, 'git_rebase_update.py'), |
| 340 os.path.join(DEPOT_TOOLS_ROOT, 'git_new_branch.py'), | 342 os.path.join(DEPOT_TOOLS_ROOT, 'git_new_branch.py'), |
| 341 os.path.join(DEPOT_TOOLS_ROOT, 'git_reparent_branch.py'), | 343 os.path.join(DEPOT_TOOLS_ROOT, 'git_reparent_branch.py'), |
| 342 os.path.join(DEPOT_TOOLS_ROOT, 'git_rename_branch.py') | 344 os.path.join(DEPOT_TOOLS_ROOT, 'git_rename_branch.py') |
| 343 ))) | 345 ))) |
| OLD | NEW |