histedit: drop the 'nodetoverify' method
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Fri, 26 Aug 2016 20:31:33 +0200
changeset 29874 0099e29fc95c
parent 29873 80ba176bad62
child 29875 478e4a2a9952
histedit: drop the 'nodetoverify' method That method is just returning self.node and is never overridden. We just use the attribute directly instead and get rid of the method. This is the beginning of series to simplify and unify verification of constraints for actions.
hgext/histedit.py
--- a/hgext/histedit.py	Mon Aug 29 22:59:39 2016 +0900
+++ b/hgext/histedit.py	Fri Aug 26 20:31:33 2016 +0200
@@ -439,14 +439,6 @@
         """
         return set([_constraints.noduplicates, _constraints.noother])
 
-    def nodetoverify(self):
-        """Returns a node associated with the action that will be used for
-        verification purposes.
-
-        If the action doesn't correspond to node it should return None
-        """
-        return self.node
-
     def run(self):
         """Runs the action. The default behavior is simply apply the action's
         rulectx onto the current parentctx."""
@@ -1199,8 +1191,8 @@
     else:
         rules = _readfile(rules)
     actions = parserules(rules, state)
-    ctxs = [repo[act.nodetoverify()] \
-            for act in state.actions if act.nodetoverify()]
+    ctxs = [repo[act.node] \
+            for act in state.actions if act.node]
     warnverifyactions(ui, repo, actions, state, ctxs)
     state.actions = actions
     state.write()
@@ -1397,7 +1389,7 @@
                 raise error.ParseError(_('unknown constraint "%s"') %
                         constraint)
 
-        nodetoverify = action.nodetoverify()
+        nodetoverify = action.node
         if nodetoverify is not None:
             ha = node.hex(nodetoverify)
             if _constraints.noother in constraints and ha not in expected:
@@ -1597,8 +1589,8 @@
     if os.path.exists(os.path.join(repo.path, 'histedit-state')):
         state = histeditstate(repo)
         state.read()
-        histedit_nodes = set([action.nodetoverify() for action
-                             in state.actions if action.nodetoverify()])
+        histedit_nodes = set([action.node for action
+                             in state.actions if action.node])
         strip_nodes = set([repo[n].node() for n in nodelist])
         common_nodes = histedit_nodes & strip_nodes
         if common_nodes: