changeset 24768:342671704344

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.
author Durham Goode <durham@fb.com>
date Sat, 04 Apr 2015 00:30:01 -0700
parents 477e76936b1d
children e875b94dc94c
files hgext/histedit.py
diffstat 1 files changed, 4 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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