Help stop yourself from working with the wrong cobzr branch

John Arbash Meinel john at arbash-meinel.com
Tue Mar 12 03:58:57 UTC 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2013-03-11 22:12, Gary Poster wrote:
> Hi.  Francesco Banconi, on the Yellow squad, wanted to keep from
> doing work in the wrong cobzr branch.  He came up with the
> following snippet to add your cobzr branch to the prompt.  He warns
> that it is not very efficient, but works for him.
> 
> http://pastebin.ubuntu.com/5605451/
> 
> I thought it was worth sharing beyond the people looking at IRC at
> that instant, so here it is.  Enjoy and/or suggest improvements as
> desired!
> 
> Gary
> 

If you are interested in this sort of thing, I wrote this a long time ago:
https://code.launchpad.net/~jameinel/+junk/my_nick

It is a fairly small C++ program that just inspects the bzr metadata
and extracts the branch name. It works with cobzr, lightweight
checkouts, normal branches, and colocated branches (introduced in
bzr-2.5).

I use it as:
export PS1="\[\033[01;32m\]\u@\[\033[01;35m\]\h
\[\033[32m\]\w\$(~/bin/my_nick)\n\[\033[00m\]\$ "

The code itself handles whether to include the {} around the branch nick.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlE+qAEACgkQJdeBCYSNAAM7OwCeKNp4uNDdgRkBOqYfMGROnPkO
yVgAn0NCKTtH3pCTBdI9W2+eKjaFldIw
=VHwt
-----END PGP SIGNATURE-----



More information about the Juju-dev mailing list