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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 with self.repo.open('foobar', 'w') as f: | 78 with self.repo.open('foobar', 'w') as f: |
79 f.write('this is the foobar file') | 79 f.write('this is the foobar file') |
80 self.repo.git('add', 'foobar') | 80 self.repo.git('add', 'foobar') |
81 self.repo.git_commit('foobar1') | 81 self.repo.git_commit('foobar1') |
82 | 82 |
83 with self.repo.open('foobar', 'w') as f: | 83 with self.repo.open('foobar', 'w') as f: |
84 f.write('totes the Foobar file') | 84 f.write('totes the Foobar file') |
85 self.repo.git_commit('foobar2') | 85 self.repo.git_commit('foobar2') |
86 | 86 |
87 self.repo.git('checkout', 'branch_K') | 87 self.repo.git('checkout', 'branch_K') |
88 self.repo.run(self.nb.main, ['--upstream_current', 'sub_K']) | 88 self.repo.run(self.nb.main, ['--upstream-current', 'sub_K']) |
89 with self.repo.open('K', 'w') as f: | 89 with self.repo.open('K', 'w') as f: |
90 f.write('This depends on K') | 90 f.write('This depends on K') |
91 self.repo.git_commit('sub_K') | 91 self.repo.git_commit('sub_K') |
92 | 92 |
93 self.repo.run(self.nb.main, ['old_branch']) | 93 self.repo.run(self.nb.main, ['old_branch']) |
94 self.repo.git('reset', '--hard', self.repo['A']) | 94 self.repo.git('reset', '--hard', self.repo['A']) |
95 with self.repo.open('old_file', 'w') as f: | 95 with self.repo.open('old_file', 'w') as f: |
96 f.write('old_files we want to keep around') | 96 f.write('old_files we want to keep around') |
97 self.repo.git('add', 'old_file') | 97 self.repo.git('add', 'old_file') |
98 self.repo.git_commit('old_file') | 98 self.repo.git_commit('old_file') |
(...skipping 11 matching lines...) Expand all Loading... |
110 self.assertEquals(self.repo['A'], self.origin['A']) | 110 self.assertEquals(self.repo['A'], self.origin['A']) |
111 self.assertEquals(self.repo['E'], self.origin['E']) | 111 self.assertEquals(self.repo['E'], self.origin['E']) |
112 | 112 |
113 with self.repo.open('bob', 'wb') as f: | 113 with self.repo.open('bob', 'wb') as f: |
114 f.write('testing auto-freeze/thaw') | 114 f.write('testing auto-freeze/thaw') |
115 | 115 |
116 output, _ = self.repo.capture_stdio(self.reup.main) | 116 output, _ = self.repo.capture_stdio(self.reup.main) |
117 self.assertIn('Cannot rebase-update', output) | 117 self.assertIn('Cannot rebase-update', output) |
118 | 118 |
119 self.repo.run(self.nb.main, ['empty_branch']) | 119 self.repo.run(self.nb.main, ['empty_branch']) |
120 self.repo.run(self.nb.main, ['--upstream_current', 'empty_branch2']) | 120 self.repo.run(self.nb.main, ['--upstream-current', 'empty_branch2']) |
121 | 121 |
122 self.repo.git('checkout', 'branch_K') | 122 self.repo.git('checkout', 'branch_K') |
123 | 123 |
124 output, _ = self.repo.capture_stdio(self.reup.main) | 124 output, _ = self.repo.capture_stdio(self.reup.main) |
125 | 125 |
126 self.assertIn('Rebasing: branch_G', output) | 126 self.assertIn('Rebasing: branch_G', output) |
127 self.assertIn('Rebasing: branch_K', output) | 127 self.assertIn('Rebasing: branch_K', output) |
128 self.assertIn('Rebasing: branch_L', output) | 128 self.assertIn('Rebasing: branch_L', output) |
129 self.assertIn('Rebasing: foobar', output) | 129 self.assertIn('Rebasing: foobar', output) |
130 self.assertIn('Rebasing: sub_K', output) | 130 self.assertIn('Rebasing: sub_K', output) |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 """) | 333 """) |
334 | 334 |
335 | 335 |
336 if __name__ == '__main__': | 336 if __name__ == '__main__': |
337 sys.exit(coverage_utils.covered_main(( | 337 sys.exit(coverage_utils.covered_main(( |
338 os.path.join(DEPOT_TOOLS_ROOT, 'git_rebase_update.py'), | 338 os.path.join(DEPOT_TOOLS_ROOT, 'git_rebase_update.py'), |
339 os.path.join(DEPOT_TOOLS_ROOT, 'git_new_branch.py'), | 339 os.path.join(DEPOT_TOOLS_ROOT, 'git_new_branch.py'), |
340 os.path.join(DEPOT_TOOLS_ROOT, 'git_reparent_branch.py'), | 340 os.path.join(DEPOT_TOOLS_ROOT, 'git_reparent_branch.py'), |
341 os.path.join(DEPOT_TOOLS_ROOT, 'git_rename_branch.py') | 341 os.path.join(DEPOT_TOOLS_ROOT, 'git_rename_branch.py') |
342 ))) | 342 ))) |
OLD | NEW |