changeset 27200:62b9a87a365e

histedit: add actions property to histedit state I want to refactor histedit to use action objects instead of (verb, rest) pairs whenever possible. At the end of this series I want the rules to be translated into action objects when reading state and translated back when writing state. All histedit internals should use action objects instead of state rules. To migrate histedti internals sequentially I'm introducing the state.actions property to translate rules on the fly so we can use both state.actions and state.rules until refactoring is done.
author Mateusz Kwapich <mitrandir@fb.com>
date Wed, 02 Dec 2015 12:19:01 -0800
parents 8f5735b4aca5
children dcb536d2e138
files hgext/histedit.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Fri Nov 06 17:27:42 2015 -0500
+++ b/hgext/histedit.py	Wed Dec 02 12:19:01 2015 -0800
@@ -328,6 +328,14 @@
     def inprogress(self):
         return self.repo.vfs.exists('histedit-state')
 
+    @property
+    def actions(self):
+        actions = []
+        for (act, rest) in self.rules:
+            actions.append(actiontable[act].fromrule(self, rest))
+        return actions
+
+
 class histeditaction(object):
     def __init__(self, state, node):
         self.state = state