Mercurial > hg-stable
changeset 48223:141aafac446c
chistedit: move changeaction() onto state class
Differential Revision: https://phab.mercurial-scm.org/D11647
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 12 Oct 2021 09:22:29 -0700 |
parents | 0444956ecbcf |
children | 7913f533592d |
files | hgext/histedit.py |
diffstat | 1 files changed, 8 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/histedit.py Tue Oct 12 09:20:46 2021 -0700 +++ b/hgext/histedit.py Tue Oct 12 09:22:29 2021 -0700 @@ -1194,13 +1194,6 @@ # ============ EVENTS =============== -def changeaction(state, pos, action): - """Change the action state on the given position to the new action""" - rules = state.rules - assert 0 <= pos < len(rules) - rules[pos].action = action - - def cycleaction(state, pos, next=False): """Changes the action state the next or the previous action from the action list""" @@ -1215,7 +1208,7 @@ index += 1 else: index -= 1 - changeaction(state, pos, KEY_LIST[index % len(KEY_LIST)]) + state.change_action(pos, KEY_LIST[index % len(KEY_LIST)]) def changeview(state, delta, unit): @@ -1505,7 +1498,7 @@ if selected is not None: self.swap(oldpos, newrule.pos) elif action.startswith(b'action-'): - changeaction(self, oldpos, action[7:]) + self.change_action(oldpos, action[7:]) elif action == b'showpatch': self.change_mode(MODE_PATCH if curmode != MODE_PATCH else prevmode) elif action == b'help': @@ -1588,6 +1581,12 @@ if self.selected: self.make_selection(newpos) + def change_action(self, pos, action): + """Change the action state on the given position to the new action""" + rules = self.rules + assert 0 <= pos < len(rules) + rules[pos].action = action + def _chisteditmain(repo, rules, stdscr): try: