[Extension] Dirty hack of 'shelve' and 'unshelve' command

Harri Salokorpi hsalokor at ee.oulu.fi
Sat May 28 07:32:28 BST 2005


On Friday 27 May 2005 16:24, Aaron Bentley wrote:
> Okay, I've thought about this some more, and I think we can satisfy both
> ~ cases pretty well by using the latest common ancestor as the merge
> BASE, instead of using the working tree.  So:
>
> $ bzr revno
> 43
> $ bzr shelve
> [snpshot S1-960-57 created.]
> $ vi megafile
> [ remove some changes, adjust others, add new changes]
> $ bzr commit
> $ bzr unshelve
> [this will actually do a merge with OTHER=S1-960-57 and BASE=revno 43]

I think this is the right way to do shelving.

> If, after shelving, you make changes to code you changed before
> shelving, then unshelving will produce conflicts, and you'll have to
> sort it out by hand.

Yes, this is acceptable (and obvious) tradeoff.

I think the shelve/unshelve workflow could be something like this:

1) Drop some changes temporarily

$ bzr shelve --partial
[This would launch predefined gui merge tool, which allows user to do a 
multifile merge from working copy to shelve]
$ vi megafile
$ bzr commit
$ bzr unshelve
[Unshelve all changes, show conflicts]

2) Split working copy changes into n patches

$ bzr shelve
[This shelves all changes]
$ bzr unshelve --partial
[This would launch predefined gui merge tool, which allows user to do a 
multifile merge from shelve to working copy]
$ bzr diff > patch1.diff
$ bzr unshelve --partial
[No conflicts, since user picks the changes]
$ bzr diff > patch2.diff

3) Basic case: shelve everything, unshelve everything

$ bzr shelve
$ vi file1 file2 file3
$ bzr commit
$ vi file4 file5 file6
$ bzr commit
$ bzr unshelve
[Unshelve all changes, show conflicts]

So, basically what I'm proposing is that --all parameter is the default, and 
partial shelving is the special option for both shelving and unshelving. This 
would suit at least my workflow.

About partial shelving/unshelving: I think you practically have to rely on 
external merge tool for this. Partial unshelving case should probably use the 
shelved snapshot as base (i.e. do not even try to merge any branch changes to 
snapshot before presenting the data to mergetool since there may be 
conflicts).

-Harri




More information about the bazaar mailing list