Rev 6165: Add a separate method to determines the tags for the reivision range. in file:///home/vila/src/bzr/bugs/857335-tags-revs-slow/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Sat Sep 24 03:24:53 UTC 2011
At file:///home/vila/src/bzr/bugs/857335-tags-revs-slow/
------------------------------------------------------------
revno: 6165
revision-id: v.ladeuil+lp at free.fr-20110924032452-95g1wybxl9lv1nq3
parent: v.ladeuil+lp at free.fr-20110923153059-jlgy69j2nb3fmtn6
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 857335-tags-revs-slow
timestamp: Sat 2011-09-24 05:24:52 +0200
message:
Add a separate method to determines the tags for the reivision range.
-------------- next part --------------
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py 2011-09-23 15:30:59 +0000
+++ b/bzrlib/builtins.py 2011-09-24 03:24:52 +0000
@@ -5752,32 +5752,8 @@
self.add_cleanup(branch.lock_read().unlock)
if revision:
- range_valid = True
- rev1, rev2 = _get_revision_range(revision, branch, self.name())
- revid1, revid2 = rev1.rev_id, rev2.rev_id
- # _get_revision_range will always set revid2 if it's not specified.
- # If revid1 is None, it means we want to start from the branch
- # origin which is always a valid ancestor. If revid1 == revid2, the
- # ancestry check is useless.
- if revid1 and revid1 != revid2:
- # FIXME: We really want to use the same graph than
- # branch.iter_merge_sorted_revisions below, but this is not
- # easily available -- vila 2011-09-23
- if branch.repository.get_graph().is_ancestor(revid2, revid1):
- # We don't want to ouput anything in this case...
- tags = []
- range_valid = False
- if range_valid:
- tagged_revids = branch.tags.get_reverse_tag_dict()
- # only show revisions between revid1 and revid2 (inclusive)
- 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
+ # Restrict to the specified range
+ tags = self._tags_for_range(branch, revision)
if sort is None:
sort = tag_sort_methods.get()
sort(branch, tags)
@@ -5798,6 +5774,32 @@
for tag, revspec in tags:
self.outf.write('%-20s %s\n' % (tag, revspec))
+ def _tags_for_range(self, branch, revision):
+ range_valid = True
+ rev1, rev2 = _get_revision_range(revision, branch, self.name())
+ revid1, revid2 = rev1.rev_id, rev2.rev_id
+ # _get_revision_range will always set revid2 if it's not specified.
+ # If revid1 is None, it means we want to start from the branch
+ # origin which is always a valid ancestor. If revid1 == revid2, the
+ # ancestry check is useless.
+ if revid1 and revid1 != revid2:
+ # FIXME: We really want to use the same graph than
+ # branch.iter_merge_sorted_revisions below, but this is not
+ # easily available -- vila 2011-09-23
+ if branch.repository.get_graph().is_ancestor(revid2, revid1):
+ # We don't want to output anything in this case...
+ return []
+ # only show revisions between revid1 and revid2 (inclusive)
+ tagged_revids = branch.tags.get_reverse_tag_dict()
+ 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])
+ return found
+
class cmd_reconfigure(Command):
__doc__ = """Reconfigure the type of a bzr directory.
More information about the bazaar-commits
mailing list