[PATCH 05 of 11 RFC] histedit: add support for continuing after an exec

Olle olle.lundberg at gmail.com
Wed Mar 5 16:34:40 CST 2014


On Wed, Mar 5, 2014 at 10:56 PM, David Soria Parra <
dsp at experimentalworks.net> wrote:

> 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.
>
That's only partly true.
If we end up in a state when the user needs to clean stuff up, but forgets
to commit, we either need to bail or go with the edit logic.

> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>



-- 
Olle
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20140305/73dce4f7/attachment.html>


More information about the Mercurial-devel mailing list