histedit: convert drop action into a class
This converts the drop action into a histeditclass instance, as part of an
ongoing effort to refactor histedit for maintainability and robustness.
--- a/hgext/histedit.py Sat Apr 04 11:39:08 2015 -0700
+++ b/hgext/histedit.py Sat Apr 04 00:30:01 2015 -0700
@@ -568,11 +568,10 @@
replacements.append((ich, (n,)))
return repo[n], replacements
-def drop(ui, state, ha, opts):
- repo, ctxnode = state.repo, state.parentctxnode
- ctx = repo[ctxnode]
- return ctx, [(repo[ha].node(), ())]
-
+class drop(histeditaction):
+ def run(self):
+ parentctx = self.repo[self.state.parentctxnode]
+ return parentctx, [(self.node, tuple())]
def message(ui, state, ha, opts):
repo, ctxnode = state.repo, state.parentctxnode