(self)
| 34 | self.cmd += f"{type(self).__name__.lower()} {self.branch}" |
| 35 | |
| 36 | def construct(self): |
| 37 | if not settings.stdout and not settings.output_only_path and not settings.quiet: |
| 38 | print(f"{settings.INFO_STRING} {self.cmd}") |
| 39 | |
| 40 | if self.branch in self.repo.git.branch( |
| 41 | "--contains", self.repo.active_branch.name |
| 42 | ): |
| 43 | print( |
| 44 | "git-sim error: Branch '" |
| 45 | + self.repo.active_branch.name |
| 46 | + "' is already included in the history of active branch '" |
| 47 | + self.branch |
| 48 | + "'." |
| 49 | ) |
| 50 | sys.exit(1) |
| 51 | |
| 52 | if self.repo.active_branch.name in self.repo.git.branch( |
| 53 | "--contains", self.branch |
| 54 | ): |
| 55 | print( |
| 56 | "git-sim error: Branch '" |
| 57 | + self.branch |
| 58 | + "' is already based on active branch '" |
| 59 | + self.repo.active_branch.name |
| 60 | + "'." |
| 61 | ) |
| 62 | sys.exit(1) |
| 63 | |
| 64 | self.show_intro() |
| 65 | branch_commit = self.get_commit(self.branch) |
| 66 | self.parse_commits(branch_commit) |
| 67 | head_commit = self.get_commit() |
| 68 | |
| 69 | reached_base = False |
| 70 | for commit in self.get_default_commits(): |
| 71 | if commit != "dark" and self.branch in self.repo.git.branch( |
| 72 | "--contains", commit |
| 73 | ): |
| 74 | reached_base = True |
| 75 | |
| 76 | self.parse_commits(head_commit, shift=4 * m.DOWN) |
| 77 | self.parse_all() |
| 78 | self.center_frame_on_commit(branch_commit) |
| 79 | |
| 80 | to_rebase = [] |
| 81 | i = 0 |
| 82 | current = head_commit |
| 83 | while self.branch not in self.repo.git.branch("--contains", current): |
| 84 | to_rebase.append(current) |
| 85 | i += 1 |
| 86 | if i >= self.n: |
| 87 | break |
| 88 | current = self.get_default_commits()[i] |
| 89 | |
| 90 | parent = branch_commit.hexsha |
| 91 | |
| 92 | for j, tr in enumerate(reversed(to_rebase)): |
| 93 | if not reached_base and j == 0: |
nothing calls this directly
no test coverage detected