~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/builtins.py

  • Committer: Andrew Bennetts
  • Date: 2010-08-31 07:12:18 UTC
  • mto: This revision was merged to the branch mainline in revision 5401.
  • Revision ID: andrew.bennetts@canonical.com-20100831071218-4kjieu3ejqcdmdom
Use has_id rather than __contains__; expand NEWS entry; add What's New entry.

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
    bzrdir,
33
33
    directory_service,
34
34
    delta,
35
 
    config as _mod_config,
 
35
    config,
36
36
    errors,
37
37
    globbing,
38
38
    hooks,
3322
3322
                try:
3323
3323
                    c = Branch.open_containing(u'.')[0].get_config()
3324
3324
                except errors.NotBranchError:
3325
 
                    c = _mod_config.GlobalConfig()
 
3325
                    c = config.GlobalConfig()
3326
3326
            else:
3327
3327
                c = Branch.open(directory).get_config()
3328
3328
            if email:
3333
3333
 
3334
3334
        # display a warning if an email address isn't included in the given name.
3335
3335
        try:
3336
 
            _mod_config.extract_email_address(name)
 
3336
            config.extract_email_address(name)
3337
3337
        except errors.NoEmailInUsername, e:
3338
3338
            warning('"%s" does not seem to contain an email address.  '
3339
3339
                    'This is allowed, but not recommended.', name)
3345
3345
            else:
3346
3346
                c = Branch.open(directory).get_config()
3347
3347
        else:
3348
 
            c = _mod_config.GlobalConfig()
 
3348
            c = config.GlobalConfig()
3349
3349
        c.set_user_option('email', name)
3350
3350
 
3351
3351
 
3418
3418
                'bzr alias --remove expects an alias to remove.')
3419
3419
        # If alias is not found, print something like:
3420
3420
        # unalias: foo: not found
3421
 
        c = _mod_config.GlobalConfig()
 
3421
        c = config.GlobalConfig()
3422
3422
        c.unset_alias(alias_name)
3423
3423
 
3424
3424
    @display_command
3425
3425
    def print_aliases(self):
3426
3426
        """Print out the defined aliases in a similar format to bash."""
3427
 
        aliases = _mod_config.GlobalConfig().get_aliases()
 
3427
        aliases = config.GlobalConfig().get_aliases()
3428
3428
        for key, value in sorted(aliases.iteritems()):
3429
3429
            self.outf.write('bzr alias %s="%s"\n' % (key, value))
3430
3430
 
3440
3440
 
3441
3441
    def set_alias(self, alias_name, alias_command):
3442
3442
        """Save the alias in the global config."""
3443
 
        c = _mod_config.GlobalConfig()
 
3443
        c = config.GlobalConfig()
3444
3444
        c.set_alias(alias_name, alias_command)
3445
3445
 
3446
3446
 
3570
3570
            randomize=None, exclude=None, strict=False,
3571
3571
            load_list=None, debugflag=None, starting_with=None, subunit=False,
3572
3572
            parallel=None, lsprof_tests=False):
3573
 
        from bzrlib import tests
 
3573
        from bzrlib.tests import selftest
 
3574
 
 
3575
        # Make deprecation warnings visible, unless -Werror is set
 
3576
        symbol_versioning.activate_deprecation_warnings(override=False)
3574
3577
 
3575
3578
        if testspecs_list is not None:
3576
3579
            pattern = '|'.join(testspecs_list)
3617
3620
                          "starting_with": starting_with
3618
3621
                          }
3619
3622
        selftest_kwargs.update(self.additional_selftest_args)
3620
 
 
3621
 
        # Make deprecation warnings visible, unless -Werror is set
3622
 
        cleanup = symbol_versioning.activate_deprecation_warnings(
3623
 
            override=False)
3624
 
        try:
3625
 
            result = tests.selftest(**selftest_kwargs)
3626
 
        finally:
3627
 
            cleanup()
 
3623
        result = selftest(**selftest_kwargs)
3628
3624
        return int(not result)
3629
3625
 
3630
3626
 
4811
4807
 
4812
4808
 
4813
4809
class cmd_break_lock(Command):
4814
 
    __doc__ = """Break a dead lock.
4815
 
 
4816
 
    This command breaks a lock on a repository, branch, working directory or
4817
 
    config file.
 
4810
    __doc__ = """Break a dead lock on a repository, branch or working directory.
4818
4811
 
4819
4812
    CAUTION: Locks should only be broken when you are sure that the process
4820
4813
    holding the lock has been stopped.
4825
4818
    :Examples:
4826
4819
        bzr break-lock
4827
4820
        bzr break-lock bzr+ssh://example.com/bzr/foo
4828
 
        bzr break-lock --conf ~/.bazaar
4829
4821
    """
4830
 
 
4831
4822
    takes_args = ['location?']
4832
 
    takes_options = [
4833
 
        Option('config',
4834
 
               help='LOCATION is the directory where the config lock is.'),
4835
 
        ]
4836
4823
 
4837
 
    def run(self, location=None, config=False):
 
4824
    def run(self, location=None, show=False):
4838
4825
        if location is None:
4839
4826
            location = u'.'
4840
 
        if config:
4841
 
            conf = _mod_config.LockableConfig(file_name=location)
4842
 
            conf.break_lock()
4843
 
        else:
4844
 
            control, relpath = bzrdir.BzrDir.open_containing(location)
4845
 
            try:
4846
 
                control.break_lock()
4847
 
            except NotImplementedError:
4848
 
                pass
 
4827
        control, relpath = bzrdir.BzrDir.open_containing(location)
 
4828
        try:
 
4829
            control.break_lock()
 
4830
        except NotImplementedError:
 
4831
            pass
4849
4832
 
4850
4833
 
4851
4834
class cmd_wait_until_signalled(Command):