changeset 24773:090da03361c5

histedit: improve roll action integration with fold Previously the fold action would inspect it's class to figure out if it was a rollup or not. This was hacky. Now that finishfold is inside the fold class, let's modify it to check a function (which roll can override) to determine if it should be prompting for a commit message.
author Durham Goode <durham@fb.com>
date Sat, 04 Apr 2015 02:12:53 -0700
parents 8f6494eb16eb
children a9d63d87b837
files hgext/histedit.py
diffstat 1 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/histedit.py	Sat Apr 04 02:12:24 2015 -0700
+++ b/hgext/histedit.py	Sat Apr 04 02:12:53 2015 -0700
@@ -542,21 +542,20 @@
         middlecommits = newcommits.copy()
         middlecommits.discard(ctx.node())
 
-        foldopts = {}
-        if isinstance(self, rollup):
-            foldopts['rollup'] = True
+        return self.finishfold(repo.ui, repo, parentctx, rulectx, ctx.node(),
+                               middlecommits)
 
-        return self.finishfold(repo.ui, repo, parentctx, rulectx, ctx.node(),
-                               foldopts, middlecommits)
+    def skipprompt(self):
+        return False
 
-    def finishfold(self, ui, repo, ctx, oldctx, newnode, opts, internalchanges):
+    def finishfold(self, ui, repo, ctx, oldctx, newnode, internalchanges):
         parent = ctx.parents()[0].node()
         hg.update(repo, parent)
         ### prepare new commit data
-        commitopts = opts.copy()
+        commitopts = {}
         commitopts['user'] = ctx.user()
         # commit message
-        if opts.get('rollup'):
+        if self.skipprompt():
             newmessage = ctx.description()
         else:
             newmessage = '\n***\n'.join(
@@ -591,7 +590,8 @@
         return repo[n], replacements
 
 class rollup(fold):
-    pass
+    def skipprompt(self):
+        return True
 
 class drop(histeditaction):
     def run(self):