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 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 self.repo.git('checkout', '--theirs', 'M') | 252 self.repo.git('checkout', '--theirs', 'M') |
253 self.repo.git('rebase', '--skip') | 253 self.repo.git('rebase', '--skip') |
254 | 254 |
255 output, _ = self.repo.capture_stdio(self.reup.main) | 255 output, _ = self.repo.capture_stdio(self.reup.main) |
256 self.assertIn('Failed! Attempting to squash', output) | 256 self.assertIn('Failed! Attempting to squash', output) |
257 self.assertIn('Deleted branch branch_G', output) | 257 self.assertIn('Deleted branch branch_G', output) |
258 self.assertIn('Deleted branch branch_L', output) | 258 self.assertIn('Deleted branch branch_L', output) |
259 self.assertIn('\'branch_G\' was merged', output) | 259 self.assertIn('\'branch_G\' was merged', output) |
260 self.assertIn('checking out \'origin/master\'', output) | 260 self.assertIn('checking out \'origin/master\'', output) |
261 | 261 |
| 262 def testRebaseConflictsKeepGoing(self): |
| 263 # Pretend that branch_L landed |
| 264 self.origin.git('checkout', 'master') |
| 265 with self.origin.open('L', 'w') as f: |
| 266 f.write('L') |
| 267 self.origin.git('add', 'L') |
| 268 self.origin.git_commit('L') |
| 269 |
| 270 # Add a commit to branch_K so that things fail |
| 271 self.repo.git('checkout', 'branch_K') |
| 272 with self.repo.open('M', 'w') as f: |
| 273 f.write('NOPE') |
| 274 self.repo.git('add', 'M') |
| 275 self.repo.git_commit('K NOPE') |
| 276 |
| 277 # Add a commits to branch_L which will work when squashed |
| 278 self.repo.git('checkout', 'branch_L') |
| 279 self.repo.git('reset', 'branch_L~') |
| 280 with self.repo.open('L', 'w') as f: |
| 281 f.write('NOPE') |
| 282 self.repo.git('add', 'L') |
| 283 self.repo.git_commit('L NOPE') |
| 284 with self.repo.open('L', 'w') as f: |
| 285 f.write('L') |
| 286 self.repo.git('add', 'L') |
| 287 self.repo.git_commit('L YUP') |
| 288 |
| 289 # start on a branch which will be deleted |
| 290 self.repo.git('checkout', 'branch_G') |
| 291 |
| 292 self.repo.git('config', 'branch.branch_K.dormant', 'false') |
| 293 output, _ = self.repo.capture_stdio(self.reup.main, ['-k']) |
| 294 self.assertIn('--keep-going set, continuing with next branch.', output) |
| 295 self.assertIn('could not be cleanly rebased:', output) |
| 296 self.assertIn(' branch_K', output) |
| 297 |
262 | 298 |
263 def testTrackTag(self): | 299 def testTrackTag(self): |
264 self.origin.git('tag', 'lkgr', self.origin['M']) | 300 self.origin.git('tag', 'lkgr', self.origin['M']) |
265 self.repo.git('tag', 'lkgr', self.repo['D']) | 301 self.repo.git('tag', 'lkgr', self.repo['D']) |
266 | 302 |
267 self.repo.git('config', 'branch.branch_G.remote', '.') | 303 self.repo.git('config', 'branch.branch_G.remote', '.') |
268 self.repo.git('config', 'branch.branch_G.merge', 'refs/tags/lkgr') | 304 self.repo.git('config', 'branch.branch_G.merge', 'refs/tags/lkgr') |
269 | 305 |
270 self.assertIn( | 306 self.assertIn( |
271 'fatal: \'foo bar\' is not a valid branch name', | 307 'fatal: \'foo bar\' is not a valid branch name', |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 """) | 372 """) |
337 | 373 |
338 | 374 |
339 if __name__ == '__main__': | 375 if __name__ == '__main__': |
340 sys.exit(coverage_utils.covered_main(( | 376 sys.exit(coverage_utils.covered_main(( |
341 os.path.join(DEPOT_TOOLS_ROOT, 'git_rebase_update.py'), | 377 os.path.join(DEPOT_TOOLS_ROOT, 'git_rebase_update.py'), |
342 os.path.join(DEPOT_TOOLS_ROOT, 'git_new_branch.py'), | 378 os.path.join(DEPOT_TOOLS_ROOT, 'git_new_branch.py'), |
343 os.path.join(DEPOT_TOOLS_ROOT, 'git_reparent_branch.py'), | 379 os.path.join(DEPOT_TOOLS_ROOT, 'git_reparent_branch.py'), |
344 os.path.join(DEPOT_TOOLS_ROOT, 'git_rename_branch.py') | 380 os.path.join(DEPOT_TOOLS_ROOT, 'git_rename_branch.py') |
345 ))) | 381 ))) |
OLD | NEW |