[PATCH 04 of 11 RFC] histedit: add execute function (issue4187)
Olle
olle.lundberg at gmail.com
Wed Mar 5 10:21:35 CST 2014
On Wed, Mar 5, 2014 at 5:15 PM, Olle Lundberg <olle.lundberg at gmail.com>wrote:
> # HG changeset patch
> # User Olle Lundberg <geek at nerd.sh>
> # Date 1393978358 -3600
> # Wed Mar 05 01:12:38 2014 +0100
> # Node ID 950c8d5b77e8d5eb610cbea159b7c02387bde211
> # Parent 125d473d0d3982c8a01c94acbcec350522d9555e
> histedit: add execute function (issue4187)
>
> Oops, wrong issue. Will resend this one.
> The basic contract is that it receives a clean working copy and
> is expected to leave a clean working copy if it exits 0.
> If either the command leaves the working copy dirty, or it exits non-0,
> histedit aborts.
>
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -333,10 +333,23 @@
> applychanges(ui, repo, oldctx, opts)
> raise error.InterventionRequired(
> _('Make changes as needed, you may commit or record as needed
> now.\n'
> 'When you are finished, run hg histedit --continue to resume.'))
>
> +def execute(ui, repo, ctx, cmd, opts):
> + hg.update(repo, ctx.node())
> + rc = util.system(cmd)
> + if rc != 0:
> + raise error.InterventionRequired(
> + _('Command exited with %i. Fix up the change and run '
> + 'hg histedit --continue') % rc)
> + if util.any(repo.status()[:4]):
> + raise error.InterventionRequired(
> + _('Working copy dirty, please check the files listed above.\n'
> + 'When you are finished, run hg histedit --continue to
> resume.'))
> + return ctx, []
> +
> def fold(ui, repo, ctx, ha, opts):
> oldctx = repo[ha]
> hg.update(repo, ctx.node())
> stats = applychanges(ui, repo, oldctx, opts)
> if stats and stats[3] > 0:
>
--
Olle
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20140305/698b5774/attachment.html>
More information about the Mercurial-devel
mailing list