Using shelve to mimic Git's staging area

A. S. Budden abudden at gmail.com
Tue Sep 27 09:00:12 UTC 2011


Dear all,

I've recently been experimenting with bzr shelve.  As I understand it,
this is intended to be an equivalent to the staging area in git: I can
make changes on two separate issues and then commit them separately by
moving one set of changes temporarily onto the shelf.  I hope I have
understood that right.

However, I have been unable to work out how to do this when changes
are close together in a file.  For example, imagine I had a file
stuff.c, which "bzr diff" reports as looking like this:

    === modified file 'Stuff.c'
    --- Stuff.c             2011-09-22 14:04:20 +0000
    +++ Stuff.c             2011-09-27 07:40:16 +0000
    @@ -42,6 +42,8 @@
      * Some random comments preceding the change
      * that have already been committed.
      */
    +/* I'd like to shelve this change */
    +/* But not this one */
     void AFunctionThatHasNotChanged(void)
     {
         uint8_t variable;

With git, I can add one of those too new comment lines to the staging
area and commit, then add the other one and commit [1].  Obviously
this is a rather contrived example, but is there any way to do the
equivalent of this with bzr (q)shelve?

Thanks,

Al

[1] In the command line version of git, this is done by editing the
patch directly; in "git gui", you can right-click on a line and select
either "add hunk to staging area" or "add line to staging area".



More information about the bazaar mailing list