~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Jelmer Vernooij
  • Date: 2011-09-07 11:51:20 UTC
  • mfrom: (6123.1.9 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6130.
  • Revision ID: jelmer@samba.org-20110907115120-ugiagn73ovvd7ylb
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3802
3802
                                param_name='starting_with', short_name='s',
3803
3803
                                help=
3804
3804
                                'Load only the tests starting with TESTID.'),
 
3805
                     Option('sync',
 
3806
                            help="By default we disable fsync and fdatasync"
 
3807
                                 " while running the test suite.")
3805
3808
                     ]
3806
3809
    encoding_type = 'replace'
3807
3810
 
3815
3818
            first=False, list_only=False,
3816
3819
            randomize=None, exclude=None, strict=False,
3817
3820
            load_list=None, debugflag=None, starting_with=None, subunit=False,
3818
 
            parallel=None, lsprof_tests=False):
 
3821
            parallel=None, lsprof_tests=False,
 
3822
            sync=False):
3819
3823
        from bzrlib import tests
3820
3824
 
3821
3825
        if testspecs_list is not None:
3850
3854
            exclude_pattern = None
3851
3855
        else:
3852
3856
            exclude_pattern = '(' + '|'.join(exclude) + ')'
 
3857
        if not sync:
 
3858
            self._disable_fsync()
3853
3859
        selftest_kwargs = {"verbose": verbose,
3854
3860
                          "pattern": pattern,
3855
3861
                          "stop_on_failure": one,
3877
3883
            cleanup()
3878
3884
        return int(not result)
3879
3885
 
 
3886
    def _disable_fsync(self):
 
3887
        """Change the 'os' functionality to not synchronize."""
 
3888
        self._orig_fsync = getattr(os, 'fsync', None)
 
3889
        if self._orig_fsync is not None:
 
3890
            os.fsync = lambda filedes: None
 
3891
        self._orig_fdatasync = getattr(os, 'fdatasync', None)
 
3892
        if self._orig_fdatasync is not None:
 
3893
            os.fdatasync = lambda filedes: None
 
3894
 
3880
3895
 
3881
3896
class cmd_version(Command):
3882
3897
    __doc__ = """Show version of bzr."""
5647
5662
                note('Tag %s already exists for that revision.' % tag_name)
5648
5663
            else:
5649
5664
                branch.tags.set_tag(tag_name, revision_id)
5650
 
                note('Created tag %s.' % tag_name)
 
5665
                if existing_target is None:
 
5666
                    note('Created tag %s.' % tag_name)
 
5667
                else:
 
5668
                    note('Updated tag %s.' % tag_name)
5651
5669
 
5652
5670
 
5653
5671
class cmd_tags(Command):