[PATCH 4 of 4] shelve: add a shelve extension to save/restore working changes

Idan Kamara idankk86 at gmail.com
Thu May 30 08:36:27 CDT 2013


On Wed, May 29, 2013 at 2:28 AM, Bryan O'Sullivan <bos at serpentine.com>
wrote:
>
> # HG changeset patch
> # User Bryan O'Sullivan <bryano at fb.com>
> # Date 1369783721 25200
> #      Tue May 28 16:28:41 2013 -0700
> # Node ID a87ee920b333192898e8ff84e30ddb1ebac515b6
> # Parent  11fce4dc68f060e96cc06cc88da72e2c9da1022b
> shelve: add a shelve extension to save/restore working changes
>
> This extension saves shelved changes using a temporary draft commit,
> and bundles all draft ancestors of the temporary commit. This
> strategy makes it possible to use Mercurial's merge machinery to
> resolve conflicts if necessary when unshelving, even when the
> destination commit or its ancestors have been amended, squashed,
> or evolved.

Nice, this seems to deal with the issues I had with my implementation.

Are you stripping the temporary commit and its bundled ancestors when an
unshelve succeeds?

>
> Although this extension shares its name and some functionality with
> the third party hgshelve extension, it has little else in common.
> Notably, the hgshelve extension shelves changes as unified diffs,
> which makes conflict resolution a matter of finding .rej files and
> cleaning up the mess by hand.

Won't the name conflict cause issues for existing users of hgshelve? Why
not call it stash?

>
> We do not yet allow hunk-level choosing of changes to record.
> Compared to the hgshelve extension, this is a small regression in
> usability, but we hope to integrate that at a later point, once the
> record machinery becomes more reusable and robust.
>
> diff --git a/hgext/color.py b/hgext/color.py
> --- a/hgext/color.py
> +++ b/hgext/color.py
> @@ -63,6 +63,10 @@ Default effects may be overridden from y
>    rebase.rebased = blue
>    rebase.remaining = red bold
>
> +  shelve.age = cyan
> +  shelve.newest = green bold
> +  shelve.name = blue bold
> +
>    histedit.remaining = red bold
>
>  The available effects in terminfo mode are 'blink', 'bold', 'dim',
> @@ -260,6 +264,9 @@ except ImportError:
>             'rebase.remaining': 'red bold',
>             'resolve.resolved': 'green bold',
>             'resolve.unresolved': 'red bold',
> +           'shelve.age': 'cyan',
> +           'shelve.newest': 'green bold',
> +           'shelve.name': 'blue bold',
>             'status.added': 'green bold',
>             'status.clean': 'none',
>             'status.copied': 'none',
> diff --git a/hgext/shelve.py b/hgext/shelve.py
> new file mode 100644
> --- /dev/null
> +++ b/hgext/shelve.py
> @@ -0,0 +1,552 @@
> +# shelve.py - save/restore working directory state

Does this file pass tests? There are some unused imports and
commented code here.

[..]

> +
> +apply it and make sure our state is as expected
> +
> +  $ hg unshelve
> +  unshelving change 'default-01'
> +  adding changesets
> +  adding manifests
> +  adding file changes
> +  added 1 changesets with 3 changes to 7 files
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved

Shouldn't it say 1 files updated here?

> +  $ hg status -C
> +  M a/a
> +  A b.rename/b
> +    b/b
> +  A c.copy
> +    c
> +  R b/b
> +  $ hg shelve -l
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20130530/584a86b1/attachment.html>


More information about the Mercurial-devel mailing list