Rev 6163: Stop reloading all ancestry for each tag when searching tags in a revision range (still breaks if X>Y in -rX..Y) in file:///home/vila/src/bzr/experimental/tags-revs-slow/

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri Sep 23 14:15:36 UTC 2011


At file:///home/vila/src/bzr/experimental/tags-revs-slow/

------------------------------------------------------------
revno: 6163
revision-id: v.ladeuil+lp at free.fr-20110923141536-pvorifvebpndrbnl
parent: pqm at pqm.ubuntu.com-20110923075128-5wq30ehyq44w0bcl
fixes bug: https://launchpad.net/bugs/857335
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: tags-revs-slow
timestamp: Fri 2011-09-23 16:15:36 +0200
message:
  Stop reloading all ancestry for each tag when searching tags in a revision range (still breaks if X>Y in -rX..Y)
-------------- next part --------------
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2011-09-22 19:51:18 +0000
+++ b/bzrlib/builtins.py	2011-09-23 14:15:36 +0000
@@ -2620,7 +2620,7 @@
             match_dict['author'] = match_author
         if match_bugs:
             match_dict['bugs'] = match_bugs
-            
+
         # Build the LogRequest and execute it
         if len(file_ids) == 0:
             file_ids = None
@@ -5752,12 +5752,18 @@
 
         self.add_cleanup(branch.lock_read().unlock)
         if revision:
-            graph = branch.repository.get_graph()
             rev1, rev2 = _get_revision_range(revision, branch, self.name())
             revid1, revid2 = rev1.rev_id, rev2.rev_id
+            tagged_revids = branch.tags.get_reverse_tag_dict()
             # only show revisions between revid1 and revid2 (inclusive)
-            tags = [(tag, revid) for tag, revid in tags if
-                graph.is_between(revid, revid1, revid2)]
+            found = []
+            for r in branch.iter_merge_sorted_revisions(
+                start_revision_id=revid2, stop_revision_id=revid1,
+                stop_rule='include'):
+                revid_tags = tagged_revids.get(r[0], None)
+                if revid_tags:
+                    found.extend([(tag, r[0]) for tag in revid_tags])
+            tags = found
         if sort is None:
             sort = tag_sort_methods.get()
         sort(branch, tags)
@@ -5768,7 +5774,8 @@
                     revno = branch.revision_id_to_dotted_revno(revid)
                     if isinstance(revno, tuple):
                         revno = '.'.join(map(str, revno))
-                except (errors.NoSuchRevision, errors.GhostRevisionsHaveNoRevno):
+                except (errors.NoSuchRevision,
+                        errors.GhostRevisionsHaveNoRevno):
                     # Bad tag data/merges can lead to tagged revisions
                     # which are not in this branch. Fail gracefully ...
                     revno = '?'

=== modified file 'doc/en/release-notes/bzr-2.5.txt'
--- a/doc/en/release-notes/bzr-2.5.txt	2011-09-23 07:51:28 +0000
+++ b/doc/en/release-notes/bzr-2.5.txt	2011-09-23 14:15:36 +0000
@@ -26,6 +26,9 @@
 .. Improvements to existing commands, especially improved performance 
    or memory usage, or better results.
 
+* Stop reloading all ancestry for each tag when searching tags in a revision
+  range. (Vincent Ladeuil, #857335)
+
 Bug Fixes
 *********
 



More information about the bazaar-commits mailing list