|
7 | 7 | SquashMergeDetection) |
8 | 8 | from git_machete.client.with_code_hosting import MacheteClientWithCodeHosting |
9 | 9 | from git_machete.code_hosting import PullRequest |
10 | | -from git_machete.exceptions import (InteractionStopped, MacheteException, |
11 | | - UnexpectedMacheteException) |
| 10 | +from git_machete.exceptions import MacheteException, UnexpectedMacheteException |
12 | 11 | from git_machete.git_operations import (GitContext, LocalBranchShortName, |
13 | 12 | SyncToRemoteStatus) |
14 | 13 | from git_machete.utils import (bold, flat_map, fmt, get_pretty_choices, |
@@ -350,39 +349,36 @@ def traverse( |
350 | 349 |
|
351 | 350 | if needs_remote_sync: |
352 | 351 | any_action_suggested = True |
353 | | - try: |
354 | | - if s == SyncToRemoteStatus.BEHIND_REMOTE: |
355 | | - assert remote is not None |
356 | | - self._handle_behind_state(branch=current_branch, remote=remote, opt_yes=opt_yes) |
357 | | - elif s == SyncToRemoteStatus.AHEAD_OF_REMOTE: |
358 | | - assert remote is not None |
359 | | - self._handle_ahead_state( |
360 | | - current_branch=current_branch, |
361 | | - remote=remote, |
362 | | - is_called_from_traverse=True, |
363 | | - opt_push_tracked=opt_push_tracked, |
364 | | - opt_yes=opt_yes) |
365 | | - elif s == SyncToRemoteStatus.DIVERGED_FROM_AND_OLDER_THAN_REMOTE: |
366 | | - self._handle_diverged_and_older_state(current_branch, opt_yes=opt_yes) |
367 | | - elif s == SyncToRemoteStatus.DIVERGED_FROM_AND_NEWER_THAN_REMOTE: |
368 | | - assert remote is not None |
369 | | - self._handle_diverged_and_newer_state( |
370 | | - current_branch=current_branch, |
371 | | - remote=remote, |
372 | | - opt_push_tracked=opt_push_tracked, |
373 | | - opt_yes=opt_yes) |
374 | | - elif s == SyncToRemoteStatus.UNTRACKED: |
375 | | - self._handle_untracked_state( |
376 | | - branch=current_branch, |
377 | | - is_called_from_traverse=True, |
378 | | - is_called_from_code_hosting=False, |
379 | | - opt_push_untracked=opt_push_untracked, |
380 | | - opt_push_tracked=opt_push_tracked, |
381 | | - opt_yes=opt_yes) |
382 | | - else: |
383 | | - raise UnexpectedMacheteException(f"Unexpected SyncToRemoteStatus: {s}.") |
384 | | - except InteractionStopped: |
385 | | - return |
| 352 | + if s == SyncToRemoteStatus.BEHIND_REMOTE: |
| 353 | + assert remote is not None |
| 354 | + self._handle_behind_state(branch=current_branch, remote=remote, opt_yes=opt_yes) |
| 355 | + elif s == SyncToRemoteStatus.AHEAD_OF_REMOTE: |
| 356 | + assert remote is not None |
| 357 | + self._handle_ahead_state( |
| 358 | + current_branch=current_branch, |
| 359 | + remote=remote, |
| 360 | + is_called_from_traverse=True, |
| 361 | + opt_push_tracked=opt_push_tracked, |
| 362 | + opt_yes=opt_yes) |
| 363 | + elif s == SyncToRemoteStatus.DIVERGED_FROM_AND_OLDER_THAN_REMOTE: |
| 364 | + self._handle_diverged_and_older_state(current_branch, opt_yes=opt_yes) |
| 365 | + elif s == SyncToRemoteStatus.DIVERGED_FROM_AND_NEWER_THAN_REMOTE: |
| 366 | + assert remote is not None |
| 367 | + self._handle_diverged_and_newer_state( |
| 368 | + current_branch=current_branch, |
| 369 | + remote=remote, |
| 370 | + opt_push_tracked=opt_push_tracked, |
| 371 | + opt_yes=opt_yes) |
| 372 | + elif s == SyncToRemoteStatus.UNTRACKED: |
| 373 | + self._handle_untracked_state( |
| 374 | + branch=current_branch, |
| 375 | + is_called_from_traverse=True, |
| 376 | + is_called_from_code_hosting=False, |
| 377 | + opt_push_untracked=opt_push_untracked, |
| 378 | + opt_push_tracked=opt_push_tracked, |
| 379 | + opt_yes=opt_yes) |
| 380 | + else: |
| 381 | + raise UnexpectedMacheteException(f"Unexpected SyncToRemoteStatus: {s}.") |
386 | 382 |
|
387 | 383 | if needs_create_pr: |
388 | 384 | any_action_suggested = True |
|
0 commit comments