[PATCH 05 of 11 RFC] histedit: add support for continuing after an exec
David Soria Parra
dsp at experimentalworks.net
Wed Mar 5 15:56:01 CST 2014
Olle Lundberg <olle.lundberg at gmail.com> writes:
> # HG changeset patch
> # User Olle Lundberg <geek at nerd.sh>
> # Date 1394034779 -3600
> # Wed Mar 05 16:52:59 2014 +0100
> # Node ID cb0ccd948579f1ccbcb39e3749b77268985d0a7b
> # Parent 950c8d5b77e8d5eb610cbea159b7c02387bde211
> histedit: add support for continuing after an exec
>
> Bail if there are any uncommited changes/merges in the working
> directory. Else set the currentnode to the working directories
> first parent and let histedit do its magic. Unless the current
> node ctx matches the parent ctx, then we can short circuit the
> logic since there are no changes and we can just return the
> parent with an empty replacements list.
>
> diff --git a/hgext/histedit.py b/hgext/histedit.py
> --- a/hgext/histedit.py
> +++ b/hgext/histedit.py
> @@ -664,10 +664,28 @@
> os.unlink(repo.sjoin('undo'))
>
>
> def bootstrapcontinue(ui, repo, parentctx, rules, opts):
> action, currentnode = rules.pop(0)
> +
> + # track replacements
> + replacements = []
> +
> + if action in ('x', 'exec'):
> + # TODO: Do we want to auto-commit anything that the exec did for us?
> + # That would be useful in cases where there is an external tool
> + # modifying commits for us. The auto-commit behaviour is present in
> + # the case when a used have used edit to split/add commits. Whatever
> + # is present in the working dir gets commited.
> + # If the first parent of the working direcroty is the same as the
> + # parentctx from the histedit state, we can short circuit the logic
> + # and just return the parentctx with no replacements.
> + cmdutil.bailifchanged(repo)
> + currentnode = repo[None].p1()
> + if currentnode == parentctx:
> + return parentctx, replacements
auto commit won't be necessary if we drop locks and allow the command to
commit.
More information about the Mercurial-devel
mailing list