From patchwork Fri May 3 00:26:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: amend: add keep parameter to cmdutil.amend From: Durham Goode X-Patchwork-Id: 1536 Message-Id: <6406230e4a8ae8ebc412.1367540804@dev350.prn1.facebook.com> To: mercurial-devel@selenic.com Date: Thu, 02 May 2013 17:26:44 -0700 # HG changeset patch # User Durham Goode # Date 1367539398 25200 # Thu May 02 17:03:18 2013 -0700 # Node ID 6406230e4a8ae8ebc412621c86ab464092d99653 # Parent a047d5348816e0aa561c072cdd603e0933d520b5 amend: add keep parameter to cmdutil.amend An extension I'm working on wants to use cmdutil.amend without it stripping the original revisions. This change adds an optional flag to allow that. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -1611,7 +1611,7 @@ return commitfunc(ui, repo, message, scmutil.match(repo[None], pats, opts), opts) -def amend(ui, repo, commitfunc, old, extra, pats, opts): +def amend(ui, repo, commitfunc, old, extra, pats, opts, keep=False): ui.note(_('amending changeset %s\n') % old) base = old.p1() @@ -1786,7 +1786,11 @@ if node: ui.note(_('stripping intermediate changeset %s\n') % ctx) ui.note(_('stripping amended changeset %s\n') % old) - repair.strip(ui, repo, old.node(), topic='amend-backup') + if not keep: + repair.strip(ui, repo, old.node(), topic='amend-backup') + elif node: + # strip only the temporary commit + repair.strip(ui, repo, node, backup='none') finally: if newid is None: repo.dirstate.invalidate()