[PATCH 2 of 3] shelve: do not update when keeping changes, just set the right parent

Pulkit Goyal 7895pulkit at gmail.com
Fri Mar 22 11:42:49 EDT 2019


On Fri, Mar 22, 2019 at 6:35 PM Jordi GutiƩrrez Hermoso <jordigh at octave.org>
wrote:

> # HG changeset patch
> # User Jordi GutiƩrrez Hermoso <jordigh at octave.org>
> # Date 1553268335 14400
> #      Fri Mar 22 11:25:35 2019 -0400
> # Node ID 6bff7f54a5f20e72e63edbceb2a34d86fb4c86f4
> # Parent  773e8b313d28d85002c459ea69d3671e7a0bc05e
> shelve: do not update when keeping changes, just set the right parent
>
> This is not enough to enable `shelve --keep` to work, but it's a
> necessary first step.
>

Thanks a lot \o/ \o/ \o/

>
> diff --git a/hgext/shelve.py b/hgext/shelve.py
> --- a/hgext/shelve.py
> +++ b/hgext/shelve.py
> @@ -506,7 +506,10 @@ def _docreatecmd(ui, repo, pats, opts):
>          if ui.formatted():
>              desc = stringutil.ellipsis(desc, ui.termwidth())
>          ui.status(_('shelved as %s\n') % name)
> -        hg.update(repo, parent.node())
> +        if opts['keep']:
> +            repo.setparents(parent.node(), nodemod.nullid)
>

This function can be used here:
https://www.mercurial-scm.org/repo/hg-committed/file/6fef387af1da/mercurial/scmutil.py#l1257

It should make the next patch unrequired.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20190322/f487fb2a/attachment.html>


More information about the Mercurial-devel mailing list