[ANN] History-search/grep plugin
John A Meinel
john at arbash-meinel.com
Fri Feb 10 14:24:14 GMT 2006
Michael Ellerman wrote:
> Hi guys,
>
> With a few pointers from Martin I hacked up a history-search plugin
> yesterday. It basically does a grep through history and shows you
> which revisions match your pattern.
>
I assume you mean it is searching through the texts, because 'bzr log
--message foo' will search for 'foo' in the commit logs.
> Actually it shows you the revision that introduced the pattern you're
> looking for, it might also be nice to show which revision(s) deleted
> the text, but I couldn't decide how that should work in the UI.
>
> It's _insanely_ fast, thanks to the weave, we can search bzr.dev for a
> non-matching pattern in about 3 seconds. With lots of matches you end
> spending all your time converting revids to revnos, so --show-ids
> makes it a lot faster.
If this is the slow point, simply create a cached dictionary. With:
revid_to_revno = {}
for idx, rev in enumerate(branch.revision_history()):
revid_to_revno[rev] = idx+1
The big problem is that branch.revid_to_revno() is doing a list.index()
call, which has to scan through the whole list, versus a hash lookup in
a dictionary.
Since you know the specific problem, I think this bottleneck could
easily be removed.
>
> Nice things to have: limiting history with -r, only searching certain
> files, nicer output.
>
> I think to make this really usable it needs a GUI, there's too much
> information otherwise.
>
> Check it out:
>
> http://michael.ellerman.id.au/files/bzr/hgrep
>
> cheers
>
Sounds nice.
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/20060210/acf98717/attachment.pgp
More information about the bazaar
mailing list