5616
5616
self.add_cleanup(branch.lock_read().unlock)
5618
graph = branch.repository.get_graph()
5619
rev1, rev2 = _get_revision_range(revision, branch, self.name())
5620
revid1, revid2 = rev1.rev_id, rev2.rev_id
5621
# only show revisions between revid1 and revid2 (inclusive)
5622
tags = [(tag, revid) for tag, revid in tags if
5623
graph.is_between(revid, revid1, revid2)]
5618
# Restrict to the specified range
5619
tags = self._tags_for_range(branch, revision)
5624
5620
if sort is None:
5625
5621
sort = tag_sort_methods.get()
5626
5622
sort(branch, tags)
5640
5636
for tag, revspec in tags:
5641
5637
self.outf.write('%-20s %s\n' % (tag, revspec))
5639
def _tags_for_range(self, branch, revision):
5641
rev1, rev2 = _get_revision_range(revision, branch, self.name())
5642
revid1, revid2 = rev1.rev_id, rev2.rev_id
5643
# _get_revision_range will always set revid2 if it's not specified.
5644
# If revid1 is None, it means we want to start from the branch
5645
# origin which is always a valid ancestor. If revid1 == revid2, the
5646
# ancestry check is useless.
5647
if revid1 and revid1 != revid2:
5648
# FIXME: We really want to use the same graph than
5649
# branch.iter_merge_sorted_revisions below, but this is not
5650
# easily available -- vila 2011-09-23
5651
if branch.repository.get_graph().is_ancestor(revid2, revid1):
5652
# We don't want to output anything in this case...
5654
# only show revisions between revid1 and revid2 (inclusive)
5655
tagged_revids = branch.tags.get_reverse_tag_dict()
5657
for r in branch.iter_merge_sorted_revisions(
5658
start_revision_id=revid2, stop_revision_id=revid1,
5659
stop_rule='include'):
5660
revid_tags = tagged_revids.get(r[0], None)
5662
found.extend([(tag, r[0]) for tag in revid_tags])
5644
5666
class cmd_reconfigure(Command):
5645
5667
__doc__ = """Reconfigure the type of a bzr directory.