[MERGE] show_log with get_revisions

John Arbash Meinel john at arbash-meinel.com
Mon Jun 12 16:26:36 BST 2006


Aaron Bentley wrote:
> Hi all,
> 
> I've been working on improving performance of the log command, because
> this is one of the first things a new user will experience.  This bundle
> adds Repository.get_revisions, and teaches show_log to use it.
> 
> This produces a 13% speedup in my tests, and should also make further
> optimization possible.
> 
> Aaron



...

=== modified file bzrlib/log.py //
last-changed:aaron.bentley at utoronto.ca-20060
... 610142239-7c75c4e0dc2814b3
--- bzrlib/log.py
+++ bzrlib/log.py
@@ -157,8 +157,12 @@
     """
     branch.lock_read()
     try:
-        _show_log(branch, lf, specific_fileid, verbose, direction,
-                  start_revision, end_revision, search)
+        branch.repository.lock_read()
+        try:
+            _show_log(branch, lf, specific_fileid, verbose, direction,
+                      start_revision, end_revision, search)
+        finally:
+            branch.repository.unlock()
     finally:
         branch.unlock()


I assume the extra 'repository.lock_read()' is because we are trying to
move away from 'branch.lock_read() auto locks the repository'?
Is it worth adding these changes now?



...

=== modified file bzrlib/store/revision/__init__.py
--- bzrlib/store/revision/__init__.py
+++ bzrlib/store/revision/__init__.py
@@ -108,6 +108,10 @@

     def get_revision(self, revision_id, transaction):
         """Return the Revision object for a named revision."""
+        return self.get_revisions([revision_id], transaction)[0]
+
+    def get_revisions(self, revision_ids, transaction):
+        """Return the Revision objects for a list of named revisions."""
         raise NotImplementedError(self.get_revision)

     def get_signature_text(self, revision_id, transaction):


Shouldn't we add a default implementation which just iterates over the
list and gets them one at a time? That way all Store objects would have
implemented this codepath.

I also thought that part of the goal was to be able to get the first 5
revisions quickly, so that 'bzr log' is instantaneous to start up, and
then be able to get the rest of them later.
I think we need to change this into a generator, rather than returning
the whole list.

So +0.5 right now. We need to address what type of benchmark we want,
and we want to return a generator, so it doesn't have to extract all the
revisions ahead of time.

Also, what we really want is for this stuff to also be available as a
per-file, and for inventories. So that we can do the 'bzr log -v' fast
as well.

John
=:->

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


More information about the bazaar mailing list