(self, commit, i, total, commits)
| 99 | return reasons |
| 100 | |
| 101 | def handle_commit(self, commit, i, total, commits): |
| 102 | potential_reverts = self.potential_reverts_of(commit, commits) |
| 103 | if potential_reverts: |
| 104 | potential_reverts = f"!!!POTENTIAL REVERTS!!!: {potential_reverts}" |
| 105 | else: |
| 106 | potential_reverts = "" |
| 107 | |
| 108 | features = self.features(commit) |
| 109 | if self.classifier is not None: |
| 110 | # Some commits don't have authors: |
| 111 | author = features.author if features.author else "Unknown" |
| 112 | files = " ".join(features.files_changed) |
| 113 | classifier_input = CommitClassifierInputs( |
| 114 | title=[features.title], files=[files], author=[author] |
| 115 | ) |
| 116 | classifier_category = self.classifier.get_most_likely_category_name( |
| 117 | classifier_input |
| 118 | )[0] |
| 119 | |
| 120 | else: |
| 121 | classifier_category = commit.category |
| 122 | |
| 123 | breaking_alarm = "" |
| 124 | if "module: bc-breaking" in features.labels: |
| 125 | breaking_alarm += "\n!!!!!! BC BREAKING !!!!!!" |
| 126 | |
| 127 | if "module: deprecation" in features.labels: |
| 128 | breaking_alarm += "\n!!!!!! DEPRECATION !!!!!!" |
| 129 | |
| 130 | os.system("clear") |
| 131 | view = textwrap.dedent( |
| 132 | f"""\ |
| 133 | [{i}/{total}] |
| 134 | ================================================================================ |
| 135 | {features.title} |
| 136 | |
| 137 | {potential_reverts} {breaking_alarm} |
| 138 | |
| 139 | {features.body} |
| 140 | |
| 141 | Files changed: {features.files_changed} |
| 142 | |
| 143 | Labels: {features.labels} |
| 144 | |
| 145 | Current category: {commit.category} |
| 146 | |
| 147 | Select from: {', '.join(common.categories)} |
| 148 | |
| 149 | """ |
| 150 | ) |
| 151 | print(view) |
| 152 | cat_choice = None |
| 153 | while cat_choice is None: |
| 154 | print("Enter category: ") |
| 155 | value = input(f"{classifier_category} ").strip() |
| 156 | if len(value) == 0: |
| 157 | # The user just pressed enter and likes the default value |
| 158 | cat_choice = classifier_category |
no test coverage detected