revert/shelf/undo/redo
Michael Ellerman
michael at ellerman.id.au
Wed Oct 19 05:19:56 BST 2005
On Wed, 19 Oct 2005 13:12, Martin Pool wrote:
> mpe's shelf plugin (also in bzrtools) is very cool, and i encourage
> people who have not yet used it to try it out. It shows all the
> changed diff hunks in the working tree and lets you choose which ones
> you would like to keep, and the others are set aside into .bzr-shelf.
Glad you like it :)
I've been thinking about shelf a bit lately, but haven't had any time to put
any of my thoughts into code.
Basically I'd like a "shelf" to become a place where you can put multiple
uncommited hunks, and/or commits. The default would be to shelve everything,
the current behaviour would be selected with --hunks or --select.
Unshelve would then bring things off the shelf in reverse order (ie. LIFO),
commits would be recommited, and uncommited hunks would just be left in the
working tree.
Things that might be nice:
- being able to "combine" two patches on the shelf, including combining
non-adjacent patches. This could be tricky, but would be cool.
- unshelving out of order. (similar problem)
- when shelving commits, a choice of uncommiting them (ie. modifying history)
or saving their inverse as a new commit.
- being able to switch between multiple shelves.
That's probably all getting a bit ambitious, but we'll see.
A shelf with (some of) these properties would basically be an implementation
of quilt in bzr. Having used quilt for a while, I think for some workflows
the "tree + patches" model is valuable.
> We also have 'bzr revert' which undoes all changes to reset the
> directory back to the previous revision. As has been recently
> discussed, this has some risk of destroying user data. To fix the
> most immediate problem we should probably give revert an option that
> says whether newly-added files should be deleted or just unversioned.
And it shouldn't be the default.
> [re undo] ...
I'm not sure about undo. I think it could be cool, as long as *all operations*
that affect the repository are undoable. So that includes: adds and removes,
commits, pulls, merges, ignores (?) ... it could get tricky. What you don't
want is for the user to think "bzr undo will undo X" and for it to actually
do Y, especially when X is a subset of Y.
> It would be nice to factor out the hunk-picking parts of shelve and
> make them reusable by this and perhaps by 'commit --interactive'.
I think that code's reasonable, it does nasty things to the terminal though,
so we'd need to make sure it plays nice with the rest of bzr.
cheers
--
Michael Ellerman
IBM OzLabs
email: michael:ellerman.id.au
inmsg: mpe:jabber.org
wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)
We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
More information about the bazaar
mailing list