[Extension] Dirty hack of 'shelve' and 'unshelve' command
Erik Bågfors
zindar at gmail.com
Thu May 19 11:18:07 BST 2005
Never mind, found the reason.
: [bagfors at zyrgelkwyt]$ ; cat -v /home/bagfors/usr/src/bzrpath/shelve
#!/usr/bin/python^M
dos line ending. That doesn't work very good in the shebang on unix.
"perl -i.bak -pe 's/\r//g' *" solved the problem
Anyway, using this did not work as I was expecting. I did four changes
to a file in the repo, at four different lines not connected. Then did
"bzr shelve" and all four were shown as one patch. Compared to darcs
where each change would have been one "change" that I could commit or
not.
: [bagfors at zyrgelkwyt]$ ; bzr shelve
passwd
@@ -2,20 +2,20 @@
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
-sync:x:4:65534:sync:/bin:/bin/sync
+ljlkjlkj
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
-news:x:9:9:news:/var/spool/news:/bin/sh
+lkjlkjj
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
-list:x:38:38:Mailing List Manager:/var/list:/bin/sh
+list:xteljeltkjetlkj
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
-nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
+ljdalkjdlaj
postfix:x:100:103::/var/spool/postfix:/bin/false
syslog:x:105:105::/home/syslog:/bin/false
klog:x:106:106::/home/klog:/bin/false
Shelve this change? (1 of 1) [yn] n
Nothing to shelve
/Erik
On 5/19/05, Erik Bågfors <zindar at gmail.com> wrote:
> Hi
>
> I think this sounds very interesting. Altough I think having a
> pre-commit test instead might be more useful. I also see the use for
> this. I think this is what makes plugins in bzr so extreamly useful!
>
> I think there are lot's of tools that makes sence to have as plugin
> for people who want them instead of having it in the main bzr and make
> that more complicated. This is a great example of this!
>
> Anyway, This is the first time I try a plugin in bzr and I have no
> luck. Here is what happens
>
> : [bagfors at zyrgelkwyt]$ ; bzr shelve
> : bad interpreter: No such file or directorysr/bin/python
> : bad interpreter: No such file or directorysr/bin/python
>
>
> : [bagfors at zyrgelkwyt]$ ; ls -l $BZRPATH
> total 24
> -rw-r--r-- 1 bagfors bagfors 9727 2005-05-19 10:05 patches.py
> -rw-r--r-- 1 bagfors bagfors 3232 2005-05-19 10:06 shelf.py
> -rwxr-xr-x 1 bagfors bagfors 261 2005-05-19 10:06 shelve*
> -rwxr-xr-x 1 bagfors bagfors 263 2005-05-19 10:06 unshelve*
>
> : [bagfors at zyrgelkwyt]$ ; head -1 $BZRPATH/shelve
> #!/usr/bin/python
>
> : [bagfors at zyrgelkwyt]$ ; /usr/bin/python
> Python 2.4.1 (#2, Mar 30 2005, 21:51:10)
> [GCC 3.3.5 (Debian 1:3.3.5-8ubuntu2)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>
> So, this looks very strange. Can this be a UTF-8 problem again? Has
> anyone else seen this?
>
> This is interesting also
>
> : [bagfors at zyrgelkwyt]$ ; bzr help shelve
> : bad interpreter: No such file or directorysr/bin/python
> : bad interpreter: No such file or directorysr/bin/python
> usage: shelve
>
>
> Regards,
> Erik
>
>
> On 5/19/05, Michael Ellerman <michael at ellerman.id.au> wrote:
> > Hi All,
> >
> > I'm a big nut fan of Darc's support for partial commits. If you've never used
> > it, it allows you to choose which hunks of the diff you want to commit - how
> > awesome.
> >
> > However it has one drawback, which is that it allows you to commit to history
> > tree states that never actually existed in your working tree/repository.
> > Usually that's exactly why you use it, but it can lead to embarassing errors,
> > like if you forget to check in a new file but *do* check in the change to the
> > Makefile that references it.
> >
> > So I thought I'd try a different interface to solve basically the same
> > problem. And so we have the 'shelve' and 'unshelve' commands.
> >
> > I know the names a bit dicky, I thought of 'postpone' and 'reinstate' or
> > something, but 'shelve' and 'unshelve' are at least obviously symetrical.
> >
> > Basically you can run 'bzr shelve' and it will prompt you which hunks you want
> > to 'place on the shelf', ie. put away for the moment. You can then make sure
> > your tree still builds, run any tests, and then use the regular 'bzr commit'.
> >
> > You can the unshelve the hunks on your shelf, and repeat. You end up with more
> > or less the same end result as partial commit, but with less chance of error.
> >
> > I haven't really used this much yet, so I don't know if I like it. And the
> > implementation is very hacky at the moment, it's just a proof of concept.
> >
> > I stole Aaron's code for parsing patches, which I think was part of his
> > annotate patch, and munged it a bit. Thanks Aaron.
> >
> > Stick the attached files in a directory and put that in your $BZRPATH, then yo
> > u should be able to run 'shelve' and 'unshelve'.
> >
> > Bug reports welcome, although I'm really just throwing this over the wall to
> > see if anyone thinks it's a good way of doing this. Let me know.
> >
> > 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