Using shelve to mimic Git's staging area

A. S. Budden abudden at gmail.com
Tue Sep 27 11:07:29 UTC 2011


On 27 September 2011 11:35, John Arbash Meinel <john at arbash-meinel.com> wrote:
[snip]
> We don't have a way of distinguishing those changes from being a
> conflict. I can see your point that it would be nice if we could
> shelve the change vs the aggregate, so that we can see that you really
> do want to insert that line before the other.

Okay, thanks for explaining that.  I'd been looking at it from the
angle of what I wanted to achieve (which is to commit some changes in
one changeset and then some other changes in another changeset) rather
than understanding what shelve actually does.  I guess I'll have to
stick with using patches [1], I just noticed a reference to shelve on
a website and got momentarily excited!

As I understand it [2], Mercurial suffers from this same issue.

> It isn't possible at the moment, but it would be interesting to think
> about.
>
> Maybe I'm misunderstanding how Aaron implemented shelves, though.

Thanks again for the very quick answers.

Al

[1] Something like:
    $ bzr diff Stuff.c > shelf.diff # assuming all changes I want to
shelve are in Stuff.c
    $ vim shelf.diff # manually delete changes I DO want to commit
    $ patch -p0 -R < shelf.diff
    $ bzr ci -m "First commit"
    $ patch -p0 < shelf.diff
    $ bzr ci -m "Second commit"
    $ rm shelf.diff

[2] http://mercurial.selenic.com/wiki/RecordExtension - see the
"Feature Request" at the bottom



More information about the bazaar mailing list