# HG changeset patch # User Durham Goode # Date 2015-04-04 09:12:53 # Node ID 090da03361c5ad3486d1c29e9f414217bfd331e4 # Parent 8f6494eb16eb7173b98a9f060b120750ce894c9a 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. diff --git a/hgext/histedit.py b/hgext/histedit.py --- a/hgext/histedit.py +++ b/hgext/histedit.py @@ -542,21 +542,20 @@ class fold(histeditaction): 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 @@ class fold(histeditaction): return repo[n], replacements class rollup(fold): - pass + def skipprompt(self): + return True class drop(histeditaction): def run(self):