3733
3733
param_name='starting_with', short_name='s',
3735
3735
'Load only the tests starting with TESTID.'),
3737
help="By default we disable fsync and fdatasync"
3738
" while running the test suite.")
3737
3740
encoding_type = 'replace'
3746
3749
first=False, list_only=False,
3747
3750
randomize=None, exclude=None, strict=False,
3748
3751
load_list=None, debugflag=None, starting_with=None, subunit=False,
3749
parallel=None, lsprof_tests=False):
3752
parallel=None, lsprof_tests=False,
3750
3754
from bzrlib import tests
3752
3756
if testspecs_list is not None:
3809
3815
return int(not result)
3817
def _disable_fsync(self):
3818
"""Change the 'os' functionality to not synchronize."""
3819
self._orig_fsync = getattr(os, 'fsync', None)
3820
if self._orig_fsync is not None:
3821
os.fsync = lambda filedes: None
3822
self._orig_fdatasync = getattr(os, 'fdatasync', None)
3823
if self._orig_fdatasync is not None:
3824
os.fdatasync = lambda filedes: None
3812
3827
class cmd_version(Command):
3813
3828
__doc__ = """Show version of bzr."""
5601
5616
self.add_cleanup(branch.lock_read().unlock)
5603
graph = branch.repository.get_graph()
5604
rev1, rev2 = _get_revision_range(revision, branch, self.name())
5605
revid1, revid2 = rev1.rev_id, rev2.rev_id
5606
# only show revisions between revid1 and revid2 (inclusive)
5607
tags = [(tag, revid) for tag, revid in tags if
5608
graph.is_between(revid, revid1, revid2)]
5618
# Restrict to the specified range
5619
tags = self._tags_for_range(branch, revision)
5609
5620
if sort is None:
5610
5621
sort = tag_sort_methods.get()
5611
5622
sort(branch, tags)
5625
5636
for tag, revspec in tags:
5626
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])
5629
5666
class cmd_reconfigure(Command):
5630
5667
__doc__ = """Reconfigure the type of a bzr directory.