[PLUGIN] Lesslog -> run bzr log through less automatically

John Arbash Meinel john at arbash-meinel.com
Fri Dec 9 15:10:36 GMT 2005


Michael Ellerman wrote:
> Hiya,
> 
> I'm a lazy arse, so typing "bzr log | less" is just too much for me. Hence the 
> "lesslog" plugin I just wrote, alias "ll" which does the less part for you.
> 
> It takes all the same options as regular log, in fact it's a subclass.
> 
> Don't be too lazy to branch it!
> 
> http://michael.ellerman.id.au/files/bzr/lesslog
> 
> cheers
> 

I haven't had a chance to really review it (I'm answering email
offline). But a few pieces...

First, I think this is a useful plugin for the current way people use
"bzr log". I just want to bring up a couple points.

We should only invoke a pager if the number of lines are going to be
more than a screenful, and sys.stdout is a tty. You probably are doing
the latter, though I doubt you are doing the former. (You would have to
wrap up the output to figure out how long it is, etc).

More important is that I think using 'less' is just a workaround for a
bad design. Which is that "bzr log" prints out the entire log. All 1500
revisions (+ merged revisions). Which is why it has to print it in
reverse, so that you can run less, and why it needs to start printing
right away, because it takes too long to read all 1500 entries. And why
we had problems with "broken pipe" messages, because people weren't
waiting (and shouldn't have to).

I have my own short-log plugin, which isn't exactly the right thing to
do, but it changes the log defaults to be --short, --forward, and print
only the last 10 revisions. Back before it was broken, you could always
do "bzr log -r.. --long --reverse" if you wanted the more complete display.

For me, 10 is a rough heuristic which in short mode fills the screen,
and frequently gives me just enough context that I know what is going on.

Maybe I'm missing the true value of "bzr log | less". If someone has
reasons why it is better, please let me know. My understanding is that
the major reason we do it, is because that is what "cvs log" does. But
"cvs log" is a really crappy command, which we probably don't really
want to emulate.

Arch had an interesting implementation, where because you have named
branches, it could go back to "base-0" and would only display the
semi-recent ancestry (provided you used lots of short-lived branches).
I know it has been proposed to keep track of the branch-point (the
revision when "bzr branch" was run. Not updated by pull, etc).
But I think a lot of branches are mirrors, and so it doesn't make sense
to have a specific history point like that.

John
=:->

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051209/7ed6d40e/attachment.pgp 


More information about the bazaar mailing list